Store/.github/workflows/.ci_test_and_publish.yml
Sam Edwards c9550cab67
Use Java 11 for Publish job as well. (#418)
Co-authored-by: Sam Edwards <samedwards@dropbox.com>
2022-03-17 15:31:45 -04:00

73 lines
2.2 KiB
YAML

# This workflow will build the project with Gradle, run integration tests, and release.
# Because secrets are not available on external forks, this job is expected to fail
# on external pull requests.
name: Build project & run tests
on:
push:
branches: [ main, Kmp ]
pull_request:
branches: [ main ]
jobs:
publish:
runs-on: ubuntu-latest
if: github.repository == 'dropbox/Store' && github.ref == 'refs/heads/main'
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set up our JDK environment
uses: actions/setup-java@v2
with:
distribution: zulu
java-version: 11
- name: Upload Artifacts
run: ./gradlew publishAllPublicationsToMavenCentralRepository --no-daemon --no-parallel
env:
ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.SONATYPE_USERNAME }}
ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.SONATYPE_PASSWORD }}
ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.SIGNING_KEY }}
ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.SIGNING_PASSWORD }}
- name: Retrieve version
run: |
echo "VERSION_NAME=$(cat gradle.properties | grep -w "VERSION_NAME" | cut -d'=' -f2)" >> $GITHUB_ENV
- name: Publish release
run: ./gradlew closeAndReleaseRepository --no-daemon --no-parallel
if: "!endsWith(env.VERSION_NAME, '-SNAPSHOT')"
env:
ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.SONATYPE_USERNAME }}
ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.SONATYPE_PASSWORD }}
test:
runs-on: ubuntu-latest
timeout-minutes: 30
strategy:
fail-fast: false
matrix:
api-level:
- 29
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set up our JDK environment
uses: actions/setup-java@v2
with:
distribution: zulu
java-version: 11
- name: Run tests
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: 29
script: ./gradlew check --rerun-tasks --stacktrace
env:
API_LEVEL: ${{ matrix.api-level }}
- name: Upload code coverage
run: bash <(curl -s https://codecov.io/bash)