Skip to content

Tests

Tests #503

Workflow file for this run

name: Tests
on:
push:
pull_request:
schedule:
# runs the CI everyday at 10AM
- cron: "0 10 * * *"
concurrency:
group: build-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
geojson2h3_tests:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest]
sdk: [stable, beta, dev]
steps:
- uses: actions/checkout@v2
- uses: dart-lang/setup-dart@v1.3
with:
sdk: ${{ matrix.sdk }}
architecture: x64
- name: Install coverage tool
run: dart pub global activate coverage
- name: Override dependencies
run: dart scripts/dependency_override.dart
- name: Install dependencies
run: dart pub get
working-directory: ./geojson2h3
- name: Analyze
run: dart analyze
working-directory: ./geojson2h3
- name: Run tests
run: dart pub global run coverage:test_with_coverage
working-directory: ./geojson2h3
- name: Upload coverage to codecov
uses: codecov/codecov-action@v2
with:
files: ./geojson2h3/coverage/lcov.info
flags: geojson2h3
h3_common_tests:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest]
sdk: [stable, beta, dev]
steps:
- uses: actions/checkout@v2
- uses: dart-lang/setup-dart@v1.3
with:
sdk: ${{ matrix.sdk }}
architecture: x64
- name: Install coverage tool
run: dart pub global activate coverage
- name: Override dependencies
run: dart scripts/dependency_override.dart
- name: Install dependencies
run: dart pub get
working-directory: ./h3_common
- name: Analyze
run: dart analyze
working-directory: ./h3_common
- name: Run tests
run: dart pub global run coverage:test_with_coverage
working-directory: ./h3_common
- name: Upload coverage to codecov
uses: codecov/codecov-action@v2
with:
files: ./h3_common/coverage/lcov.info
flags: h3_common
h3_dart_tests:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
sdk: [stable, beta, dev]
steps:
- uses: actions/checkout@v2
- uses: dart-lang/setup-dart@v1.3
with:
sdk: ${{ matrix.sdk }}
architecture: x64
- name: Install coverage tool
run: dart pub global activate coverage
- name: Prepare tests
run: sh scripts/prepare_tests.sh
- name: Override dependencies
run: dart scripts/dependency_override.dart
- name: Install dependencies
run: dart pub get
working-directory: ./h3_dart
- name: Analyze
run: dart analyze
working-directory: ./h3_dart
- name: Setup Chrome
uses: browser-actions/setup-chrome@latest
- name: Run tests (VM)
run: dart pub global run coverage:test_with_coverage
working-directory: ./h3_dart
- name: Run tests (Web)
run: dart test -p chrome
working-directory: ./h3_dart
- name: Upload coverage to codecov
uses: codecov/codecov-action@v2
with:
files: ./h3_dart/coverage/lcov.info
flags: h3_dart
h3_ffi_tests:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
sdk: [stable, beta, dev]
steps:
- uses: actions/checkout@v2
- uses: dart-lang/setup-dart@v1.3
with:
sdk: ${{ matrix.sdk }}
architecture: x64
- name: Install coverage tool
run: dart pub global activate coverage
- name: Prepare tests
run: sh scripts/prepare_tests.sh
- name: Override dependencies
run: dart scripts/dependency_override.dart
- name: Install dependencies
run: dart pub get
working-directory: ./h3_ffi
- name: Analyze
run: dart analyze
working-directory: ./h3_ffi
- name: Run tests
run: dart pub global run coverage:test_with_coverage
working-directory: ./h3_ffi
- name: Upload coverage to codecov
uses: codecov/codecov-action@v2
with:
files: ./h3_ffi/coverage/lcov.info
flags: h3_ffi
h3_flutter_test_android:
runs-on: macos-latest
steps:
- name: checkout
uses: actions/checkout@v3
- name: Setup subosito/flutter-action@v2
uses: subosito/flutter-action@v2
with:
channel: beta
architecture: x64
- uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '11'
- name: Disable macos
run: flutter config --no-enable-macos-desktop
working-directory: ./h3_flutter
- name: Disable web
run: flutter config --no-enable-web
working-directory: ./h3_flutter
- name: Override dependencies
run: dart scripts/dependency_override.dart
- name: Pub get
run: flutter pub get
working-directory: ./h3_flutter
- name: Analyze
run: flutter analyze
working-directory: ./h3_flutter
- name: Gradle cache
uses: gradle/gradle-build-action@v2
- name: AVD cache
uses: actions/cache@v3
id: avd-cache
with:
path: |
~/.android/avd/*
~/.android/adb*
key: avd-31
- 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: 31
arch: x86_64
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 tests
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: 31
arch: x86_64
force-avd-creation: false
emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
disable-animations: true
working-directory: ./h3_flutter/example
script: flutter test integration_test/app_test.dart
h3_flutter_test_desktop:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ windows-latest, ubuntu-latest ] # disable macos while https://github.com/github/roadmap/issues/620 is open
steps:
- uses: actions/checkout@v2
- name: Install linux dependencies
run: sudo apt-get install -y clang cmake ninja-build pkg-config libgtk-3-dev liblzma-dev
if: matrix.os == 'ubuntu-latest'
- name: Setup subosito/flutter-action@v2
uses: subosito/flutter-action@v2
with:
channel: beta
architecture: x64
- name: Enable linux
run: flutter config --enable-linux-desktop
- name: Enable macos
run: flutter config --enable-macos-desktop
- name: Enable windows
run: flutter config --enable-windows-desktop
- name: Override dependencies
run: dart scripts/dependency_override.dart
- name: Pub get
run: "flutter pub get"
working-directory: ./h3_flutter
- name: Analyze
run: "flutter analyze"
working-directory: ./h3_flutter
- name: Disable web
run: flutter config --no-enable-web
working-directory: ./h3_flutter
- name: Run tests (linux)
run: |
export DISPLAY=:99
sudo Xvfb -ac :99 -screen 0 1280x1024x24 > /dev/null 2>&1 &
flutter test integration_test/app_test.dart
working-directory: ./h3_flutter/example
if: matrix.os == 'ubuntu-latest'
- name: Run tests
run: flutter test integration_test/app_test.dart
working-directory: ./h3_flutter/example
if: matrix.os != 'ubuntu-latest'
h3_flutter_test_web:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest]
steps:
- uses: actions/checkout@v2
- name: Setup subosito/flutter-action@v2
uses: subosito/flutter-action@v2
with:
channel: beta
architecture: x64
- name: Setup Chrome
uses: browser-actions/setup-chrome@latest
- name: Setup Chrome Driver
uses: nanasess/setup-chromedriver@v1
- run: |
export DISPLAY=:99
chromedriver --port=4444 &
sudo Xvfb -ac :99 -screen 0 1280x1024x24 > /dev/null 2>&1 &
- name: Override dependencies
run: dart scripts/dependency_override.dart
- name: Pub get
run: "flutter pub get"
working-directory: ./h3_flutter
- name: Analyze
run: "flutter analyze"
working-directory: ./h3_flutter
- name: Disable linux
run: flutter config --no-enable-linux-desktop
working-directory: ./h3_flutter
- name: Run tests
run: flutter drive --driver=test_driver/integration_test.dart --target=integration_test/app_test.dart -d web-server
working-directory: ./h3_flutter/example
h3_web_tests:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest]
sdk: [stable, beta, dev]
steps:
- uses: actions/checkout@v2
- uses: dart-lang/setup-dart@v1.3
with:
sdk: ${{ matrix.sdk }}
architecture: x64
- name: Override dependencies
run: dart scripts/dependency_override.dart
- name: Install dependencies
run: dart pub get
working-directory: ./h3_web
- name: Analyze
run: dart analyze
working-directory: ./h3_web
- name: Run tests
run: dart test -p chrome
working-directory: ./h3_web