-
Notifications
You must be signed in to change notification settings - Fork 0
114 lines (100 loc) · 3.12 KB
/
CI.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
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: cd bot && cargo bloat
env:
SHEET_ID: ${{ secrets['SHEET_ID_${github.base_ref}'] }}
- 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 }}"