-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Reuse gradle dependencies across all CI steps
- Loading branch information
Showing
1 changed file
with
62 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,38 +6,78 @@ on: | |
pull_request: | ||
|
||
jobs: | ||
unit-tests: | ||
name: Unit tests | ||
runs-on: macos-latest | ||
prepare: | ||
name: Prepare workspace and cache dependencies | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
lfs: true | ||
- uses: gradle/wrapper-validation-action@v1 | ||
- uses: actions/setup-java@v4 | ||
with: | ||
distribution: 'zulu' | ||
java-version: 17 | ||
- uses: gradle/actions/setup-gradle@v4 | ||
|
||
- name: Cache Gradle dependencies | ||
uses: actions/cache@v3 | ||
with: | ||
path: | | ||
~/.gradle/caches | ||
~/.gradle/wrapper | ||
key: gradle-${{ runner.os }}-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} | ||
restore-keys: | | ||
gradle-${{ runner.os }} | ||
- name: Upload prepared workspace | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: workspace | ||
path: . | ||
|
||
- uses: gradle/actions/setup-gradle@v4 | ||
- uses: oNaiPs/secrets-to-env-action@v1 | ||
with: | ||
secrets: ${{ toJSON(secrets) }} | ||
|
||
unit-tests: | ||
name: Unit tests | ||
runs-on: macos-latest | ||
needs: prepare | ||
|
||
steps: | ||
- name: Download prepared workspace | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: workspace | ||
- name: Cache Gradle dependencies | ||
uses: actions/cache@v3 | ||
with: | ||
path: | | ||
~/.gradle/caches | ||
~/.gradle/wrapper | ||
key: gradle-${{ runner.os }}-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} | ||
- name: Run unit tests and friends | ||
run: ./gradlew check | ||
|
||
screenshot-tests: | ||
name: Android screenshot tests | ||
runs-on: ubuntu-latest | ||
needs: prepare | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Download prepared workspace | ||
uses: actions/download-artifact@v4 | ||
with: | ||
lfs: true | ||
- uses: gradle/wrapper-validation-action@v1 | ||
- uses: actions/setup-java@v4 | ||
name: workspace | ||
- name: Cache Gradle dependencies | ||
uses: actions/cache@v3 | ||
with: | ||
distribution: 'zulu' | ||
java-version: 17 | ||
- uses: gradle/actions/setup-gradle@v4 | ||
path: | | ||
~/.gradle/caches | ||
~/.gradle/wrapper | ||
key: gradle-${{ runner.os }}-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} | ||
|
||
- name: Run paparazzi screenshot tests | ||
run: ./gradlew verifyPaparazziDebug | ||
|
@@ -52,13 +92,8 @@ jobs: | |
**/out/failures/ | ||
paparazzi/paparazzi-gradle-plugin/src/test/projects/**/build/reports/paparazzi/images/ | ||
- uses: oNaiPs/secrets-to-env-action@v1 | ||
with: | ||
secrets: ${{ toJSON(secrets) }} | ||
|
||
- name: Run instrumented screenshot tests | ||
env: | ||
# https://docs.emulator.wtf/github/tokenless | ||
EW_API_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: ./gradlew testDebugWithEmulatorWtf | ||
|
||
|
@@ -79,18 +114,21 @@ jobs: | |
timeout-minutes: 10 | ||
if: github.repository == 'saket/telephoto' && github.ref == 'refs/heads/trunk' | ||
needs: [unit-tests, screenshot-tests] | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: gradle/wrapper-validation-action@v1 | ||
- uses: actions/setup-java@v3 | ||
- name: Download prepared workspace | ||
uses: actions/download-artifact@v4 | ||
with: | ||
distribution: 'zulu' | ||
java-version: 17 | ||
- uses: gradle/[email protected] | ||
|
||
name: workspace | ||
- name: Cache Gradle dependencies | ||
uses: actions/cache@v3 | ||
with: | ||
path: | | ||
~/.gradle/caches | ||
~/.gradle/wrapper | ||
key: gradle-${{ runner.os }}-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} | ||
- name: Ensure snapshot version | ||
run: ./gradlew throwIfVersionIsNotSnapshot | ||
|
||
- name: Publish snapshot | ||
run: ./gradlew clean publish --no-daemon --no-parallel --no-configuration-cache --stacktrace | ||
env: | ||
|