add: CI workflows, dependabot config, and funding options (#1) #7
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: Install latest Rust default toolchain | |
run: rustup update --no-self-update | |
- name: Install cargo-binstall latest | |
uses: cargo-bins/cargo-binstall@main | |
- name: Install Rinf | |
run: cargo binstall -y rinf | |
- name: Setup Java for Android | |
uses: actions/setup-java@v4 | |
# only required for android builds | |
if: matrix.platform == 'Android' | |
with: | |
distribution: "temurin" | |
java-version: "21" | |
cache: "gradle" | |
cache-dependency-path: android/**/gradle-wrapper.properties | |
- name: Install rust toolchains for Android | |
# only required for android builds | |
if: matrix.platform == 'Android' | |
run: rustup target add armv7-linux-androideabi aarch64-linux-android x86_64-linux-android | |
- name: Setup Flutter SDK | |
# this action allegedly runs `flutter --disable-analytics` | |
uses: flutter-actions/setup-flutter@v4 | |
with: | |
channel: stable | |
version: latest | |
cache: true | |
cache-sdk: true | |
cache-key: ${{ hashFiles('pubspec.lock') }} | |
- name: Cache .cargo locked resources | |
uses: actions/cache@v4 | |
with: | |
path: ~/.cargo | |
key: ${{ runner.os }}-cargo-${{ hashFiles('Cargo.lock') }} | |
- name: Fetch .cargo locked resources | |
run: cargo fetch | |
# https://github.com/ninja-build/ninja/wiki/Pre-built-Ninja-packages | |
# https://grpc.io/docs/protoc-installation/ | |
- name: Install Linux prerequisites | |
if: matrix.platform == 'linux' | |
run: sudo apt-get install -y ninja-build protobuf-compiler libgtk-3-dev | |
- name: Install MacOS prerequisites | |
if: matrix.platform == 'MacOS' | |
run: brew install protobuf | |
# 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 |