Flutter Build Test CI #216
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 Build Test CI | |
on: | |
schedule: | |
- cron: '0 8 1/7 * *' | |
push: | |
branches: | |
- master | |
pull_request: | |
jobs: | |
# Set up Flutter for all other tasks. | |
setup: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [macos-latest, ubuntu-latest, windows-latest] | |
include: | |
- os: ubuntu-latest | |
flutter_path: /opt/hostedtoolcache/flutter | |
- os: macos-latest | |
flutter_path: /Users/runner/hostedtoolcache/flutter | |
- os: windows-latest | |
flutter_path: C:\Users\runneradmin\hostedtoolcache\flutter | |
fail-fast: false | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Cache Flutter dependencies | |
uses: actions/cache@v3 | |
with: | |
path: ${{ matrix.flutter_path }} | |
key: ${{ runner.os }}-flutter | |
- uses: subosito/flutter-action@v2 | |
with: | |
channel: 'stable' | |
build-and-test: | |
runs-on: ${{ matrix.os }} | |
needs: setup | |
strategy: | |
matrix: | |
os: [macos-latest, ubuntu-latest, windows-latest] | |
include: | |
- os: ubuntu-latest | |
flutter_path: /opt/hostedtoolcache/flutter | |
- os: macos-latest | |
flutter_path: /Users/runner/hostedtoolcache/flutter | |
- os: windows-latest | |
flutter_path: C:\Users\runneradmin\hostedtoolcache\flutter | |
fail-fast: false | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-java@v3 | |
with: | |
distribution: 'temurin' # See 'Supported distributions' for available options | |
java-version: '11' | |
- name: Cache Flutter | |
id: cache-flutter | |
uses: actions/cache@v3 | |
with: | |
path: ${{ matrix.flutter_path }} | |
key: ${{ runner.os }}-flutter | |
- uses: subosito/flutter-action@v2 | |
with: | |
channel: 'stable' | |
- name: enabled exp platform | |
run: | | |
flutter config --enable-macos-desktop | |
- name: flutter hotbake | |
run: | | |
flutter pub get | |
flutter analyze | |
flutter test | |
- name: build platform directory | |
working-directory: ./example | |
run: flutter create . | |
# build example | |
- name: build android example | |
working-directory: ./example | |
run: flutter build appbundle | |
- if: matrix.os == 'macos-latest' | |
name: build ios example | |
working-directory: ./example | |
run: flutter build ios --release --no-codesign | |
- if: matrix.os == 'macos-latest' | |
name: build macos example | |
working-directory: ./example | |
run: flutter build macos | |
- name: build web example | |
working-directory: ./example | |
run: flutter build web | |
- if: ${{ matrix.os == 'ubuntu-latest' && github.ref == 'refs/heads/master' }} | |
name: deploy | |
uses: JamesIves/github-pages-deploy-action@v4.3.3 | |
with: | |
branch: gh-pages # The branch the action should deploy to. | |
folder: example/build/web # The folder the action should deploy. |