Skip to content

build(deps): bump ffigen from 8.0.2 to 9.0.1 in /app #125

build(deps): bump ffigen from 8.0.2 to 9.0.1 in /app

build(deps): bump ffigen from 8.0.2 to 9.0.1 in /app #125

Workflow file for this run

name: Build, test and deploy
on:
push:
branches:
- "dev"
# - "main"
pull_request:
branches:
# - "dev"
- "main"
concurrency:
group: ${{ github.event_name }}
env:
CARGO_TERM_COLOR: always
jobs:
build_and_test_bot:
runs-on: ubuntu-20.04
environment: ${{ github.event_name == 'pull_request' && 'main' || 'dev' }}
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- name: Download the table
if: github.event_name == 'pull_request'
run: curl -L "docs.google.com/spreadsheets/d/${{ secrets.SHEET_ID }}/gviz/tq?tqx=out:csv&sheet=Ukrainian" -o table.csv
- name: Test and build release
if: github.event_name == 'pull_request'
env:
SHEET_ID: ${{ secrets.SHEET_ID }}
run: cargo test --release && cargo build --release
- name: Test and build debug
if: github.event_name == 'push'
env:
SHEET_ID: ${{ secrets.SHEET_ID }}
run: cargo test && cargo build
- name: Move binary
run: mv target/*/bot target
- uses: actions/upload-artifact@v3
with:
name: executable
path: target/bot
- uses: actions/upload-artifact@v3
if: github.event_name == 'pull_request'
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 }}
# 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
deploy:
runs-on: [self-hosted]
needs: [build_and_test_bot, build_flutter_apk]
environment: ${{ github.event_name == 'pull_request' && 'main' || 'dev' }}
steps:
- uses: actions/checkout@v3
- uses: actions/download-artifact@v3
with:
name: executable
path: bin/bot
- uses: actions/download-artifact@v3
if: github.event_name == 'pull_request'
with:
name: table
- name: Restart bot
env:
TELOXIDE_TOKEN: ${{ secrets.TELOXIDE_TOKEN }}
run: |
docker build -t first_aid_bot:${{ github.event_name == 'pull_request' && 'main' || 'dev' }} .
docker compose -f docker-compose_${{ github.event_name == 'pull_request' && 'main' || 'dev' }}.yml -p ${{ github.event_name == 'pull_request' && 'main' || 'dev' }}_bot up -d
release:
runs-on: ubuntu-latest
needs: [build_and_test_bot, build_flutter_apk]
if: github.event_name == 'pull_request' && startsWith(github.ref, 'refs/tags/')
steps:
- uses: actions/checkout@v3
- uses: actions/download-artifact@v3
with:
name: table
- uses: actions/download-artifact@v3
with:
name: executable
- uses: actions/download-artifact@v3
with:
name: apk
- name: Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
generate_release_notes: true
files: |
app-release.apk
table.csv
first_aid_bot
notify:
runs-on: ubuntu-latest
needs: deploy
if: github.event_name == 'pull_request'
steps:
- uses: actions/download-artifact@v3
with:
name: table
- name: send telegram message on push
uses: appleboy/telegram-action@master
if: always() && github.event_name == 'pull_request' && !contains(needs.*.result, 'failure')
with:
to: ${{ secrets.TELEGRAM_TO }}
token: ${{ secrets.TELEGRAM_TOKEN }}
document: table.csv
message: |
${{ github.actor }} created commit:
Commit message: ${{ github.event.commits[0].message }}
See changes: https://github.com/${{ github.repository }}/actions/runs/${{github.sha}}
See error: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}
Successfully deployed! 🙆
- name: send telegram message on push
uses: appleboy/telegram-action@master
if: always() && github.event_name == 'pull_request' && contains(needs.*.result, 'failure')
with:
to: ${{ secrets.TELEGRAM_TO }}
token: ${{ secrets.TELEGRAM_TOKEN }}
document: table.csv
message: |
${{ github.actor }} created commit:
Commit message: ${{ github.event.commits[0].message }}
See changes: https://github.com/${{ github.repository }}/actions/runs/${{github.sha}}
See error: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}
The commit fails to build or tests have failed! 💣
# It should wait untill all checks will pass
auto-merge:
needs: [build_and_test_bot, build_flutter_apk]
runs-on: ubuntu-latest
if: github.event_name == 'pull_request'
permissions:
pull-requests: write
contents: write
steps:
- uses: fastify/github-action-merge-dependabot@v3
with:
target: minor
github-token: "${{ secrets.GITHUB_TOKEN }}"