forked from ankidroid/Anki-Android-Backend
-
Notifications
You must be signed in to change notification settings - Fork 0
149 lines (131 loc) · 4.53 KB
/
build-quick.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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
name: Build quick (each platform)
on:
workflow_dispatch:
push:
schedule:
- cron: "0 0 * * *"
pull_request:
env:
DEBUG: 1
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build:
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-13]
fail-fast: false
runs-on: ${{ matrix.os }}
timeout-minutes: 80
steps:
- uses: actions/checkout@v3
- name: Fetch submodules
run: git submodule update --init
- name: Setup Ninja
uses: ashutoshvarma/setup-ninja@master
with:
version: 1.11.1
# The action puts a relative path on the PATH 🙄
- name: Make path absolute
if: matrix.os != 'windows-latest'
run: echo $(pwd)/ninja_bin >> $GITHUB_PATH
- name: Make path absolute
if: matrix.os == 'windows-latest'
run: |
$CurrentPath = (Get-Location).Path
$NewPath = "${CurrentPath}/ninja_bin"
Add-Content -Path $env:GITHUB_PATH -Value $NewPath
- name: Configure JDK
uses: actions/setup-java@v3
with:
distribution: "adopt"
java-version: "17" # matches Anki-Android
- name: Restore Rust Cache (Windows)
uses: actions/cache/restore@v3
if: matrix.os == 'windows-latest'
with:
path: |
~/.cargo/registry
~/.cargo/git
target
anki/out/rust
anki/out/download
# no node_modules, as it doesn't unpack properly
key: ${{ runner.os }}-rust-debug-v7-${{ hashFiles('Cargo.lock') }}-${{ hashFiles('anki/yarn.lock') }}
restore-keys: |
${{ runner.os }}-rust-debug-v7
- name: Restore Rust Cache (Unix)
uses: actions/cache/restore@v3
if: matrix.os != 'windows-latest'
with:
path: |
~/.cargo/registry
~/.cargo/git
target
anki/out/rust
anki/out/download
anki/out/node_modules
key: ${{ runner.os }}-rust-debug-v6-${{ hashFiles('Cargo.lock') }}-${{ hashFiles('anki/yarn.lock') }}
restore-keys: |
${{ runner.os }}-rust-debug-v6
- name: Setup Gradle
uses: gradle/gradle-build-action@v2
timeout-minutes: 5
with:
# Only write to the cache for builds on the 'main' branches, stops branches evicting main cache
# Builds on other branches will only read from main branch cache writes
# Comment this and the with: above out for performance testing on a branch
cache-read-only: ${{ github.ref != 'refs/heads/main' }}
gradle-home-cache-cleanup: true
- name: Build all (current platform)
run: cargo run -p build_rust
- name: Check Rust (Linux)
if: matrix.os == 'ubuntu-latest'
run: ./check-rust.sh
- name: Run tests (Mac)
uses: reactivecircus/android-emulator-runner@v2
if: matrix.os == 'macos-13'
timeout-minutes: 30
with:
api-level: 23
target: default
arch: x86_64
profile: Nexus 6
script: ./check-droid.sh
- name: Upload rsdroid AAR as artifact
uses: actions/upload-artifact@v3
with:
name: rsdroid-aar-${{ matrix.os }}
if-no-files-found: error
path: rsdroid/build/outputs/aar
- name: Upload rsdroid-robo JAR as artifact
uses: actions/upload-artifact@v3
with:
name: rsdroid-robo-${{ matrix.os }}
if-no-files-found: error
path: rsdroid-testing/build/libs
- name: Save Rust Cache (Windows)
uses: actions/cache/save@v3
if: matrix.os == 'windows-latest' && github.ref == 'refs/heads/main'
with:
path: |
~/.cargo/registry
~/.cargo/git
target
anki/out/rust
anki/out/download
# no node_modules, as it doesn't unpack properly
key: ${{ runner.os }}-rust-debug-v7-${{ hashFiles('Cargo.lock') }}-${{ hashFiles('anki/yarn.lock') }}
- name: Save Rust Cache (Unix)
uses: actions/cache/save@v3
if: matrix.os != 'windows-latest' && github.ref == 'refs/heads/main'
with:
path: |
~/.cargo/registry
~/.cargo/git
target
anki/out/rust
anki/out/download
anki/out/node_modules
key: ${{ runner.os }}-rust-debug-v6-${{ hashFiles('Cargo.lock') }}-${{ hashFiles('anki/yarn.lock') }}