ci: add wasm build for web #99
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: | |
- master | |
- main | |
pull_request: | |
branches: | |
- master | |
- main | |
jobs: | |
format-check: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: subosito/flutter-action@v2 | |
with: | |
channel: 'stable' | |
- name: Check | |
run: | | |
flutter pub get | |
dart fix --apply | |
dart format . | |
git diff --exit-code | |
if [ $? -eq 0 ]; then | |
echo "No formatting changes detected" | |
else | |
echo "Formatting changes detected. Run `make format` to fix it." | |
exit 1 | |
fi | |
build-windows: | |
runs-on: windows-latest | |
needs: format-check | |
steps: | |
- uses: actions/checkout@v3 | |
# https://github.com/subosito/flutter-action/issues/277 | |
- uses: subosito/[email protected] | |
with: | |
channel: 'stable' | |
- name: Build | |
run: | | |
flutter pub get | |
flutter build windows | |
build-web: | |
runs-on: ubuntu-latest | |
needs: format-check | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: subosito/flutter-action@v2 | |
with: | |
channel: 'stable' | |
- name: Build | |
run: | | |
rustup toolchain install nightly | |
rustup +nightly component add rust-src | |
rustup +nightly target add wasm32-unknown-unknown | |
cargo install wasm-pack | |
cargo install flutter_rust_bridge_codegen | |
flutter pub get | |
flutter_rust_bridge_codegen build-web | |
flutter build web | |
build-android: | |
runs-on: ubuntu-latest | |
needs: format-check | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-java@v2 | |
with: | |
distribution: 'zulu' | |
java-version: '17' | |
- uses: subosito/flutter-action@v2 | |
with: | |
channel: 'stable' | |
- name: Build | |
run: | | |
flutter pub get | |
flutter build apk |