Use composite action #16
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: Build | |
on: | |
push: | |
branches: [main] | |
pull_request: | |
branches: [main] | |
jobs: | |
build: | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- os: ubuntu-latest | |
flutter-cmd: linux | |
artifact: build/linux/x64/release/bundle | |
platform: Linux | |
- os: ubuntu-latest | |
flutter-cmd: apk | |
artifact: build/app/outputs/flutter-apk/app-release.apk | |
platform: Android | |
- os: windows-latest | |
flutter-cmd: windows | |
artifact: build/windows/x64/runner/Release | |
platform: Windows | |
- os: macos-latest | |
flutter-cmd: macos | |
artifact: build/macos/Build/Products/Release/daily_wallpaper_images.app | |
platform: MacOS | |
runs-on: ${{ matrix.os }} | |
name: ${{ matrix.platform }} build | |
steps: | |
# setup env | |
- name: Checkout Repository | |
uses: actions/checkout@v4 | |
with: | |
submodules: true | |
- name: Setup Build Env | |
uses: ./.github/setup-rinf | |
with: | |
platform: ${{ matrix.platform }} | |
cache-cargo: true | |
cache-cargo-key: ${{ hashFiles('Cargo.lock') }}-${{ matrix.platform }}-cargo | |
cache-pub: true | |
cache-pub-key: ${{ hashFiles('pubspec.lock') }}-${{ matrix.platform }}-dart | |
cache-flutter-sdk: true | |
# lint and build | |
- name: Generate messages API | |
run: rinf message | |
- name: Get Flutter dependencies | |
run: flutter pub get | |
- name: Lint Dart sources | |
run: flutter analyze | |
- name: Lint Rust sources | |
run: cargo clippy | |
# Generated Rust code is unformatted: https://github.com/cunarist/rinf/issues/500 | |
# - name: Format Rust sources | |
# run: cargo fmt --check | |
- name: Build App | |
run: flutter build ${{ matrix.flutter-cmd }} | |
- name: Save artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
path: ${{ matrix.artifact }} | |
name: ${{ matrix.platform }}_artifacts |