Skip to content

Commit

Permalink
Merge pull request #465 from Goooler/tweak-gha-configs
Browse files Browse the repository at this point in the history
Speed up CI
  • Loading branch information
mlykotom authored Jun 26, 2024
2 parents 9f89fb2 + 8e4bde2 commit bec4c64
Show file tree
Hide file tree
Showing 22 changed files with 98 additions and 233 deletions.
15 changes: 4 additions & 11 deletions .github/workflows/AccessibilityCodelab.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,11 @@ on:
- end
paths:
- 'AccessibilityCodelab/**'
- '.github/workflows/AccessibilityCodelab.yaml'
pull_request:
paths:
- 'AccessibilityCodelab/**'
- '.github/workflows/AccessibilityCodelab.yaml'

env:
SAMPLE_PATH: AccessibilityCodelab
Expand All @@ -24,24 +26,15 @@ jobs:
uses: actions/checkout@v4

- name: Copy CI gradle.properties
run: mkdir -p ~/.gradle ; cp .github/ci-gradle.properties ~/.gradle/gradle.properties
run: mkdir -p ~/.gradle ; cp .github/ci-gradle.properties ~/.gradle/gradle.properties

- name: Set up JDK 17
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: 17

- name: Generate cache key
run: ./scripts/checksum.sh $SAMPLE_PATH checksum.txt

- uses: actions/cache@v4
with:
path: |
~/.gradle/caches/modules-*
~/.gradle/caches/jars-*
~/.gradle/caches/build-cache-*
key: gradle-${{ hashFiles('checksum.txt') }}
- uses: gradle/actions/setup-gradle@v3

- name: Build project
working-directory: ${{ env.SAMPLE_PATH }}
Expand Down
26 changes: 5 additions & 21 deletions .github/workflows/AdvancedStateAndSideEffectsCodelab.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,11 @@ on:
- main
paths:
- 'AdvancedStateAndSideEffectsCodelab/**'
- '.github/workflows/AdvancedStateAndSideEffectsCodelab.yaml'
pull_request:
paths:
- 'AdvancedStateAndSideEffectsCodelab/**'
- '.github/workflows/AdvancedStateAndSideEffectsCodelab.yaml'

env:
SAMPLE_PATH: AdvancedStateAndSideEffectsCodelab
Expand All @@ -31,16 +33,7 @@ jobs:
distribution: 'zulu'
java-version: 17

- name: Generate cache key
run: ./scripts/checksum.sh $SAMPLE_PATH checksum.txt

- uses: actions/cache@v4
with:
path: |
~/.gradle/caches/modules-*
~/.gradle/caches/jars-*
~/.gradle/caches/build-cache-*
key: gradle-${{ hashFiles('checksum.txt') }}
- uses: gradle/actions/setup-gradle@v3

- name: Build project
working-directory: ${{ env.SAMPLE_PATH }}
Expand Down Expand Up @@ -75,7 +68,7 @@ jobs:
sudo udevadm control --reload-rules
sudo udevadm trigger --name-match=kvm
ls /dev/kvm
- name: Checkout
uses: actions/checkout@v4

Expand All @@ -88,16 +81,7 @@ jobs:
distribution: 'zulu'
java-version: 17

- name: Generate cache key
run: ./scripts/checksum.sh $SAMPLE_PATH checksum.txt

- uses: actions/cache@v4
with:
path: |
~/.gradle/caches/modules-*
~/.gradle/caches/jars-*
~/.gradle/caches/build-cache-*
key: gradle-${{ hashFiles('checksum.txt') }}
- uses: gradle/actions/setup-gradle@v3

- name: Run instrumentation tests
uses: reactivecircus/android-emulator-runner@v2
Expand Down
15 changes: 4 additions & 11 deletions .github/workflows/AnimationCodelab.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,11 @@ on:
- main
paths:
- 'AnimationCodelab/**'
- '.github/workflows/AnimationCodelab.yaml'
pull_request:
paths:
- 'AnimationCodelab/**'
- '.github/workflows/AnimationCodelab.yaml'

env:
SAMPLE_PATH: AnimationCodelab
Expand All @@ -23,24 +25,15 @@ jobs:
uses: actions/checkout@v4

- name: Copy CI gradle.properties
run: mkdir -p ~/.gradle ; cp .github/ci-gradle.properties ~/.gradle/gradle.properties
run: mkdir -p ~/.gradle ; cp .github/ci-gradle.properties ~/.gradle/gradle.properties

- name: Set up JDK 17
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: 17

- name: Generate cache key
run: ./scripts/checksum.sh $SAMPLE_PATH checksum.txt

- uses: actions/cache@v4
with:
path: |
~/.gradle/caches/modules-*
~/.gradle/caches/jars-*
~/.gradle/caches/build-cache-*
key: gradle-${{ hashFiles('checksum.txt') }}
- uses: gradle/actions/setup-gradle@v3

- name: Build project
working-directory: ${{ env.SAMPLE_PATH }}
Expand Down
15 changes: 4 additions & 11 deletions .github/workflows/BasicLayoutsCodelab.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,11 @@ on:
- main
paths:
- 'BasicLayoutsCodelab/**'
- '.github/workflows/BasicLayoutsCodelab.yaml'
pull_request:
paths:
- 'BasicLayoutsCodelab/**'
- '.github/workflows/BasicLayoutsCodelab.yaml'

env:
SAMPLE_PATH: BasicLayoutsCodelab
Expand All @@ -23,24 +25,15 @@ jobs:
uses: actions/checkout@v4

- name: Copy CI gradle.properties
run: mkdir -p ~/.gradle ; cp .github/ci-gradle.properties ~/.gradle/gradle.properties
run: mkdir -p ~/.gradle ; cp .github/ci-gradle.properties ~/.gradle/gradle.properties

- name: Set up JDK 17
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: 17

- name: Generate cache key
run: ./scripts/checksum.sh $SAMPLE_PATH checksum.txt

- uses: actions/cache@v4
with:
path: |
~/.gradle/caches/modules-*
~/.gradle/caches/jars-*
~/.gradle/caches/build-cache-*
key: gradle-${{ hashFiles('checksum.txt') }}
- uses: gradle/actions/setup-gradle@v3

- name: Build project
working-directory: ${{ env.SAMPLE_PATH }}
Expand Down
15 changes: 4 additions & 11 deletions .github/workflows/BasicStateCodelab.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,11 @@ on:
- main
paths:
- 'BasicStateCodelab/**'
- '.github/workflows/BasicStateCodelab.yaml'
pull_request:
paths:
- 'BasicStateCodelab/**'
- '.github/workflows/BasicStateCodelab.yaml'

env:
SAMPLE_PATH: BasicStateCodelab
Expand All @@ -23,24 +25,15 @@ jobs:
uses: actions/checkout@v4

- name: Copy CI gradle.properties
run: mkdir -p ~/.gradle ; cp .github/ci-gradle.properties ~/.gradle/gradle.properties
run: mkdir -p ~/.gradle ; cp .github/ci-gradle.properties ~/.gradle/gradle.properties

- name: Set up JDK 17
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: 17

- name: Generate cache key
run: ./scripts/checksum.sh $SAMPLE_PATH checksum.txt

- uses: actions/cache@v4
with:
path: |
~/.gradle/caches/modules-*
~/.gradle/caches/jars-*
~/.gradle/caches/build-cache-*
key: gradle-${{ hashFiles('checksum.txt') }}
- uses: gradle/actions/setup-gradle@v3

- name: Build project
working-directory: ${{ env.SAMPLE_PATH }}
Expand Down
15 changes: 4 additions & 11 deletions .github/workflows/BasicsCodelab.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,11 @@ on:
- main
paths:
- 'BasicsCodelab/**'
- '.github/workflows/BasicsCodelab.yaml'
pull_request:
paths:
- 'BasicsCodelab/**'
- '.github/workflows/BasicsCodelab.yaml'

env:
SAMPLE_PATH: BasicsCodelab
Expand All @@ -23,24 +25,15 @@ jobs:
uses: actions/checkout@v4

- name: Copy CI gradle.properties
run: mkdir -p ~/.gradle ; cp .github/ci-gradle.properties ~/.gradle/gradle.properties
run: mkdir -p ~/.gradle ; cp .github/ci-gradle.properties ~/.gradle/gradle.properties

- name: Set up JDK 17
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: 17

- name: Generate cache key
run: ./scripts/checksum.sh $SAMPLE_PATH checksum.txt

- uses: actions/cache@v4
with:
path: |
~/.gradle/caches/modules-*
~/.gradle/caches/jars-*
~/.gradle/caches/build-cache-*
key: gradle-${{ hashFiles('checksum.txt') }}
- uses: gradle/actions/setup-gradle@v3

- name: Build project
working-directory: ${{ env.SAMPLE_PATH }}
Expand Down
36 changes: 14 additions & 22 deletions .github/workflows/MigrationCodelab.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,11 @@ on:
- main
paths:
- 'MigrationCodelab/**'
- '.github/workflows/MigrationCodelab.yaml'
pull_request:
paths:
- 'MigrationCodelab/**'
- '.github/workflows/MigrationCodelab.yaml'

env:
SAMPLE_PATH: MigrationCodelab
Expand All @@ -23,24 +25,15 @@ jobs:
uses: actions/checkout@v4

- name: Copy CI gradle.properties
run: mkdir -p ~/.gradle ; cp .github/ci-gradle.properties ~/.gradle/gradle.properties
run: mkdir -p ~/.gradle ; cp .github/ci-gradle.properties ~/.gradle/gradle.properties

- name: Set up JDK 17
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: 17

- name: Generate cache key
run: ./scripts/checksum.sh $SAMPLE_PATH checksum.txt

- uses: actions/cache@v4
with:
path: |
~/.gradle/caches/modules-*
~/.gradle/caches/jars-*
~/.gradle/caches/build-cache-*
key: gradle-${{ hashFiles('checksum.txt') }}
- uses: gradle/actions/setup-gradle@v3

- name: Build project
working-directory: ${{ env.SAMPLE_PATH }}
Expand Down Expand Up @@ -68,9 +61,17 @@ jobs:
api-level: [26, 29]

steps:
# https://github.blog/changelog/2023-02-23-hardware-accelerated-android-virtualization-on-actions-windows-and-linux-larger-hosted-runners
- name: Enable KVM group perms
run: |
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
sudo udevadm control --reload-rules
sudo udevadm trigger --name-match=kvm
ls /dev/kvm
- name: Checkout
uses: actions/checkout@v4

- name: Copy CI gradle.properties
run: mkdir -p ~/.gradle ; cp .github/ci-gradle.properties ~/.gradle/gradle.properties

Expand All @@ -80,16 +81,7 @@ jobs:
distribution: 'zulu'
java-version: 17

- name: Generate cache key
run: ./scripts/checksum.sh $SAMPLE_PATH checksum.txt

- uses: actions/cache@v4
with:
path: |
~/.gradle/caches/modules-*
~/.gradle/caches/jars-*
~/.gradle/caches/build-cache-*
key: gradle-${{ hashFiles('checksum.txt') }}
- uses: gradle/actions/setup-gradle@v3

- name: Run instrumentation tests
uses: reactivecircus/android-emulator-runner@v2
Expand Down
13 changes: 3 additions & 10 deletions .github/workflows/NavigationCodelab.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,11 @@ on:
- end
paths:
- 'NavigationCodelab/**'
- '.github/workflows/NavigationCodelab.yaml'
pull_request:
paths:
- 'NavigationCodelab/**'
- '.github/workflows/NavigationCodelab.yaml'

env:
SAMPLE_PATH: NavigationCodelab
Expand All @@ -32,16 +34,7 @@ jobs:
distribution: 'zulu'
java-version: 17

- name: Generate cache key
run: ./scripts/checksum.sh $SAMPLE_PATH checksum.txt

- uses: actions/cache@v4
with:
path: |
~/.gradle/caches/modules-*
~/.gradle/caches/jars-*
~/.gradle/caches/build-cache-*
key: gradle-${{ hashFiles('checksum.txt') }}
- uses: gradle/actions/setup-gradle@v3

- name: Build project
working-directory: ${{ env.SAMPLE_PATH }}
Expand Down
13 changes: 3 additions & 10 deletions .github/workflows/TestingCodelab.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,11 @@ on:
- end
paths:
- 'TestingCodelab/**'
- '.github/workflows/TestingCodelab.yaml'
pull_request:
paths:
- 'TestingCodelab/**'
- '.github/workflows/TestingCodelab.yaml'

env:
SAMPLE_PATH: TestingCodelab
Expand All @@ -32,16 +34,7 @@ jobs:
distribution: 'zulu'
java-version: 17

- name: Generate cache key
run: ./scripts/checksum.sh $SAMPLE_PATH checksum.txt

- uses: actions/cache@v4
with:
path: |
~/.gradle/caches/modules-*
~/.gradle/caches/jars-*
~/.gradle/caches/build-cache-*
key: gradle-${{ hashFiles('checksum.txt') }}
- uses: gradle/actions/setup-gradle@v3

- name: Build project
working-directory: ${{ env.SAMPLE_PATH }}
Expand Down
Loading

0 comments on commit bec4c64

Please sign in to comment.