update CI #18
Workflow file for this run
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, test | |
on: | |
pull_request: | |
branches: | |
- "dev" | |
- "main" | |
concurrency: | |
group: ${{ github.base_ref }} | |
env: | |
CARGO_TERM_COLOR: always | |
jobs: | |
build_and_test_bot: | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: dtolnay/rust-toolchain@stable | |
- uses: Swatinem/rust-cache@v2 | |
- name: Download the table | |
if: github.base_ref == 'main' | |
run: curl -L "docs.google.com/spreadsheets/d/${{ secrets['SHEET_ID_${github.base_ref}'] }}/gviz/tq?tqx=out:csv&sheet=Ukrainian" -o table.csv | |
- uses: baptiste0928/cargo-install@v2 | |
with: | |
crate: cargo-bloat | |
- run: cargo bloat | |
- name: Test and build release | |
if: github.base_ref == 'main' | |
env: | |
SHEET_ID: ${{ secrets['SHEET_ID_${github.base_ref}'] }} | |
run: cargo test --release && cargo build --release | |
- name: Test and build debug | |
if: github.base_ref == 'dev' | |
env: | |
SHEET_ID: ${{ secrets['SHEET_ID_${github.base_ref}'] }} | |
run: cargo test && cargo build | |
- name: Move binary | |
run: mv target/*/bot target | |
- run: ls -l target/bot | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: executable | |
path: target/bot | |
- uses: actions/upload-artifact@v3 | |
if: github.base_ref == 'main' | |
with: | |
name: table | |
path: table.csv | |
build_flutter_apk: | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
working-directory: app | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: extractions/setup-just@v1 | |
- uses: subosito/flutter-action@v2 | |
with: | |
channel: "stable" | |
cache: true | |
- uses: actions/setup-java@v3 | |
with: | |
distribution: "zulu" | |
java-version: "11" | |
cache: "gradle" | |
- uses: dtolnay/rust-toolchain@stable | |
with: | |
targets: aarch64-linux-android, armv7-linux-androideabi, x86_64-linux-android, i686-linux-android | |
- uses: Swatinem/rust-cache@v2 | |
- uses: baptiste0928/cargo-install@v2 | |
with: | |
crate: flutter_rust_bridge_codegen | |
- uses: baptiste0928/cargo-install@v2 | |
with: | |
crate: cargo-ndk | |
- uses: baptiste0928/cargo-install@v2 | |
with: | |
crate: cargo-expand | |
- run: just && flutter build apk --release | |
env: | |
SHEET_ID: ${{ secrets['SHEET_ID_${github.base_ref}'] }} | |
# https://github.com/actions/upload-artifact/issues/294 | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: apk | |
if-no-files-found: error | |
path: app/build/app/outputs/flutter-apk/app-release.apk | |
# It should wait untill all checks will pass | |
auto-merge: | |
needs: [build_and_test_bot, build_flutter_apk] | |
runs-on: ubuntu-latest | |
if: github.base_ref == 'main' | |
permissions: | |
pull-requests: write | |
contents: write | |
steps: | |
- uses: fastify/github-action-merge-dependabot@v3 | |
with: | |
target: minor | |
github-token: "${{ secrets.GITHUB_TOKEN }}" |