-
Notifications
You must be signed in to change notification settings - Fork 583
149 lines (130 loc) · 4.14 KB
/
build-matrix.yml
File metadata and controls
149 lines (130 loc) · 4.14 KB
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 Matrix
on:
workflow_dispatch:
pull_request:
branches:
- "main"
push:
branches:
- "feature/build-matrix*"
- "feature/build-matrix/**"
concurrency:
group: build-matrix-${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
preflight:
name: Preflight
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Node.js setup
uses: actions/setup-node@v4
with:
node-version: 20
cache: "npm"
- name: Install frontend dependencies
run: npm install
- name: Sync versions
run: npm run sync-version
- name: Check locales
run: node scripts/check_locales.cjs
- name: Typecheck
run: npm run typecheck
build:
name: Build (${{ matrix.label }})
needs: preflight
runs-on: ${{ matrix.platform }}
permissions:
contents: read
strategy:
fail-fast: false
matrix:
include:
- label: "macos-aarch64"
platform: "macos-latest"
args: "--target aarch64-apple-darwin"
release_dir: "src-tauri/target/aarch64-apple-darwin/release"
- label: "macos-x86_64"
platform: "macos-latest"
args: "--target x86_64-apple-darwin"
release_dir: "src-tauri/target/x86_64-apple-darwin/release"
- label: "macos-universal"
platform: "macos-latest"
args: "--target universal-apple-darwin"
release_dir: "src-tauri/target/universal-apple-darwin/release"
- label: "windows-latest"
platform: "windows-latest"
args: ""
release_dir: "src-tauri/target/release"
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Rust setup
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.platform == 'macos-latest' && 'aarch64-apple-darwin,x86_64-apple-darwin' || '' }}
- name: Node.js setup
uses: actions/setup-node@v4
with:
node-version: 20
cache: "npm"
- name: Install frontend dependencies
run: npm install
- name: Sync versions
run: npm run sync-version
- name: Build app
shell: bash
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }}
TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY_PASSWORD }}
run: |
set -euo pipefail
npx tauri build --ci ${{ matrix.args }} 2>&1 | tee "build-${{ matrix.label }}.log"
- name: Summarize warnings
if: always()
shell: bash
run: |
set -euo pipefail
log_file="build-${{ matrix.label }}.log"
warnings_file="warnings-${{ matrix.label }}.txt"
if grep -n "^warning:" "$log_file" > "$warnings_file"; then
warning_count="$(wc -l < "$warnings_file" | tr -d ' ')"
else
: > "$warnings_file"
warning_count="0"
fi
{
echo "## ${{ matrix.label }}"
echo
echo "- warnings: ${warning_count}"
echo "- log: build-${{ matrix.label }}.log"
if [ -s "$warnings_file" ]; then
echo
echo '```text'
sed -n '1,200p' "$warnings_file"
echo '```'
fi
} >> "$GITHUB_STEP_SUMMARY"
- name: Upload build logs
if: always()
uses: actions/upload-artifact@v4
with:
name: logs-${{ matrix.label }}
retention-days: 7
if-no-files-found: error
path: |
build-${{ matrix.label }}.log
warnings-${{ matrix.label }}.txt
- name: Upload bundles
if: success()
uses: actions/upload-artifact@v4
with:
name: bundles-${{ matrix.label }}
retention-days: 7
if-no-files-found: error
path: |
${{ matrix.release_dir }}/bundle