Skip to content

Commit

Permalink
ci: android integration tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ahmednfwela committed Nov 24, 2024
1 parent 37e5bff commit 802ec68
Show file tree
Hide file tree
Showing 2 changed files with 83 additions and 21 deletions.
12 changes: 0 additions & 12 deletions .github/workflows/oidc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,6 @@ on:
# - main

jobs:

build:
uses: ./.github/workflows/flutter_package.yaml
with:
working_directory: packages/oidc

pana:
uses: ./.github/workflows/pana.yaml
with:
min_score: 100


android:
runs-on: macos-latest
if: false # TODO: Integration tests are flaky, see https://github.com/VeryGoodOpenSource/very_good_flutter_plugin/issues/79
Expand Down
92 changes: 83 additions & 9 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ defaults:
run:
shell: bash -leo pipefail {0}

jobs:
workflows:
jobs:
unit_tests:
runs-on: ubuntu-latest
strategy:
fail-fast: false
Expand All @@ -40,7 +40,7 @@ jobs:
- name: Set up Flutter
uses: subosito/flutter-action@v2
with:
cache: true
cache: true
channel: ${{ matrix.sdk == 'min' && 'stable' || matrix.sdk }}
flutter-version: ${{ matrix.sdk == 'min' && '3.22.0' || '' }}
- run: |
Expand Down Expand Up @@ -81,11 +81,85 @@ jobs:
- name: '[Coverage] Format & print test coverage'
if: ${{ matrix.sdk == 'stable' }}
run: melos run coverage:combine
- name: Report to Codecov
uses: codecov/codecov-action@v4
- name: Upload Unit Test Coverage Report
uses: actions/upload-artifact@v4
if: ${{ matrix.sdk == 'stable' }}
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
with:
file: coverage/lcov.info
fail_ci_if_error: false
name: unit-tests-coverage
path: coverage/lcov.info
# Upload
# - name: Report to Codecov
# uses: codecov/codecov-action@v4
# if: ${{ matrix.sdk == 'stable' }}
# env:
# CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
# with:
# file: coverage/lcov.info
# fail_ci_if_error: false

# integration tests
android:
runs-on: ubuntu-latest
strategy:
matrix:
api-level: [29]
defaults:
run:
working-directory: packages/oidc/example
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: Set up Flutter
uses: subosito/flutter-action@v2
with:
cache: true
channel: stable
flutter-version: 3.22.0
# see https://github.com/invertase/melos/issues/796
- uses: bluefireteam/melos-action@main
continue-on-error: true
with:
run-bootstrap: true
bootstrap-no-example: false
- uses: bluefireteam/melos-action@main
with:
run-bootstrap: true
bootstrap-no-example: true
- 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

- name: AVD cache
uses: actions/cache@v4
id: avd-cache
with:
path: |
~/.android/avd/*
~/.android/adb*
key: avd-${{ matrix.api-level }}

- name: create AVD and generate snapshot for caching
if: steps.avd-cache.outputs.cache-hit != 'true'
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: ${{ matrix.api-level }}
force-avd-creation: false
emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
disable-animations: false
script: echo "Generated AVD snapshot for caching."

- name: Run Android Emulator and Integration Tests
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: ${{ matrix.api-level }}
script: flutter doctor -v
# - name: Upload Coverage Report
# uses: actions/upload-artifact@v3
# with:
# name: android-coverage
# path: packages/oidc/example/coverage/lcov.info

0 comments on commit 802ec68

Please sign in to comment.