Skip to content

Commit

Permalink
feat: enable kvm and use ubuntu for flutter actions (#1225)
Browse files Browse the repository at this point in the history
* feat: enable kvm and use ubuntu for flutter ci action

* chore: remove comments in app/build.gradle

* chore: remove unused function

* fix: remove unused packages

* Revert "chore: remove unused function"

This reverts commit bd19ed8.

* Revert "chore: remove comments in app/build.gradle"

This reverts commit a076c5f.

* chore: use gradle action for caching

* feat: enable kvm and use ubuntu for flutter cd action
  • Loading branch information
Nirajn2311 authored Apr 12, 2024
1 parent 52cc875 commit 8e70107
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 10 deletions.
30 changes: 25 additions & 5 deletions .github/workflows/flutter-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ on:
- main
paths:
- "mobile-app/**"
- ".github/**"
push:
branches:
- main
Expand All @@ -18,17 +19,36 @@ jobs:
defaults:
run:
working-directory: ./mobile-app
runs-on: macos-latest
runs-on: ubuntu-latest

steps:
- name: Remove unused software
working-directory: /
run: |
sudo rm -rf /usr/share/dotnet
sudo rm -rf /opt/ghc
echo "Free space:"
df -h /
- name: Checkout files
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4

- name: Enable KVM
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
- name: Gradle cache
uses: gradle/actions/setup-gradle@v3
with:
gradle-version: 7.6.3

- name: Setup Java 11
uses: actions/setup-java@99b8673ff64fbf99d8d325f52d9a5bdedb8483e9 # v4
with:
distribution: "temurin"
java-version: "11"
cache: "gradle"

- name: AVD cache
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4
Expand All @@ -37,13 +57,13 @@ jobs:
path: |
~/.android/avd/*
~/.android/adb*
key: avd-31
key: avd-33

- name: Ceate AVD and generate snapshot for caching
if: steps.avd-cache.outputs.cache-hit != 'true'
uses: reactivecircus/android-emulator-runner@6b0df4b0efb23bb0ec63d881db79aefbc976e4b2 # v2
with:
api-level: 31
api-level: 33
target: google_apis
arch: x86_64
force-avd-creation: false
Expand Down Expand Up @@ -90,7 +110,7 @@ jobs:
- name: Run tests in emulator
uses: reactivecircus/android-emulator-runner@6b0df4b0efb23bb0ec63d881db79aefbc976e4b2 # v2
with:
api-level: 31
api-level: 33
target: google_apis
arch: x86_64
force-avd-creation: false
Expand Down
29 changes: 24 additions & 5 deletions .github/workflows/flutter-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,36 @@ jobs:
defaults:
run:
working-directory: ./mobile-app
runs-on: macos-latest
runs-on: ubuntu-latest

steps:
- name: Remove unused software
working-directory: /
run: |
sudo rm -rf /usr/share/dotnet
sudo rm -rf /opt/ghc
echo "Free space:"
df -h /
- name: Checkout files
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4

- name: Enable KVM
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
- name: Gradle cache
uses: gradle/actions/setup-gradle@v3
with:
gradle-version: 7.6.3

- name: Setup Java 11
uses: actions/setup-java@99b8673ff64fbf99d8d325f52d9a5bdedb8483e9 # v4
with:
distribution: "temurin"
java-version: "11"
cache: "gradle"

- name: AVD cache
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4
Expand All @@ -33,13 +52,13 @@ jobs:
path: |
~/.android/avd/*
~/.android/adb*
key: avd-31
key: avd-33

- name: Ceate AVD and generate snapshot for caching
if: steps.avd-cache.outputs.cache-hit != 'true'
uses: reactivecircus/android-emulator-runner@6b0df4b0efb23bb0ec63d881db79aefbc976e4b2 # v2
with:
api-level: 31
api-level: 33
target: google_apis
arch: x86_64
force-avd-creation: false
Expand Down Expand Up @@ -86,7 +105,7 @@ jobs:
- name: Run tests in emulator
uses: reactivecircus/android-emulator-runner@6b0df4b0efb23bb0ec63d881db79aefbc976e4b2 # v2
with:
api-level: 31
api-level: 33
target: google_apis
arch: x86_64
force-avd-creation: false
Expand Down

0 comments on commit 8e70107

Please sign in to comment.