From a29f4b05369293f199bff1d8b8a46cc269df8b81 Mon Sep 17 00:00:00 2001 From: mnoman09 Date: Thu, 24 Mar 2022 18:27:07 +0500 Subject: [PATCH 01/26] Added source clear and other java stages --- .github/workflows/java.yml | 194 ++++++++++++++++++++++++ .github/workflows/source_clear_cron.yml | 16 ++ 2 files changed, 210 insertions(+) create mode 100644 .github/workflows/java.yml create mode 100644 .github/workflows/source_clear_cron.yml diff --git a/.github/workflows/java.yml b/.github/workflows/java.yml new file mode 100644 index 000000000..c94f13076 --- /dev/null +++ b/.github/workflows/java.yml @@ -0,0 +1,194 @@ + +name: Java CI with Gradle + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + workflow_dispatch: + inputs: + SNAPSHOT: + type: boolean + description: Set SNAPSHOT true to publish + +jobs: + lint_markdown_files: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Set up Ruby + uses: ruby/setup-ruby@v1 + with: + ruby-version: '2.6' + bundler-cache: true # runs 'bundle install' and caches installed gems automatically + - name: Install gem + run: | + gem install awesome_bot + - name: Run tests + run: find . -type f -name '*.md' -exec awesome_bot {} \; + + integration_tests: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + with: + # You should create a personal access token and store it in your repository + token: ${{ secrets.CI_USER_TOKEN }} + repository: 'optimizely/travisci-tools' + path: 'home/runner/travisci-tools' + ref: 'master' + - name: set SDK Branch if PR + if: ${{ github.event_name == 'pull_request' }} + run: | + echo "SDK_BRANCH=${{ github.head_ref }}" >> $GITHUB_ENV + echo "TRAVIS_BRANCH=${{ github.head_ref }}" >> $GITHUB_ENV + - name: set SDK Branch if not pull request + if: ${{ github.event_name != 'pull_request' }} + run: | + echo "SDK_BRANCH=${{ github.ref_name }}" >> $GITHUB_ENV + echo "TRAVIS_BRANCH=${{ github.ref_name }}" >> $GITHUB_ENV + - name: Trigger build + env: + SDK: java + BUILD_NUMBER: ${{ github.run_id }} + TESTAPP_BRANCH: master + GITHUB_TOKEN: ${{ secrets.CI_USER_TOKEN }} + TRAVIS_EVENT_TYPE: ${{ github.event_name }} + GITHUB_CONTEXT: ${{ toJson(github) }} + TRAVIS_REPO_SLUG: ${{ github.repository }} + TRAVIS_PULL_REQUEST_SLUG: ${{ github.repository }} + UPSTREAM_REPO: ${{ github.repository }} + TRAVIS_COMMIT: ${{ github.sha }} + TRAVIS_PULL_REQUEST_SHA: ${{ github.event.pull_request.head.sha }} + TRAVIS_PULL_REQUEST: ${{ github.event.pull_request.number }} + UPSTREAM_SHA: ${{ github.sha }} + TRAVIS_COM_TOKEN: ${{ secrets.TRAVIS_COM_TOKEN }} + EVENT_MESSAGE: ${{ github.event.message }} + HOME: 'home/runner' + run: | + echo "$GITHUB_CONTEXT" + home/runner/travisci-tools/trigger-script-with-status-update.sh + + fullstack_production_suite: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + with: + # You should create a personal access token and store it in your repository + token: ${{ secrets.CI_USER_TOKEN }} + repository: 'optimizely/travisci-tools' + path: 'home/runner/travisci-tools' + ref: 'master' + - name: set SDK Branch if PR + if: ${{ github.event_name == 'pull_request' }} + run: | + echo "SDK_BRANCH=${{ github.head_ref }}" >> $GITHUB_ENV + echo "TRAVIS_BRANCH=${{ github.head_ref }}" >> $GITHUB_ENV + - name: set SDK Branch if not pull request + if: ${{ github.event_name != 'pull_request' }} + run: | + echo "SDK_BRANCH=${{ github.ref_name }}" >> $GITHUB_ENV + echo "TRAVIS_BRANCH=${{ github.ref_name }}" >> $GITHUB_ENV + - name: Trigger build + env: + SDK: java + FULLSTACK_TEST_REPO: ProdTesting + BUILD_NUMBER: ${{ github.run_id }} + TESTAPP_BRANCH: master + GITHUB_TOKEN: ${{ secrets.CI_USER_TOKEN }} + TRAVIS_EVENT_TYPE: ${{ github.event_name }} + GITHUB_CONTEXT: ${{ toJson(github) }} + TRAVIS_REPO_SLUG: ${{ github.repository }} + TRAVIS_PULL_REQUEST_SLUG: ${{ github.repository }} + UPSTREAM_REPO: ${{ github.repository }} + TRAVIS_COMMIT: ${{ github.sha }} + TRAVIS_PULL_REQUEST_SHA: ${{ github.event.pull_request.head.sha }} + TRAVIS_PULL_REQUEST: ${{ github.event.pull_request.number }} + UPSTREAM_SHA: ${{ github.sha }} + TRAVIS_COM_TOKEN: ${{ secrets.TRAVIS_COM_TOKEN }} + EVENT_MESSAGE: ${{ github.event.message }} + HOME: 'home/runner' + run: | + echo "$GITHUB_CONTEXT" + home/runner/travisci-tools/trigger-script-with-status-update.sh + test: + runs-on: macos-latest + strategy: + fail-fast: false + matrix: + jdk: [8, 9] + optimizely_default_parser: [GSON_CONFIG_PARSER, JACKSON_CONFIG_PARSER, JSON_CONFIG_PARSER, JSON_SIMPLE_CONFIG_PARSER] + steps: + - name: checkout + uses: actions/checkout@v2 + + - name: set up JDK ${{ matrix.java }} + - uses: actions/checkout@v1 + - uses: AdoptOpenJDK/install-jdk@v1 + with: + version: ${{ matrix.java }} + architecture: x64 + cache: 'gradle' + - name: Grant execute permission for gradlew + run: chmod +x gradlew + + - name: Gradle cache + uses: actions/cache@v2 + with: + path: | + ~/.gradle/caches + ~/.gradle/wrapper + key: gradle-${{ runner.os }}-${{ hashFiles('**/*.gradle*') }}-${{ hashFiles('**/gradle/wrapper/gradle-wrapper.properties') }}-${{ hashFiles('**/buildSrc/**/*.kt') }} + + - name: run tests + env: + optimizely_default_parser: ${{ matrix.optimizely_default_parser }} + run: | + ./gradlew clean + ./gradlew exhaustiveTest + ./gradlew build + + publish: + if: startsWith(github.ref, 'refs/tags/v') + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Set env + run: echo "TRAVIS_TAG=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV + - name: set up JDK 8 + uses: actions/setup-java@v2 + with: + java-version: '8' + distribution: 'temurin' + cache: gradle + - name: Grant execute permission for gradlew + run: chmod +x gradlew + - name: Ship + env: + MAVEN_SIGNING_KEY_BASE64: ${{ secrets.MAVEN_SIGNING_KEY_BASE64 }} + MAVEN_SIGNING_PASSPHRASE: ${{ secrets.MAVEN_SIGNING_PASSPHRASE }} + MAVEN_CENTRAL_USERNAME: ${{ secrets.MAVEN_CENTRAL_USERNAME }} + MAVEN_CENTRAL_PASSWORD: ${{ secrets.MAVEN_CENTRAL_PASSWORD }} + run: TRAVIS_TAG=${{ env.TRAVIS_TAG }} ./gradlew ship + + snapshot: + if: ${{ github.event.inputs.SNAPSHOT == 'true' && github.event_name == 'workflow_dispatch' }} + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: set up JDK 8 + uses: actions/setup-java@v2 + with: + java-version: '8' + distribution: 'temurin' + cache: gradle + - name: Grant execute permission for gradlew + run: chmod +x gradlew + - name: Ship + env: + MAVEN_SIGNING_KEY_BASE64: ${{ secrets.MAVEN_SIGNING_KEY_BASE64 }} + MAVEN_SIGNING_PASSPHRASE: ${{ secrets.MAVEN_SIGNING_PASSPHRASE }} + MAVEN_CENTRAL_USERNAME: ${{ secrets.MAVEN_CENTRAL_USERNAME }} + MAVEN_CENTRAL_PASSWORD: ${{ secrets.MAVEN_CENTRAL_PASSWORD }} + run: TRAVIS_TAG=BB-SNAPSHOT ./gradlew ship diff --git a/.github/workflows/source_clear_cron.yml b/.github/workflows/source_clear_cron.yml new file mode 100644 index 000000000..54eca5358 --- /dev/null +++ b/.github/workflows/source_clear_cron.yml @@ -0,0 +1,16 @@ +name: Source clear + +on: + schedule: + # Runs "weekly" + - cron: '0 0 * * 0' + +jobs: + source_clear: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Source clear scan + env: + SRCCLR_API_TOKEN: ${{ secrets.SRCCLR_API_TOKEN }} + run: curl -sSL https://download.sourceclear.com/ci.sh | bash -s – scan From a27d10c58762368f2bf0280fa24773eb73af03d1 Mon Sep 17 00:00:00 2001 From: mnoman09 Date: Thu, 24 Mar 2022 18:32:18 +0500 Subject: [PATCH 02/26] test --- .github/workflows/java.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/java.yml b/.github/workflows/java.yml index c94f13076..8e7e80dc9 100644 --- a/.github/workflows/java.yml +++ b/.github/workflows/java.yml @@ -124,7 +124,6 @@ jobs: uses: actions/checkout@v2 - name: set up JDK ${{ matrix.java }} - - uses: actions/checkout@v1 - uses: AdoptOpenJDK/install-jdk@v1 with: version: ${{ matrix.java }} From 1e06bc98cb752e6ca86d1620f3cd0af2600ecf25 Mon Sep 17 00:00:00 2001 From: mnoman09 Date: Thu, 24 Mar 2022 18:33:16 +0500 Subject: [PATCH 03/26] test --- .github/workflows/java.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/java.yml b/.github/workflows/java.yml index 8e7e80dc9..cfc2b9800 100644 --- a/.github/workflows/java.yml +++ b/.github/workflows/java.yml @@ -124,7 +124,7 @@ jobs: uses: actions/checkout@v2 - name: set up JDK ${{ matrix.java }} - - uses: AdoptOpenJDK/install-jdk@v1 + uses: AdoptOpenJDK/install-jdk@v1 with: version: ${{ matrix.java }} architecture: x64 From 83556cb8fbb0ccae55c211769fe40574f8b13dd3 Mon Sep 17 00:00:00 2001 From: mnoman09 Date: Thu, 24 Mar 2022 18:34:50 +0500 Subject: [PATCH 04/26] testing --- .github/workflows/java.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/java.yml b/.github/workflows/java.yml index cfc2b9800..5ca56ceb3 100644 --- a/.github/workflows/java.yml +++ b/.github/workflows/java.yml @@ -128,7 +128,6 @@ jobs: with: version: ${{ matrix.java }} architecture: x64 - cache: 'gradle' - name: Grant execute permission for gradlew run: chmod +x gradlew From 72c9abfac253e0371e712408f8f87b848a925c0a Mon Sep 17 00:00:00 2001 From: mnoman09 Date: Thu, 24 Mar 2022 18:38:01 +0500 Subject: [PATCH 05/26] testings --- .github/workflows/java.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/java.yml b/.github/workflows/java.yml index 5ca56ceb3..69fbd988a 100644 --- a/.github/workflows/java.yml +++ b/.github/workflows/java.yml @@ -128,6 +128,7 @@ jobs: with: version: ${{ matrix.java }} architecture: x64 + - name: Grant execute permission for gradlew run: chmod +x gradlew From 131673792b2f3e646e34940de8ecde2ea9939210 Mon Sep 17 00:00:00 2001 From: mnoman09 Date: Thu, 24 Mar 2022 18:42:54 +0500 Subject: [PATCH 06/26] test --- .github/workflows/java.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/java.yml b/.github/workflows/java.yml index 69fbd988a..6c84f6f90 100644 --- a/.github/workflows/java.yml +++ b/.github/workflows/java.yml @@ -123,10 +123,10 @@ jobs: - name: checkout uses: actions/checkout@v2 - - name: set up JDK ${{ matrix.java }} + - name: set up JDK ${{ matrix.jdk }} uses: AdoptOpenJDK/install-jdk@v1 with: - version: ${{ matrix.java }} + version: ${{ matrix.jdk }} architecture: x64 - name: Grant execute permission for gradlew From 2504e08e288ee48affb2ffaa5b0b7df40dea4f59 Mon Sep 17 00:00:00 2001 From: mnoman09 Date: Thu, 24 Mar 2022 19:00:09 +0500 Subject: [PATCH 07/26] added failure and success steps --- .github/workflows/java.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.github/workflows/java.yml b/.github/workflows/java.yml index 6c84f6f90..76e9bd7a9 100644 --- a/.github/workflows/java.yml +++ b/.github/workflows/java.yml @@ -141,12 +141,22 @@ jobs: key: gradle-${{ runner.os }}-${{ hashFiles('**/*.gradle*') }}-${{ hashFiles('**/gradle/wrapper/gradle-wrapper.properties') }}-${{ hashFiles('**/buildSrc/**/*.kt') }} - name: run tests + id: unit_tests env: optimizely_default_parser: ${{ matrix.optimizely_default_parser }} run: | ./gradlew clean ./gradlew exhaustiveTest ./gradlew build + - name: Check on failures + if: steps.unit_tests.outcome != 'success' + run: | + cat /home/runner/java-sdk/core-api/build/reports/findbugs/main.html + cat /home/runner/java-sdk/core-api/build/reports/findbugs/test.html + - name: Check on success + if: steps.unit_tests.outcome == 'success' + run: | + ./gradlew coveralls uploadArchives --console plain publish: if: startsWith(github.ref, 'refs/tags/v') From 84ed08f299b281d0980c6325dc74098e4c36e80c Mon Sep 17 00:00:00 2001 From: mnoman09 Date: Fri, 25 Mar 2022 16:21:22 +0500 Subject: [PATCH 08/26] Removing travis yml as all the actions are moved to git action --- .travis.yml | 92 ----------------------------------------------------- 1 file changed, 92 deletions(-) delete mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 2735eacaf..000000000 --- a/.travis.yml +++ /dev/null @@ -1,92 +0,0 @@ -language: java -dist: trusty -jdk: - - openjdk8 - - oraclejdk8 - - oraclejdk9 -install: true -env: - - optimizely_default_parser=GSON_CONFIG_PARSER - - optimizely_default_parser=JACKSON_CONFIG_PARSER - - optimizely_default_parser=JSON_CONFIG_PARSER - - optimizely_default_parser=JSON_SIMPLE_CONFIG_PARSER -script: - - "./gradlew clean" - - "./gradlew exhaustiveTest" - - "./gradlew build" - -cache: - gradle: true - directories: - - "$HOME/.gradle/caches" - - "$HOME/.gradle/wrapper" -branches: - only: - - master - - /^\d+\.\d+\.(\d|[x])+(-SNAPSHOT|-alpha|-beta)?\d*$/ # trigger builds on tags which are semantically versioned to ship the SDK. -after_success: - - ./gradlew coveralls uploadArchives --console plain -after_failure: - - cat /home/travis/build/optimizely/java-sdk/core-api/build/reports/findbugs/main.html - - cat /home/travis/build/optimizely/java-sdk/core-api/build/reports/findbugs/test.html - -# Integration tests need to run first to reset the PR build status to pending -stages: - - 'Source Clear' - - 'Lint markdown files' - - 'Integration tests' - - 'Full stack production tests' - - 'Test' - - 'Publish' - - 'Snapshot' - -jobs: - include: - - stage: 'Lint markdown files' - os: linux - language: generic - install: gem install awesome_bot - script: - - find . -type f -name '*.md' -exec awesome_bot {} \; - notifications: - email: false - - - &integrationtest - stage: 'Integration tests' - merge_mode: replace - env: SDK=java SDK_BRANCH=$TRAVIS_PULL_REQUEST_BRANCH - cache: false - language: minimal - before_install: skip - install: skip - before_script: - - mkdir $HOME/travisci-tools && pushd $HOME/travisci-tools && git init && git pull https://$CI_USER_TOKEN@github.com/optimizely/travisci-tools.git && popd - script: - - $HOME/travisci-tools/trigger-script-with-status-update.sh - after_success: travis_terminate 0 - - - <<: *integrationtest - stage: 'Full stack production tests' - env: - SDK=java - SDK_BRANCH=$TRAVIS_PULL_REQUEST_BRANCH - FULLSTACK_TEST_REPO=ProdTesting - - - stage: 'Source Clear' - if: type = cron - install: skip - before_script: skip - script: skip - after_success: skip - - - stage: 'Publish' - if: tag IS present - script: - - ./gradlew ship - after_success: skip - - - stage: 'Snapshot' - if: env(SNAPSHOT) = true and type = api - script: - - TRAVIS_TAG=BB-SNAPSHOT ./gradlew ship - after_success: skip From 4c895360eb85954e0c8bee8ae307d23273b5e7fc Mon Sep 17 00:00:00 2001 From: mnoman09 Date: Wed, 30 Mar 2022 19:40:32 +0500 Subject: [PATCH 09/26] Added build.yml reusable workflow for building and publishing --- .github/workflows/build.yml | 41 +++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 .github/workflows/build.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 000000000..e52e02149 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,41 @@ +name: Reusable action of building snapshot and publish + +on: + workflow_call: + inputs: + action: + required: true + type: string + travis_tag: + required: false + type: string + secrets: + MAVEN_SIGNING_KEY_BASE64: + required: false + MAVEN_SIGNING_PASSPHRASE: + required: false + MAVEN_CENTRAL_USERNAME: + required: false + MAVEN_CENTRAL_PASSWORD: + required: false +jobs: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Set env + run: echo "TRAVIS_TAG=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV + - name: set up JDK 8 + uses: actions/setup-java@v2 + with: + java-version: '8' + distribution: 'temurin' + cache: gradle + - name: Grant execute permission for gradlew + run: chmod +x gradlew + - name: ${{ inputs.action }} + env: + MAVEN_SIGNING_KEY_BASE64: ${{ secrets.MAVEN_SIGNING_KEY_BASE64 }} + MAVEN_SIGNING_PASSPHRASE: ${{ secrets.MAVEN_SIGNING_PASSPHRASE }} + MAVEN_CENTRAL_USERNAME: ${{ secrets.MAVEN_CENTRAL_USERNAME }} + MAVEN_CENTRAL_PASSWORD: ${{ secrets.MAVEN_CENTRAL_PASSWORD }} + run: TRAVIS_TAG=${{ inputs.travis_tag }} ./gradlew ${{ inputs.action }} From 4b55c399584f8c91e4559dd0354b4d63bd975dfb Mon Sep 17 00:00:00 2001 From: mnoman09 Date: Wed, 30 Mar 2022 19:47:48 +0500 Subject: [PATCH 10/26] updated build.yml --- .github/workflows/build.yml | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index e52e02149..e7ba7782e 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -7,23 +7,22 @@ on: required: true type: string travis_tag: - required: false + required: true type: string secrets: MAVEN_SIGNING_KEY_BASE64: - required: false + required: true MAVEN_SIGNING_PASSPHRASE: - required: false + required: true MAVEN_CENTRAL_USERNAME: - required: false + required: true MAVEN_CENTRAL_PASSWORD: - required: false + required: true jobs: - runs-on: ubuntu-latest + run_build: + runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - - name: Set env - run: echo "TRAVIS_TAG=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV - name: set up JDK 8 uses: actions/setup-java@v2 with: From 1e411057f60b66992e77ef96bc7487a6585e7d61 Mon Sep 17 00:00:00 2001 From: mnoman09 Date: Wed, 30 Mar 2022 20:05:24 +0500 Subject: [PATCH 11/26] using reusable workflow --- .github/workflows/java.yml | 58 +++++++++++++------------------------- 1 file changed, 19 insertions(+), 39 deletions(-) diff --git a/.github/workflows/java.yml b/.github/workflows/java.yml index 76e9bd7a9..6b351f7c1 100644 --- a/.github/workflows/java.yml +++ b/.github/workflows/java.yml @@ -160,44 +160,24 @@ jobs: publish: if: startsWith(github.ref, 'refs/tags/v') - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - name: Set env - run: echo "TRAVIS_TAG=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV - - name: set up JDK 8 - uses: actions/setup-java@v2 - with: - java-version: '8' - distribution: 'temurin' - cache: gradle - - name: Grant execute permission for gradlew - run: chmod +x gradlew - - name: Ship - env: - MAVEN_SIGNING_KEY_BASE64: ${{ secrets.MAVEN_SIGNING_KEY_BASE64 }} - MAVEN_SIGNING_PASSPHRASE: ${{ secrets.MAVEN_SIGNING_PASSPHRASE }} - MAVEN_CENTRAL_USERNAME: ${{ secrets.MAVEN_CENTRAL_USERNAME }} - MAVEN_CENTRAL_PASSWORD: ${{ secrets.MAVEN_CENTRAL_PASSWORD }} - run: TRAVIS_TAG=${{ env.TRAVIS_TAG }} ./gradlew ship - + uses: optimizely/java-sdk/.github/workflows/build.yml@mnoman/gitAction + with: + action: ship + travis_tag: ${{ GITHUB_REF#refs/*/ }} + secrets: + MAVEN_SIGNING_KEY_BASE64: ${{ secrets.MAVEN_SIGNING_KEY_BASE64 }} + MAVEN_SIGNING_PASSPHRASE: ${{ secrets.MAVEN_SIGNING_PASSPHRASE }} + MAVEN_CENTRAL_USERNAME: ${{ secrets.MAVEN_CENTRAL_USERNAME }} + MAVEN_CENTRAL_PASSWORD: ${{ secrets.MAVEN_CENTRAL_PASSWORD }} + snapshot: if: ${{ github.event.inputs.SNAPSHOT == 'true' && github.event_name == 'workflow_dispatch' }} - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - name: set up JDK 8 - uses: actions/setup-java@v2 - with: - java-version: '8' - distribution: 'temurin' - cache: gradle - - name: Grant execute permission for gradlew - run: chmod +x gradlew - - name: Ship - env: - MAVEN_SIGNING_KEY_BASE64: ${{ secrets.MAVEN_SIGNING_KEY_BASE64 }} - MAVEN_SIGNING_PASSPHRASE: ${{ secrets.MAVEN_SIGNING_PASSPHRASE }} - MAVEN_CENTRAL_USERNAME: ${{ secrets.MAVEN_CENTRAL_USERNAME }} - MAVEN_CENTRAL_PASSWORD: ${{ secrets.MAVEN_CENTRAL_PASSWORD }} - run: TRAVIS_TAG=BB-SNAPSHOT ./gradlew ship + uses: optimizely/java-sdk/.github/workflows/build.yml@mnoman/gitAction + with: + action: ship + travis_tag: BB-SNAPSHOT + secrets: + MAVEN_SIGNING_KEY_BASE64: ${{ secrets.MAVEN_SIGNING_KEY_BASE64 }} + MAVEN_SIGNING_PASSPHRASE: ${{ secrets.MAVEN_SIGNING_PASSPHRASE }} + MAVEN_CENTRAL_USERNAME: ${{ secrets.MAVEN_CENTRAL_USERNAME }} + MAVEN_CENTRAL_PASSWORD: ${{ secrets.MAVEN_CENTRAL_PASSWORD }} From c01025ac1d461d2c67caa1cd1547abe868d1750c Mon Sep 17 00:00:00 2001 From: mnoman09 Date: Wed, 30 Mar 2022 20:26:02 +0500 Subject: [PATCH 12/26] test --- .github/workflows/java.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/java.yml b/.github/workflows/java.yml index 6b351f7c1..3fc20e779 100644 --- a/.github/workflows/java.yml +++ b/.github/workflows/java.yml @@ -163,7 +163,7 @@ jobs: uses: optimizely/java-sdk/.github/workflows/build.yml@mnoman/gitAction with: action: ship - travis_tag: ${{ GITHUB_REF#refs/*/ }} + travis_tag: ${GITHUB_REF#refs/*/} secrets: MAVEN_SIGNING_KEY_BASE64: ${{ secrets.MAVEN_SIGNING_KEY_BASE64 }} MAVEN_SIGNING_PASSPHRASE: ${{ secrets.MAVEN_SIGNING_PASSPHRASE }} From dc7f8682097819ff08945dde28728b258b6e98e4 Mon Sep 17 00:00:00 2001 From: mnoman09 Date: Mon, 4 Apr 2022 17:22:58 +0500 Subject: [PATCH 13/26] changed mac os to ubuntu latest --- .github/workflows/java.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/java.yml b/.github/workflows/java.yml index 3fc20e779..350797625 100644 --- a/.github/workflows/java.yml +++ b/.github/workflows/java.yml @@ -113,7 +113,7 @@ jobs: echo "$GITHUB_CONTEXT" home/runner/travisci-tools/trigger-script-with-status-update.sh test: - runs-on: macos-latest + runs-on: ubuntu-latest strategy: fail-fast: false matrix: From aad83ffeef1c3d20e8a7f5624fecaa3a6754804c Mon Sep 17 00:00:00 2001 From: mnoman09 Date: Mon, 4 Apr 2022 17:45:34 +0500 Subject: [PATCH 14/26] added reusable workflow for integration and production suite --- .github/workflows/integration_test.yml | 95 ++++++++++++++++++++++++++ 1 file changed, 95 insertions(+) create mode 100644 .github/workflows/integration_test.yml diff --git a/.github/workflows/integration_test.yml b/.github/workflows/integration_test.yml new file mode 100644 index 000000000..b49b1fdbe --- /dev/null +++ b/.github/workflows/integration_test.yml @@ -0,0 +1,95 @@ +name: Reusable action of running integration of production suite + +on: + workflow_call: + inputs: + FULLSTACK_TEST_REPO: + required: false + type: string + GITHUB_CONTEXT: + required: true + type: string + TRAVIS_EVENT_TYPE: + required: true + type: string + TRAVIS_REPO_SLUG: + required: true + type: string + TRAVIS_PULL_REQUEST_SLUG: + required: true + type: string + UPSTREAM_REPO: + required: true + type: string + TRAVIS_COMMIT: + required: true + type: string + TRAVIS_PULL_REQUEST_SHA: + required: true + type: string + TRAVIS_PULL_REQUEST: + required: true + type: string + UPSTREAM_SHA: + required: true + type: string + EVENT_MESSAGE: + required: true + type: string + HEAD_REF: + required: true + type: string + REF_NAME: + required: true + type: string + EVENT_NAME: + required: true + type: string + secrets: + CI_USER_TOKEN: + required: true + TRAVIS_COM_TOKEN: + required: true +jobs: + test: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + with: + # You should create a personal access token and store it in your repository + token: ${{ secrets.CI_USER_TOKEN }} + repository: 'optimizely/travisci-tools' + path: 'home/runner/travisci-tools' + ref: 'master' + - name: set SDK Branch if PR + if: ${{ inputs.EVENT_NAME == 'pull_request' }} + run: | + echo "SDK_BRANCH=${{ inputs.HEAD_REF }}" >> $GITHUB_ENV + echo "TRAVIS_BRANCH=${{ inputs.HEAD_REF }}" >> $GITHUB_ENV + - name: set SDK Branch if not pull request + if: ${{ inputs.EVENT_NAME != 'pull_request' }} + run: | + echo "SDK_BRANCH=${{ inputs.REF_NAME }}" >> $GITHUB_ENV + echo "TRAVIS_BRANCH=${{ inputs.REF_NAME }}" >> $GITHUB_ENV + - name: Trigger build + env: + SDK: java + FULLSTACK_TEST_REPO: ${{ inputs.FULLSTACK_TEST_REPO }} + BUILD_NUMBER: ${{ inputs.BUILD_NUMBER }} + TESTAPP_BRANCH: master + GITHUB_TOKEN: ${{ secrets.CI_USER_TOKEN }} + TRAVIS_EVENT_TYPE: ${{ inputs.TRAVIS_EVENT_TYPE }} + GITHUB_CONTEXT: ${{ inputs.GITHUB_CONTEXT }} + TRAVIS_REPO_SLUG: ${{ inputs.TRAVIS_REPO_SLUG }} + TRAVIS_PULL_REQUEST_SLUG: ${{ inputs.TRAVIS_PULL_REQUEST_SLUG }} + UPSTREAM_REPO: ${{ inputs.UPSTREAM_REPO }} + TRAVIS_COMMIT: ${{ inputs.TRAVIS_COMMIT }} + TRAVIS_PULL_REQUEST_SHA: ${{ inputs.TRAVIS_PULL_REQUEST_SHA }} + TRAVIS_PULL_REQUEST: ${{ inputs.TRAVIS_PULL_REQUEST }} + UPSTREAM_SHA: ${{ inputs.UPSTREAM_SHA }} + TRAVIS_COM_TOKEN: ${{ secrets.TRAVIS_COM_TOKEN }} + EVENT_MESSAGE: ${{ inputs.EVENT_MESSAGE }} + HOME: 'home/runner' + run: | + echo "$GITHUB_CONTEXT" + home/runner/travisci-tools/trigger-script-with-status-update.sh From 5b8b5188b4b2c3a4d2e93deaf08ea18e8d70672e Mon Sep 17 00:00:00 2001 From: mnoman09 Date: Mon, 4 Apr 2022 18:07:13 +0500 Subject: [PATCH 15/26] finalized integrationtest yml --- .github/workflows/integration_test.yml | 29 +++++++++----------------- 1 file changed, 10 insertions(+), 19 deletions(-) diff --git a/.github/workflows/integration_test.yml b/.github/workflows/integration_test.yml index b49b1fdbe..830650339 100644 --- a/.github/workflows/integration_test.yml +++ b/.github/workflows/integration_test.yml @@ -6,22 +6,19 @@ on: FULLSTACK_TEST_REPO: required: false type: string - GITHUB_CONTEXT: + BUILD_NUMBER: required: true type: string - TRAVIS_EVENT_TYPE: - required: true - type: string - TRAVIS_REPO_SLUG: + GITHUB_CONTEXT: required: true type: string - TRAVIS_PULL_REQUEST_SLUG: + TRAVIS_EVENT_TYPE: required: true type: string - UPSTREAM_REPO: + REPOSITORY: required: true type: string - TRAVIS_COMMIT: + SHA: required: true type: string TRAVIS_PULL_REQUEST_SHA: @@ -30,9 +27,6 @@ on: TRAVIS_PULL_REQUEST: required: true type: string - UPSTREAM_SHA: - required: true - type: string EVENT_MESSAGE: required: true type: string @@ -42,9 +36,6 @@ on: REF_NAME: required: true type: string - EVENT_NAME: - required: true - type: string secrets: CI_USER_TOKEN: required: true @@ -80,13 +71,13 @@ jobs: GITHUB_TOKEN: ${{ secrets.CI_USER_TOKEN }} TRAVIS_EVENT_TYPE: ${{ inputs.TRAVIS_EVENT_TYPE }} GITHUB_CONTEXT: ${{ inputs.GITHUB_CONTEXT }} - TRAVIS_REPO_SLUG: ${{ inputs.TRAVIS_REPO_SLUG }} - TRAVIS_PULL_REQUEST_SLUG: ${{ inputs.TRAVIS_PULL_REQUEST_SLUG }} - UPSTREAM_REPO: ${{ inputs.UPSTREAM_REPO }} - TRAVIS_COMMIT: ${{ inputs.TRAVIS_COMMIT }} + TRAVIS_REPO_SLUG: ${{ inputs.REPOSITORY }} + TRAVIS_PULL_REQUEST_SLUG: ${{ inputs.REPOSITORY }} + UPSTREAM_REPO: ${{ inputs.REPOSITORY }} + TRAVIS_COMMIT: ${{ inputs.SHA }} TRAVIS_PULL_REQUEST_SHA: ${{ inputs.TRAVIS_PULL_REQUEST_SHA }} TRAVIS_PULL_REQUEST: ${{ inputs.TRAVIS_PULL_REQUEST }} - UPSTREAM_SHA: ${{ inputs.UPSTREAM_SHA }} + UPSTREAM_SHA: ${{ inputs.SHA }} TRAVIS_COM_TOKEN: ${{ secrets.TRAVIS_COM_TOKEN }} EVENT_MESSAGE: ${{ inputs.EVENT_MESSAGE }} HOME: 'home/runner' From 4d56a251093a1877695a60558b90d1c618b71820 Mon Sep 17 00:00:00 2001 From: mnoman09 Date: Mon, 4 Apr 2022 18:10:05 +0500 Subject: [PATCH 16/26] using reusable workflow --- .github/workflows/java.yml | 113 +++++++++++-------------------------- 1 file changed, 32 insertions(+), 81 deletions(-) diff --git a/.github/workflows/java.yml b/.github/workflows/java.yml index 350797625..1e601fc68 100644 --- a/.github/workflows/java.yml +++ b/.github/workflows/java.yml @@ -29,91 +29,42 @@ jobs: run: find . -type f -name '*.md' -exec awesome_bot {} \; integration_tests: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - with: - # You should create a personal access token and store it in your repository - token: ${{ secrets.CI_USER_TOKEN }} - repository: 'optimizely/travisci-tools' - path: 'home/runner/travisci-tools' - ref: 'master' - - name: set SDK Branch if PR - if: ${{ github.event_name == 'pull_request' }} - run: | - echo "SDK_BRANCH=${{ github.head_ref }}" >> $GITHUB_ENV - echo "TRAVIS_BRANCH=${{ github.head_ref }}" >> $GITHUB_ENV - - name: set SDK Branch if not pull request - if: ${{ github.event_name != 'pull_request' }} - run: | - echo "SDK_BRANCH=${{ github.ref_name }}" >> $GITHUB_ENV - echo "TRAVIS_BRANCH=${{ github.ref_name }}" >> $GITHUB_ENV - - name: Trigger build - env: - SDK: java - BUILD_NUMBER: ${{ github.run_id }} - TESTAPP_BRANCH: master - GITHUB_TOKEN: ${{ secrets.CI_USER_TOKEN }} - TRAVIS_EVENT_TYPE: ${{ github.event_name }} - GITHUB_CONTEXT: ${{ toJson(github) }} - TRAVIS_REPO_SLUG: ${{ github.repository }} - TRAVIS_PULL_REQUEST_SLUG: ${{ github.repository }} - UPSTREAM_REPO: ${{ github.repository }} - TRAVIS_COMMIT: ${{ github.sha }} - TRAVIS_PULL_REQUEST_SHA: ${{ github.event.pull_request.head.sha }} - TRAVIS_PULL_REQUEST: ${{ github.event.pull_request.number }} - UPSTREAM_SHA: ${{ github.sha }} - TRAVIS_COM_TOKEN: ${{ secrets.TRAVIS_COM_TOKEN }} - EVENT_MESSAGE: ${{ github.event.message }} - HOME: 'home/runner' - run: | - echo "$GITHUB_CONTEXT" - home/runner/travisci-tools/trigger-script-with-status-update.sh + uses: optimizely/java-sdk/.github/workflows/integration_test.yml@mnoman/gitAction + with: + BUILD_NUMBER: ${{ github.run_id }} + GITHUB_CONTEXT: ${{ toJson(github) }} + TRAVIS_EVENT_TYPE: ${{ github.event_name }} + REPOSITORY: ${{ github.repository }} + SHA: ${{ github.sha }} + TRAVIS_PULL_REQUEST_SHA: ${{ github.event.pull_request.head.sha }} + TRAVIS_PULL_REQUEST: ${{ github.event.pull_request.number }} + EVENT_MESSAGE: ${{ github.event_name }} + HEAD_REF: ${{ github.head_ref }} + REF_NAME: ${{ github.ref_name }} + secrets: + CI_USER_TOKEN: ${{ secrets.CI_USER_TOKEN }} + TRAVIS_COM_TOKEN: ${{ secrets.TRAVIS_COM_TOKEN }} fullstack_production_suite: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - with: - # You should create a personal access token and store it in your repository - token: ${{ secrets.CI_USER_TOKEN }} - repository: 'optimizely/travisci-tools' - path: 'home/runner/travisci-tools' - ref: 'master' - - name: set SDK Branch if PR - if: ${{ github.event_name == 'pull_request' }} - run: | - echo "SDK_BRANCH=${{ github.head_ref }}" >> $GITHUB_ENV - echo "TRAVIS_BRANCH=${{ github.head_ref }}" >> $GITHUB_ENV - - name: set SDK Branch if not pull request - if: ${{ github.event_name != 'pull_request' }} - run: | - echo "SDK_BRANCH=${{ github.ref_name }}" >> $GITHUB_ENV - echo "TRAVIS_BRANCH=${{ github.ref_name }}" >> $GITHUB_ENV - - name: Trigger build - env: - SDK: java - FULLSTACK_TEST_REPO: ProdTesting - BUILD_NUMBER: ${{ github.run_id }} - TESTAPP_BRANCH: master - GITHUB_TOKEN: ${{ secrets.CI_USER_TOKEN }} - TRAVIS_EVENT_TYPE: ${{ github.event_name }} - GITHUB_CONTEXT: ${{ toJson(github) }} - TRAVIS_REPO_SLUG: ${{ github.repository }} - TRAVIS_PULL_REQUEST_SLUG: ${{ github.repository }} - UPSTREAM_REPO: ${{ github.repository }} - TRAVIS_COMMIT: ${{ github.sha }} - TRAVIS_PULL_REQUEST_SHA: ${{ github.event.pull_request.head.sha }} - TRAVIS_PULL_REQUEST: ${{ github.event.pull_request.number }} - UPSTREAM_SHA: ${{ github.sha }} - TRAVIS_COM_TOKEN: ${{ secrets.TRAVIS_COM_TOKEN }} - EVENT_MESSAGE: ${{ github.event.message }} - HOME: 'home/runner' - run: | - echo "$GITHUB_CONTEXT" + uses: optimizely/java-sdk/.github/workflows/integration_test.yml@mnoman/gitAction + with: + FULLSTACK_TEST_REPO: ProdTesting + BUILD_NUMBER: ${{ github.run_id }} + GITHUB_CONTEXT: ${{ toJson(github) }} + TRAVIS_EVENT_TYPE: ${{ github.event_name }} + REPOSITORY: ${{ github.repository }} + SHA: ${{ github.sha }} + TRAVIS_PULL_REQUEST_SHA: ${{ github.event.pull_request.head.sha }} + TRAVIS_PULL_REQUEST: ${{ github.event.pull_request.number }} + EVENT_MESSAGE: ${{ github.event_name }} + HEAD_REF: ${{ github.head_ref }} + REF_NAME: ${{ github.ref_name }} + secrets: + CI_USER_TOKEN: ${{ secrets.CI_USER_TOKEN }} + TRAVIS_COM_TOKEN: ${{ secrets.TRAVIS_COM_TOKEN }} home/runner/travisci-tools/trigger-script-with-status-update.sh test: - runs-on: ubuntu-latest + runs-on: macos-latest strategy: fail-fast: false matrix: From a55e43b7c72648950b1087c6709e0436499ae42f Mon Sep 17 00:00:00 2001 From: mnoman09 Date: Mon, 4 Apr 2022 18:32:00 +0500 Subject: [PATCH 17/26] test using event Name --- .github/workflows/integration_test.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/integration_test.yml b/.github/workflows/integration_test.yml index 830650339..6d245961b 100644 --- a/.github/workflows/integration_test.yml +++ b/.github/workflows/integration_test.yml @@ -12,9 +12,6 @@ on: GITHUB_CONTEXT: required: true type: string - TRAVIS_EVENT_TYPE: - required: true - type: string REPOSITORY: required: true type: string @@ -36,6 +33,9 @@ on: REF_NAME: required: true type: string + EVENT_NAME: + required: true + type: string secrets: CI_USER_TOKEN: required: true @@ -69,7 +69,7 @@ jobs: BUILD_NUMBER: ${{ inputs.BUILD_NUMBER }} TESTAPP_BRANCH: master GITHUB_TOKEN: ${{ secrets.CI_USER_TOKEN }} - TRAVIS_EVENT_TYPE: ${{ inputs.TRAVIS_EVENT_TYPE }} + TRAVIS_EVENT_TYPE: ${{ inputs.EVENT_NAME }} GITHUB_CONTEXT: ${{ inputs.GITHUB_CONTEXT }} TRAVIS_REPO_SLUG: ${{ inputs.REPOSITORY }} TRAVIS_PULL_REQUEST_SLUG: ${{ inputs.REPOSITORY }} From 864d388967fe9655d6407da2430afb8353ae0971 Mon Sep 17 00:00:00 2001 From: mnoman09 Date: Mon, 4 Apr 2022 18:32:11 +0500 Subject: [PATCH 18/26] passing event name --- .github/workflows/java.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/java.yml b/.github/workflows/java.yml index 1e601fc68..6294d919e 100644 --- a/.github/workflows/java.yml +++ b/.github/workflows/java.yml @@ -33,12 +33,12 @@ jobs: with: BUILD_NUMBER: ${{ github.run_id }} GITHUB_CONTEXT: ${{ toJson(github) }} - TRAVIS_EVENT_TYPE: ${{ github.event_name }} + EVENT_NAME: ${{ github.event_name }} REPOSITORY: ${{ github.repository }} SHA: ${{ github.sha }} TRAVIS_PULL_REQUEST_SHA: ${{ github.event.pull_request.head.sha }} TRAVIS_PULL_REQUEST: ${{ github.event.pull_request.number }} - EVENT_MESSAGE: ${{ github.event_name }} + EVENT_MESSAGE: ${{ github.event.message }} HEAD_REF: ${{ github.head_ref }} REF_NAME: ${{ github.ref_name }} secrets: @@ -51,12 +51,12 @@ jobs: FULLSTACK_TEST_REPO: ProdTesting BUILD_NUMBER: ${{ github.run_id }} GITHUB_CONTEXT: ${{ toJson(github) }} - TRAVIS_EVENT_TYPE: ${{ github.event_name }} + EVENT_NAME: ${{ github.event_name }} REPOSITORY: ${{ github.repository }} SHA: ${{ github.sha }} TRAVIS_PULL_REQUEST_SHA: ${{ github.event.pull_request.head.sha }} TRAVIS_PULL_REQUEST: ${{ github.event.pull_request.number }} - EVENT_MESSAGE: ${{ github.event_name }} + EVENT_MESSAGE: ${{ github.event.message }} HEAD_REF: ${{ github.head_ref }} REF_NAME: ${{ github.ref_name }} secrets: From f05dbdccf3dc813846b0ddb28d10c7212170cfa8 Mon Sep 17 00:00:00 2001 From: mnoman09 Date: Mon, 4 Apr 2022 18:44:55 +0500 Subject: [PATCH 19/26] fixed prod suite error --- .github/workflows/java.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/java.yml b/.github/workflows/java.yml index 6294d919e..6ff583798 100644 --- a/.github/workflows/java.yml +++ b/.github/workflows/java.yml @@ -62,7 +62,7 @@ jobs: secrets: CI_USER_TOKEN: ${{ secrets.CI_USER_TOKEN }} TRAVIS_COM_TOKEN: ${{ secrets.TRAVIS_COM_TOKEN }} - home/runner/travisci-tools/trigger-script-with-status-update.sh + test: runs-on: macos-latest strategy: From 7345965f005913b8b56ad374b06bf0b6f7da0a75 Mon Sep 17 00:00:00 2001 From: mnoman09 Date: Mon, 11 Apr 2022 18:32:46 +0500 Subject: [PATCH 20/26] fixed publishing tag issue --- .github/workflows/java.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/java.yml b/.github/workflows/java.yml index 6ff583798..d624fcfd9 100644 --- a/.github/workflows/java.yml +++ b/.github/workflows/java.yml @@ -4,6 +4,8 @@ name: Java CI with Gradle on: push: branches: [ master ] + tags: + - '*' pull_request: branches: [ master ] workflow_dispatch: @@ -64,7 +66,7 @@ jobs: TRAVIS_COM_TOKEN: ${{ secrets.TRAVIS_COM_TOKEN }} test: - runs-on: macos-latest + runs-on: ubuntu-latest strategy: fail-fast: false matrix: @@ -110,7 +112,7 @@ jobs: ./gradlew coveralls uploadArchives --console plain publish: - if: startsWith(github.ref, 'refs/tags/v') + if: startsWith(github.ref, 'refs/tags/') uses: optimizely/java-sdk/.github/workflows/build.yml@mnoman/gitAction with: action: ship From 2c9f290b8ba364483db1420bf99b8359bf8ba9a2 Mon Sep 17 00:00:00 2001 From: mnoman09 Date: Mon, 11 Apr 2022 18:42:01 +0500 Subject: [PATCH 21/26] test --- .github/workflows/integration_test.yml | 42 ++++++++------------------ 1 file changed, 12 insertions(+), 30 deletions(-) diff --git a/.github/workflows/integration_test.yml b/.github/workflows/integration_test.yml index 6d245961b..7a1c3203a 100644 --- a/.github/workflows/integration_test.yml +++ b/.github/workflows/integration_test.yml @@ -6,41 +6,23 @@ on: FULLSTACK_TEST_REPO: required: false type: string - BUILD_NUMBER: - required: true - type: string - GITHUB_CONTEXT: - required: true - type: string - REPOSITORY: - required: true - type: string - SHA: - required: true - type: string - TRAVIS_PULL_REQUEST_SHA: - required: true - type: string - TRAVIS_PULL_REQUEST: - required: true - type: string - EVENT_MESSAGE: - required: true - type: string - HEAD_REF: - required: true - type: string - REF_NAME: - required: true - type: string - EVENT_NAME: - required: true - type: string secrets: CI_USER_TOKEN: required: true TRAVIS_COM_TOKEN: required: true +env: + # Whether to run tests against all SDKS + BUILD_NUMBER: ${{ github.run_id }} + GITHUB_CONTEXT: ${{ toJson(github) }} + REPOSITORY: ${{ github.repository }} + EVENT_NAME: ${{ github.event_name }} + SHA: ${{ github.repository }} + TRAVIS_PULL_REQUEST_SHA: ${{ github.event.pull_request.head.sha }} + TRAVIS_PULL_REQUEST: ${{ github.event.pull_request.number }} + EVENT_MESSAGE: ${{ github.event.message }} + HEAD_REF: ${{ github.head_ref }} + REF_NAME: ${{ github.ref_name }} jobs: test: runs-on: ubuntu-latest From 8889af9eb7a86b0f0424d4ad0ff745253f276625 Mon Sep 17 00:00:00 2001 From: mnoman09 Date: Mon, 11 Apr 2022 18:43:22 +0500 Subject: [PATCH 22/26] test --- .github/workflows/java.yml | 21 --------------------- 1 file changed, 21 deletions(-) diff --git a/.github/workflows/java.yml b/.github/workflows/java.yml index d624fcfd9..adc2f6e39 100644 --- a/.github/workflows/java.yml +++ b/.github/workflows/java.yml @@ -32,17 +32,6 @@ jobs: integration_tests: uses: optimizely/java-sdk/.github/workflows/integration_test.yml@mnoman/gitAction - with: - BUILD_NUMBER: ${{ github.run_id }} - GITHUB_CONTEXT: ${{ toJson(github) }} - EVENT_NAME: ${{ github.event_name }} - REPOSITORY: ${{ github.repository }} - SHA: ${{ github.sha }} - TRAVIS_PULL_REQUEST_SHA: ${{ github.event.pull_request.head.sha }} - TRAVIS_PULL_REQUEST: ${{ github.event.pull_request.number }} - EVENT_MESSAGE: ${{ github.event.message }} - HEAD_REF: ${{ github.head_ref }} - REF_NAME: ${{ github.ref_name }} secrets: CI_USER_TOKEN: ${{ secrets.CI_USER_TOKEN }} TRAVIS_COM_TOKEN: ${{ secrets.TRAVIS_COM_TOKEN }} @@ -51,16 +40,6 @@ jobs: uses: optimizely/java-sdk/.github/workflows/integration_test.yml@mnoman/gitAction with: FULLSTACK_TEST_REPO: ProdTesting - BUILD_NUMBER: ${{ github.run_id }} - GITHUB_CONTEXT: ${{ toJson(github) }} - EVENT_NAME: ${{ github.event_name }} - REPOSITORY: ${{ github.repository }} - SHA: ${{ github.sha }} - TRAVIS_PULL_REQUEST_SHA: ${{ github.event.pull_request.head.sha }} - TRAVIS_PULL_REQUEST: ${{ github.event.pull_request.number }} - EVENT_MESSAGE: ${{ github.event.message }} - HEAD_REF: ${{ github.head_ref }} - REF_NAME: ${{ github.ref_name }} secrets: CI_USER_TOKEN: ${{ secrets.CI_USER_TOKEN }} TRAVIS_COM_TOKEN: ${{ secrets.TRAVIS_COM_TOKEN }} From d63a1ded0b06da8d485c44297a735d36722cab8b Mon Sep 17 00:00:00 2001 From: mnoman09 Date: Mon, 11 Apr 2022 19:20:04 +0500 Subject: [PATCH 23/26] test --- .github/workflows/integration_test.yml | 42 +++++++++----------------- 1 file changed, 15 insertions(+), 27 deletions(-) diff --git a/.github/workflows/integration_test.yml b/.github/workflows/integration_test.yml index 7a1c3203a..18409397b 100644 --- a/.github/workflows/integration_test.yml +++ b/.github/workflows/integration_test.yml @@ -11,18 +11,6 @@ on: required: true TRAVIS_COM_TOKEN: required: true -env: - # Whether to run tests against all SDKS - BUILD_NUMBER: ${{ github.run_id }} - GITHUB_CONTEXT: ${{ toJson(github) }} - REPOSITORY: ${{ github.repository }} - EVENT_NAME: ${{ github.event_name }} - SHA: ${{ github.repository }} - TRAVIS_PULL_REQUEST_SHA: ${{ github.event.pull_request.head.sha }} - TRAVIS_PULL_REQUEST: ${{ github.event.pull_request.number }} - EVENT_MESSAGE: ${{ github.event.message }} - HEAD_REF: ${{ github.head_ref }} - REF_NAME: ${{ github.ref_name }} jobs: test: runs-on: ubuntu-latest @@ -37,31 +25,31 @@ jobs: - name: set SDK Branch if PR if: ${{ inputs.EVENT_NAME == 'pull_request' }} run: | - echo "SDK_BRANCH=${{ inputs.HEAD_REF }}" >> $GITHUB_ENV - echo "TRAVIS_BRANCH=${{ inputs.HEAD_REF }}" >> $GITHUB_ENV + echo "SDK_BRANCH=${{ github.head_ref }}" >> $GITHUB_ENV + echo "TRAVIS_BRANCH=${{ github.head_ref }}" >> $GITHUB_ENV - name: set SDK Branch if not pull request if: ${{ inputs.EVENT_NAME != 'pull_request' }} run: | - echo "SDK_BRANCH=${{ inputs.REF_NAME }}" >> $GITHUB_ENV - echo "TRAVIS_BRANCH=${{ inputs.REF_NAME }}" >> $GITHUB_ENV + echo "SDK_BRANCH=${{ github.ref_name }}" >> $GITHUB_ENV + echo "TRAVIS_BRANCH=${{ github.ref_name }}" >> $GITHUB_ENV - name: Trigger build env: SDK: java FULLSTACK_TEST_REPO: ${{ inputs.FULLSTACK_TEST_REPO }} - BUILD_NUMBER: ${{ inputs.BUILD_NUMBER }} + BUILD_NUMBER: ${{ github.run_id }} TESTAPP_BRANCH: master GITHUB_TOKEN: ${{ secrets.CI_USER_TOKEN }} - TRAVIS_EVENT_TYPE: ${{ inputs.EVENT_NAME }} - GITHUB_CONTEXT: ${{ inputs.GITHUB_CONTEXT }} - TRAVIS_REPO_SLUG: ${{ inputs.REPOSITORY }} - TRAVIS_PULL_REQUEST_SLUG: ${{ inputs.REPOSITORY }} - UPSTREAM_REPO: ${{ inputs.REPOSITORY }} - TRAVIS_COMMIT: ${{ inputs.SHA }} - TRAVIS_PULL_REQUEST_SHA: ${{ inputs.TRAVIS_PULL_REQUEST_SHA }} - TRAVIS_PULL_REQUEST: ${{ inputs.TRAVIS_PULL_REQUEST }} - UPSTREAM_SHA: ${{ inputs.SHA }} + TRAVIS_EVENT_TYPE: ${{ github.event_name }} + GITHUB_CONTEXT: ${{ toJson(github) }} + TRAVIS_REPO_SLUG: ${{ github.repository }} + TRAVIS_PULL_REQUEST_SLUG: ${{ github.repository }} + UPSTREAM_REPO: ${{ github.repository }} + TRAVIS_COMMIT: ${{ github.sha }} + TRAVIS_PULL_REQUEST_SHA: ${{ github.event.pull_request.head.sha }} + TRAVIS_PULL_REQUEST: ${{ github.event.pull_request.number }} + UPSTREAM_SHA: ${{ github.sha }} TRAVIS_COM_TOKEN: ${{ secrets.TRAVIS_COM_TOKEN }} - EVENT_MESSAGE: ${{ inputs.EVENT_MESSAGE }} + EVENT_MESSAGE: ${{ github.event.message }} HOME: 'home/runner' run: | echo "$GITHUB_CONTEXT" From 087572fd93dd40c332be349d17eea6bb4d06c69d Mon Sep 17 00:00:00 2001 From: mnoman09 Date: Mon, 11 Apr 2022 19:30:41 +0500 Subject: [PATCH 24/26] fixed --- .github/workflows/integration_test.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/integration_test.yml b/.github/workflows/integration_test.yml index 18409397b..e4d1c7e7d 100644 --- a/.github/workflows/integration_test.yml +++ b/.github/workflows/integration_test.yml @@ -23,12 +23,12 @@ jobs: path: 'home/runner/travisci-tools' ref: 'master' - name: set SDK Branch if PR - if: ${{ inputs.EVENT_NAME == 'pull_request' }} + if: ${{ github.event_name == 'pull_request' }} run: | echo "SDK_BRANCH=${{ github.head_ref }}" >> $GITHUB_ENV echo "TRAVIS_BRANCH=${{ github.head_ref }}" >> $GITHUB_ENV - name: set SDK Branch if not pull request - if: ${{ inputs.EVENT_NAME != 'pull_request' }} + if: ${{ github.event_name != 'pull_request' }} run: | echo "SDK_BRANCH=${{ github.ref_name }}" >> $GITHUB_ENV echo "TRAVIS_BRANCH=${{ github.ref_name }}" >> $GITHUB_ENV From 9e54d583da0553f6dc61dc2033777a2b7a430f26 Mon Sep 17 00:00:00 2001 From: mnoman09 Date: Mon, 11 Apr 2022 19:45:56 +0500 Subject: [PATCH 25/26] added check to skip unit test step before publishing --- .github/workflows/java.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/java.yml b/.github/workflows/java.yml index adc2f6e39..8b2bb296d 100644 --- a/.github/workflows/java.yml +++ b/.github/workflows/java.yml @@ -45,6 +45,7 @@ jobs: TRAVIS_COM_TOKEN: ${{ secrets.TRAVIS_COM_TOKEN }} test: + if: startsWith(github.ref, 'refs/tags/') != true runs-on: ubuntu-latest strategy: fail-fast: false From f8863ec59bce6e9b81907b8c6553a6f0f3caf075 Mon Sep 17 00:00:00 2001 From: Muhammad Noman Date: Thu, 14 Apr 2022 20:53:36 +0500 Subject: [PATCH 26/26] Changed branch to master --- .github/workflows/java.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/java.yml b/.github/workflows/java.yml index 8b2bb296d..a7c2eafe9 100644 --- a/.github/workflows/java.yml +++ b/.github/workflows/java.yml @@ -31,13 +31,13 @@ jobs: run: find . -type f -name '*.md' -exec awesome_bot {} \; integration_tests: - uses: optimizely/java-sdk/.github/workflows/integration_test.yml@mnoman/gitAction + uses: optimizely/java-sdk/.github/workflows/integration_test.yml@master secrets: CI_USER_TOKEN: ${{ secrets.CI_USER_TOKEN }} TRAVIS_COM_TOKEN: ${{ secrets.TRAVIS_COM_TOKEN }} fullstack_production_suite: - uses: optimizely/java-sdk/.github/workflows/integration_test.yml@mnoman/gitAction + uses: optimizely/java-sdk/.github/workflows/integration_test.yml@master with: FULLSTACK_TEST_REPO: ProdTesting secrets: @@ -93,7 +93,7 @@ jobs: publish: if: startsWith(github.ref, 'refs/tags/') - uses: optimizely/java-sdk/.github/workflows/build.yml@mnoman/gitAction + uses: optimizely/java-sdk/.github/workflows/build.yml@master with: action: ship travis_tag: ${GITHUB_REF#refs/*/} @@ -105,7 +105,7 @@ jobs: snapshot: if: ${{ github.event.inputs.SNAPSHOT == 'true' && github.event_name == 'workflow_dispatch' }} - uses: optimizely/java-sdk/.github/workflows/build.yml@mnoman/gitAction + uses: optimizely/java-sdk/.github/workflows/build.yml@master with: action: ship travis_tag: BB-SNAPSHOT