Skip to content

Commit

Permalink
feat: test gpg key
Browse files Browse the repository at this point in the history
  • Loading branch information
mchuangatmp committed Mar 23, 2022
1 parent 0f4446d commit 3239c02
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 178 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: "Build and Test"
on: [push, pull_request]
on: [pull_request]
jobs:
instrumented-tests:
name: "Instrumented Tests"
Expand Down
204 changes: 28 additions & 176 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,129 +6,43 @@ on:
dryRun:
description: "Do a dry run to preview instead of a real release [true/false]"
required: true
default: "true"
default: "false"

jobs:
# SDK release is done from public main branch.
confirm-public-repo-main-branch:
name: "Confirm release is run from public/main branch"
uses: mParticle/mparticle-workflows/.github/workflows/sdk-release-repo-branch-check.yml@stable

create-release-branch:
name: "Create Release Branch"
runs-on: ubuntu-18.04
needs: confirm-public-repo-main-branch
env:
GITHUB_TOKEN: ${{ secrets.MC_SEMANTIC_RELEASE_BOT }}
GIT_AUTHOR_NAME: mchuangatmp
GIT_AUTHOR_EMAIL: [email protected]
GIT_COMMITTER_NAME: mchuangatmp
GIT_COMMITTER_EMAIL: [email protected]
steps:
- name: "Checkout development branch"
uses: actions/checkout@v2
with:
repository: mparticle/mparticle-android-sdk
ref: development
repository: mchuangatmp/mparticle-android-sdk
ref: main
- name: "Create and push release branch"
run: |
git checkout -b release/${{ github.run_number }}
git push origin release/${{ github.run_number }}
instrumented-tests:
name: "Instrumented Tests"
timeout-minutes: 30
needs: create-release-branch
runs-on: macos-latest
steps:
- name: "Checkout release branch"
uses: actions/checkout@v2
with:
repository: mparticle/mparticle-android-sdk
ref: release/${{ github.run_number }}
- name: "Install JDK 11"
uses: actions/setup-java@v2
with:
distribution: "zulu"
java-version: "11"
- name: "Run Instrumented Tests"
uses: reactivecircus/[email protected]
with:
api-level: 29
script: ./gradlew :android-core:cAT :android-kit-base:cAT --stacktrace
- name: "Archive Instrumented Test Results"
uses: actions/upload-artifact@v2
if: ${{ always() }}
with:
name: instrumented-test-results
path: android-core/build/reports/androidTests/connected/**

unit-tests:
name: "Unit Tests"
timeout-minutes: 15
needs: create-release-branch
runs-on: ubuntu-18.04
steps:
- name: "Checkout release branch"
uses: actions/checkout@v2
with:
repository: mparticle/mparticle-android-sdk
ref: release/${{ github.run_number }}
- name: "Install JDK 11"
uses: actions/setup-java@v2
with:
distribution: "zulu"
java-version: "11"
- name: "Run Unit Tests"
run: ./gradlew test
- name: "Print Android Unit Tests Report"
uses: asadmansr/[email protected]
if: ${{ always() }}
- name: "Archive Unit Test Results"
uses: actions/upload-artifact@v2
if: ${{ always() }}
with:
name: "unit-tests-results"
path: ./**/build/reports/**

update-kits:
name: "Update Kits"
needs: [instrumented-tests, unit-tests]
runs-on: macos-latest
env:
GIT_AUTHOR_NAME: mparticle-bot
GIT_AUTHOR_EMAIL: [email protected]
GIT_COMMITTER_NAME: mparticle-bot
GIT_COMMITTER_EMAIL: [email protected]
steps:
- name: "Checkout release branch"
uses: actions/checkout@v2
with:
repository: mparticle/mparticle-android-sdk
ref: release/${{ github.run_number }}
submodules: recursive
- name: "Install JDK 11"
uses: actions/setup-java@v2
with:
distribution: "zulu"
java-version: "11"
- name: "Build Android Core"
run: ./gradlew -PisRelease=true clean publishReleaseLocal
- name: "Update Kit references"
run: git submodule foreach "git fetch; git reset --hard origin/main";
- name: "Test Kits"
run: ./gradlew -PisRelease=true clean testRelease publishReleaseLocal -c settings-kits.gradle
- name: "Commit Kit Updates"
run: |
echo "test file" > testfile
git add .
git diff-index --quiet HEAD || git commit -m 'ci: Update Submodules'
- name: "Push kit updates to release branch"
run: git push origin release/${{ github.run_number }}
git commit -m "fix: test commit"
git push origin release/${{ github.run_number }}
semantic-release:
name: "Semantic Release"
needs: update-kits
needs: create-release-branch
runs-on: macos-latest
env:
GITHUB_TOKEN: ${{ secrets.MP_SEMANTIC_RELEASE_BOT }}
GIT_AUTHOR_NAME: mparticle-bot
GIT_AUTHOR_EMAIL: developers@mparticle.com
GIT_COMMITTER_NAME: mparticle-bot
GIT_COMMITTER_EMAIL: developers@mparticle.com
GITHUB_TOKEN: ${{ secrets.MC_SEMANTIC_RELEASE_BOT }}
GIT_AUTHOR_NAME: mchuangatmp
GIT_AUTHOR_EMAIL: mchuang@mparticle.com
GIT_COMMITTER_NAME: mchuangatmp
GIT_COMMITTER_EMAIL: mchuang@mparticle.com
steps:
- name: "Checkout public main branch"
uses: actions/checkout@v2
Expand All @@ -141,11 +55,11 @@ jobs:
- name: "Semantic Release --dry-run"
if: ${{ github.event.inputs.dryRun == 'true' }}
env:
GITHUB_TOKEN: ${{ secrets.MP_SEMANTIC_RELEASE_BOT }}
GIT_AUTHOR_NAME: mparticle-bot
GIT_AUTHOR_EMAIL: developers@mparticle.com
GIT_COMMITTER_NAME: mparticle-bot
GIT_COMMITTER_EMAIL: developers@mparticle.com
GITHUB_TOKEN: ${{ secrets.MC_SEMANTIC_RELEASE_BOT }}
GIT_AUTHOR_NAME: mchuangatmp
GIT_AUTHOR_EMAIL: mchuang@mparticle.com
GIT_COMMITTER_NAME: mchuangatmp
GIT_COMMITTER_EMAIL: mchuang@mparticle.com
run: |
npx \
-p lodash \
Expand All @@ -157,11 +71,11 @@ jobs:
- name: "Semantic Release"
if: ${{ github.event.inputs.dryRun == 'false' }}
env:
GITHUB_TOKEN: ${{ secrets.MP_SEMANTIC_RELEASE_BOT }}
GIT_AUTHOR_NAME: mparticle-bot
GIT_AUTHOR_EMAIL: developers@mparticle.com
GIT_COMMITTER_NAME: mparticle-bot
GIT_COMMITTER_EMAIL: developers@mparticle.com
GITHUB_TOKEN: ${{ secrets.MC_SEMANTIC_RELEASE_BOT }}
GIT_AUTHOR_NAME: mchuangatmp
GIT_AUTHOR_EMAIL: mchuang@mparticle.com
GIT_COMMITTER_NAME: mchuangatmp
GIT_COMMITTER_EMAIL: mchuang@mparticle.com
run: |
npx \
-p lodash \
Expand All @@ -175,65 +89,3 @@ jobs:
run: |
git push origin HEAD:release/${{ github.run_number }}
sonatype-release:
name: "Sonatype Release"
needs: semantic-release
runs-on: ubuntu-18.04
env:
sonatypeUsername: ${{ secrets.SONATYPE_NEXUS_USERNAME }}
sonatypePassword: ${{ secrets.SONATYPE_NEXUS_PASSWORD }}
mavenSigningKeyId: ${{ secrets.MAVEN_CENTRAL_SIGNING_KEY }}
mavenSigningKeyPassword: ${{ secrets.MAVEN_CENTRAL_SIGNING_KEY_PASSWORD }}
steps:
- name: "Checkout release branch"
uses: actions/checkout@v2
with:
repository: mparticle/mparticle-android-sdk
ref: release/${{ github.run_number }}
submodules: recursive
- name: "Install JDK 11"
uses: actions/setup-java@v2
with:
distribution: "zulu"
java-version: "11"
- name: "Publish Core, KitManager, KitPlugin"
if: ${{ github.event.inputs.dryRun == 'false'}}
run: |
./gradlew -PisRelease=true publishReleasePublicationToMavenRepository --stacktrace
- name: "Publish Kits"
if: ${{ github.event.inputs.dryRun == 'false'}}
# build kit-plugin locally so kits will compile, then release to sonatype
run: |
./gradlew -PisRelease=true publishReleasePublicationToMavenLocal
./gradlew -PisRelease=true publishReleasePublicationToMavenRepository -c settings-kits.gradle --stacktrace
sync-repository:
name: "Sync Repository"
needs: sonatype-release
runs-on: ubuntu-18.04
steps:
- name: "Checkout main branch"
uses: actions/checkout@v2
with:
fetch-depth: 0
repository: ${{ github.repository }}
token: ${{ secrets.MP_SEMANTIC_RELEASE_BOT }}
ref: main
- name: "Merge release branch into main branch"
if: ${{ github.event.inputs.dryRun == 'false' }}
run: |
git pull origin release/${{ github.run_number }}
- name: "Push release commits to main branch"
if: ${{ github.event.inputs.dryRun == 'false'}}
run: |
git push origin HEAD:main
git push origin HEAD:development
- name: "Push release commits to internal main"
if: ${{ github.event.inputs.dryRun == 'false' }}
run: |
git remote add internal https://${{ secrets.MP_SEMANTIC_RELEASE_BOT }}@github.com/mParticle/mparticle-android-sdk-internal.git
git push internal HEAD:main
- name: "Delete release branch"
if: ${{ github.event.inputs.dryRun == 'false' }}
run: |
git push --delete origin release/${{ github.run_number }}
2 changes: 1 addition & 1 deletion .github/workflows/sonarcloud.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: "SonarCloud"
on: [ push, pull_request_target ]
on: [ pull_request_target ]
jobs:
sonarcloud:
runs-on: ubuntu-latest
Expand Down

0 comments on commit 3239c02

Please sign in to comment.