flutter pub upgrade && flutter pub upgrade --major-versions
(#1687)
#4111
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
--- | |
name: Flutter CI | |
on: | |
pull_request: | |
push: | |
branches: [main] | |
workflow_dispatch: | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
# https://docs.flutter.dev/development/tools/formatting | |
flutter_format: | |
runs-on: ubuntu-latest | |
timeout-minutes: 5 | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: subosito/flutter-action@v2.12.0 | |
with: | |
cache: true | |
- name: setup flutter channel | |
shell: bash | |
run: ./scripts/setup_flutter.sh | |
- run: dart format . --line-length 120 --set-exit-if-changed | |
# https://docs.flutter.dev/reference/flutter-cli#flutter-commands | |
# https://flutter.dev/docs/development/tools/flutter-fix#applying-project-wide-fixes | |
flutter_analyze: | |
runs-on: ubuntu-latest | |
timeout-minutes: 5 | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: subosito/flutter-action@v2.12.0 | |
with: | |
cache: true | |
- name: setup flutter channel | |
shell: bash | |
run: ./scripts/setup_flutter.sh | |
- name: install dependencies | |
run: flutter pub get | |
- run: flutter analyze --fatal-infos --fatal-warnings . | |
# https://docs.flutter.dev/testing | |
flutter_tests: | |
needs: [flutter_format, flutter_analyze] | |
runs-on: ${{ matrix.runner_machine }} | |
timeout-minutes: 20 | |
strategy: | |
fail-fast: false # for https://github.com/sensuikan1973/pedax/issues/1221 | |
matrix: # https://docs.github.com/en/actions/using-jobs/using-a-matrix-for-your-jobs | |
os: [windows, macos, ubuntu] # pedax uses ffi package(libedax4dart), so run widget test on multiple OS. | |
include: | |
- os: windows | |
runner_machine: windows-latest | |
setup_for_flutter_desktop_script: .github/scripts/windows/install_additional_requirements_for_flutter.sh | |
integration_test_command: flutter test integration_test --device-id windows --verbose --coverage --coverage-path=./coverage/lcov.integration_test.info | |
- os: macos | |
# Why isn't this macos-latest ? -> workaround for https://github.com/sensuikan1973/pedax/pull/1443 | |
# https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners | |
runner_machine: macos-13 | |
setup_for_flutter_desktop_script: .github/scripts/macos/install_additional_requirements_for_flutter.sh | |
integration_test_command: flutter test integration_test --device-id macos --verbose --coverage --coverage-path=./coverage/lcov.integration_test.info | |
- os: ubuntu | |
runner_machine: ubuntu-latest | |
setup_for_flutter_desktop_script: .github/scripts/linux/install_additional_requirements_for_flutter.sh | |
integration_test_command: | | |
touch ./coverage/lcov.integration_test.info | |
timeout 240 xvfb-run -a \ | |
flutter test integration_test --device-id linux --verbose --coverage --coverage-path=./coverage/lcov.integration_test.info \ | |
|| ( [[ $? -eq 124 ]] && echo "WARNING: timeout" ) | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: subosito/flutter-action@v2.12.0 | |
with: | |
cache: true | |
- name: setup flutter channel | |
shell: bash | |
run: ./scripts/setup_flutter.sh | |
- name: setup flutter desktop | |
shell: bash | |
run: ${{ matrix.setup_for_flutter_desktop_script }} | |
- name: doctor | |
run: flutter doctor -v | |
- name: install dependencies | |
run: flutter pub get | |
# https://docs.flutter.dev/testing#widget-tests | |
- name: widget test | |
run: flutter test --verbose --coverage --coverage-path=./coverage/lcov.widget_test.info | |
# https://docs.codecov.com/docs/merging-reports#multiple-languages | |
- uses: codecov/codecov-action@v3 | |
with: # ref: https://github.com/codecov/codecov-action/blob/v3.1.0/.github/workflows/main.yml | |
files: ./coverage/lcov.widget_test.info | |
flags: widget_test,${{ matrix.os }} | |
fail_ci_if_error: true | |
# See: https://github.com/codecov/codecov-action/issues/837 | |
# https://app.codecov.io/gh/sensuikan1973/pedax/settings | |
token: ${{ secrets.CODECOV_TOKEN }} | |
# https://docs.flutter.dev/testing#integration-tests | |
- name: integration test | |
run: ${{ matrix.integration_test_command }} | |
# https://docs.codecov.com/docs/merging-reports#multiple-languages | |
- uses: codecov/codecov-action@v3 | |
with: # ref: https://github.com/codecov/codecov-action/blob/v3.1.0/.github/workflows/main.yml | |
files: ./coverage/lcov.integration_test.info | |
flags: integration_test,${{ matrix.os }} | |
fail_ci_if_error: true | |
# See: https://github.com/codecov/codecov-action/issues/837 | |
# https://app.codecov.io/gh/sensuikan1973/pedax/settings | |
token: ${{ secrets.CODECOV_TOKEN }} |