diff --git a/.circleci/config.yml b/.circleci/config.yml deleted file mode 100644 index d9000a7..0000000 --- a/.circleci/config.yml +++ /dev/null @@ -1,109 +0,0 @@ -version: 2.1 - -orbs: - slack: circleci/slack@4.1 - -slack/notify: &slack_notify - branch_pattern: master - event: fail - channel: ci-build-status - template: SLACK_TAG_CI_FAILURE_TEMPLATE - -commands: - export_slack_id: - steps: - - run: - name : Exporting circleci username as slack id. - command: echo 'export SLACK_PARAM_MENTIONS="$CIRCLE_USERNAME"' >> "$BASH_ENV" - - run: - name : CircleCi To Slack user mapping. - command: | - echo $GITHUB_SLACK_USERMAPPING | base64 --decode > github_slack - while read -r line || [[ -n $line ]]; - do - [[ ${line//[[:space:]]/} =~ ^#.* || -z "$line" ]] && continue - echo "$line" | tr "=" "\n" | while read -r key; do - read -r value - if [ "$CIRCLE_USERNAME" = "${key}" ]; then - echo "export SLACK_PARAM_MENTIONS='<@${value}>'" >> $BASH_ENV - fi - done - done < github_slack - rm github_slack - -context: &context - - slack-templates - - slack_Oauth - - Github_Slack_UserMapping - -"-": &build7 - working_directory: ~/sift-php - steps: - - checkout - - export_slack_id - - run: sudo composer self-update - - restore_cache: - keys: - - composer-v1-{{ checksum "composer.lock" }} - - composer-v1- - - run: composer install -n --prefer-dist - - save_cache: - key: composer-v1-{{ checksum "composer.lock" }} - paths: - - vendor - - run: composer exec phpunit -v - - when: - condition: - equal: [ master, << pipeline.git.branch >> ] - steps: - - slack/notify: - <<: *slack_notify - -jobs: - build71: - <<: *build7 - docker: - - image: circleci/php:7.1.27-stretch - - build72: - <<: *build7 - docker: - - image: circleci/php:7.2.16-stretch - - build73: - <<: *build7 - docker: - - image: circleci/php:7.3.3-stretch - - build74: - <<: *build7 - docker: - - image: circleci/php:7.4.25-cli-buster-node - - run-integration-tests-php74: - docker: - - image: circleci/php:7.4.25-cli-buster-node - steps: - - checkout - - run: - name: Install the lib and run tests - command: | - composer install -n --prefer-dist - php test_integration_app/main.php - -workflows: - version: 2 - check_compile: - jobs: - - build71: - context: *context - - build72: - context: *context - - build73: - context: *context - - build74: - context: *context - - run-integration-tests-php74: - filters: - branches: - only: master diff --git a/.jenkins/Jenkinsfile b/.jenkins/Jenkinsfile deleted file mode 100644 index 68bde66..0000000 --- a/.jenkins/Jenkinsfile +++ /dev/null @@ -1,113 +0,0 @@ -// Load Jenkins shared library -jenkinsBranch = 'v0.15.0' -sharedLib = library("shared-lib@${jenkinsBranch}") - -def siftPhpWorkflow = sharedLib.com.sift.ci.SiftPhpWorkflow.new() -def ciUtil = sharedLib.com.sift.ci.CIUtil.new() -def stackdriver = sharedLib.com.sift.ci.StackDriverMetrics.new() - -// Default GitHub status context for automatically triggered builds -def defaultStatusContext = 'Jenkins:auto' - -// GitHub repo name -def repoName = 'sift-php' - -pipeline { - agent none - options { - timestamps() - skipDefaultCheckout() - disableConcurrentBuilds() - disableRestartFromStage() - parallelsAlwaysFailFast() - buildDiscarder logRotator(artifactDaysToKeepStr: '', artifactNumToKeepStr: '', daysToKeepStr: '30', numToKeepStr: '') - timeout(time: 1, unit: 'HOURS') - } - environment { - GIT_BRANCH = "${env.CHANGE_BRANCH != null? env.CHANGE_BRANCH : env.BRANCH_NAME}" - } - stages { - stage('Initialize') { - steps { - script { - statusContext = defaultStatusContext - // Get the commit sha for the build - commitSha = ciUtil.commitHashForBuild() - ciUtil.updateGithubCommitStatus(repoName, statusContext, 'Started', 'pending', commitSha) - } - } - } - stage ('Build and Test Workflows') { - steps { - script { - def workflows = [:] - - // Unit tests - def unitTestStages = [ - 'Tests - php 7.1':'7.1', - 'Tests - php 7.2':'7.2', - 'Tests - php 7.3':'7.3', - 'Tests - php 7.4':'7.4' - ] - - unitTestStages.each { stageName, phpVersion -> - workflows[stageName] = { - stage(stageName) { - ciUtil.updateGithubCommitStatus(repoName, stageName, 'Started', 'pending', commitSha) - try { - siftPhpWorkflow.runSiftPhpTest("php-${phpVersion.replace('.', '-')}-pod-template.yaml", "php${phpVersion}-${BUILD_TAG}", phpVersion) - ciUtil.updateGithubCommitStatus(repoName, stageName, 'SUCCESS', 'success', commitSha) - } catch (Exception e) { - ciUtil.updateGithubCommitStatus(repoName, stageName, 'FAILURE', 'failure', commitSha) - print("${stageName} failed") - throw e - } - } - } - } - - // Integration tests - def phpIntegrationTestsVersion = "7.4" - def integrationTestsStageName = "Integration Tests - php ${phpIntegrationTestsVersion}" - workflows[integrationTestsStageName] = { - stage(integrationTestsStageName) { - if (env.GIT_BRANCH.equals('master')) { - ciUtil.updateGithubCommitStatus(repoName, integrationTestsStageName, 'Started', 'pending', commitSha) - try { - siftPhpWorkflow.runSiftPhpIntegration("php-${phpIntegrationTestsVersion.replace('.','-')}-pod-template.yaml", - "php${phpIntegrationTestsVersion}-${BUILD_TAG}", - phpIntegrationTestsVersion) - ciUtil.updateGithubCommitStatus(repoName, integrationTestsStageName, 'SUCCESS', 'success', commitSha) - } catch (Exception e) { - ciUtil.updateGithubCommitStatus(repoName, integrationTestsStageName, 'FAILURE', 'failure', commitSha) - print("${integrationTestsStageName} failed") - throw e - } - } - } - } - - parallel workflows - } - } - } - } - post { - success { - script { - ciUtil.updateGithubCommitStatus(repoName, statusContext, currentBuild.currentResult, 'success', commitSha) - } - } - unsuccessful { - script { - ciUtil.updateGithubCommitStatus(repoName, statusContext, currentBuild.currentResult, 'failure', commitSha) - ciUtil.notifySlack(repoName, commitSha) - } - } - always { - script { - stackdriver.updatePipelineStatistics(this) - } - } - } -}