-
Notifications
You must be signed in to change notification settings - Fork 0
139 lines (130 loc) · 5.27 KB
/
Copy pathtest.yml
File metadata and controls
139 lines (130 loc) · 5.27 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
name: "test"
on:
push:
branches:
- '**'
tags-ignore:
- 'v**'
jobs:
test-build:
name: Test & Build
strategy:
fail-fast: false
matrix:
platform: [macos-latest, ubuntu-latest, windows-latest]
runs-on: ${{ matrix.platform }}
steps:
# Prepare
- name: 🔥 Checkout code
uses: actions/checkout@v6
- name: 🧹 Free Disk Space (Ubuntu)
if: matrix.platform == 'ubuntu-latest'
run: |
sudo rm -rf /usr/share/dotnet
sudo rm -rf /usr/local/lib/android
sudo rm -rf /opt/ghc
sudo rm -rf /opt/hostedtoolcache/CodeQL
sudo docker image prune --all --force
- name: 🛠️ Install nodejs 24
uses: actions/setup-node@v6
with:
node-version: 24
- name: 🛠️ Install rust stable
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
- name: 💾 Cache rust dependencies
uses: Swatinem/rust-cache@v2
- name: 💾 Cache javascript dependencies
uses: actions/cache@v5
with:
path: '**/node_modules'
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}
- name: 🛠️ Install tauri-cli
run: |
cargo install tauri-cli
- name: 🛠️ Install tarpaulin (rust code coverage analyser)
if: matrix.platform == 'ubuntu-latest'
run: |
curl -L --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/cargo-bins/cargo-binstall/main/install-from-binstall-release.sh | bash
cargo binstall -y --force cargo-tarpaulin
- name: 🛠️ Install webkit2gtk (for tauri)
if: matrix.platform == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install -y libwebkit2gtk-4.1-dev libgtksourceview-3.0-dev libsoup-3.0-dev libjavascriptcoregtk-4.1-dev liblua5.4-dev libfuse2 file patchelf librsvg2-dev
- name: 🛠️ Install Lua 5.4 (macOS)
if: matrix.platform == 'macos-latest'
run: |
brew update
brew install lua@5.4 pkg-config
echo "PKG_CONFIG_PATH=$(brew --prefix lua@5.4)/lib/pkgconfig:${PKG_CONFIG_PATH:-}" >> $GITHUB_ENV
- name: 🛠️ Install Lua 5.4 (Windows)
if: matrix.platform == 'windows-latest'
shell: pwsh
run: |
choco install -y pkgconfiglite
& "C:\vcpkg\vcpkg.exe" install lua:x64-windows
$vcpkgRoot = 'C:\vcpkg\installed\x64-windows'
$pkgconfigDir = "$vcpkgRoot\lib\pkgconfig"
if (Test-Path "$pkgconfigDir\lua.pc") { Copy-Item "$pkgconfigDir\lua.pc" "$pkgconfigDir\lua54.pc" }
# Use forward slashes for PKG_CONFIG_PATH to avoid drive letter confusion
$pkgConfigPath = $pkgconfigDir -replace '\\', '/'
Add-Content -Path $env:GITHUB_ENV -Value "PKG_CONFIG_PATH=$pkgConfigPath"
# Set explicit LUA environment variables as fallback for mlua
Add-Content -Path $env:GITHUB_ENV -Value "LUA_INC=$vcpkgRoot\include"
Add-Content -Path $env:GITHUB_ENV -Value "LUA_LIB=$vcpkgRoot\lib"
Add-Content -Path $env:GITHUB_ENV -Value "LUA_LIB_NAME=lua"
# Add Lua bin directory to PATH so build scripts can find lua.dll
Add-Content -Path $env:GITHUB_PATH -Value "$vcpkgRoot\bin"
$pkgconfigBin = Join-Path $env:ChocolateyInstall 'lib\pkgconfiglite\tools'
Add-Content -Path $env:GITHUB_PATH -Value $pkgconfigBin
- name: 🔧 Configure mlua vendored build (Windows)
if: matrix.platform == 'windows-latest'
shell: pwsh
run: |
Add-Content -Path $env:GITHUB_ENV -Value "MLUA_BUILD_LUA=1"
# Javascript
- name: 🛠️ Install nodejs dependencies
run: |
cd app; yarn
- name: 🏗️ Build javascript code
run: |
cd app; yarn build:web
- name: 🧪 Lint javascript code
run: |
cd app; yarn lint
- name: 🧪 Test javascript code
run: |
cd app; yarn test:coverage
# Rust
- name: 🏗️ Build rust code
env:
TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_PRIVATE_KEY }}
TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.TAURI_KEY_PASSWORD }}
APPIMAGE_EXTRACT_AND_RUN: 1
# Disable incremental compilation to prevent LNK1123/CVT1100 errors on Windows
CARGO_INCREMENTAL: 0
run: |
cd app; yarn tauri:build
- name: 🧹 Clean release artifacts
if: matrix.platform == 'ubuntu-latest'
run: |
rm -rf target/release
- name: 🧪 Test rust code
if: matrix.platform == 'ubuntu-latest'
run: |
cargo tarpaulin --verbose --all-features --workspace --timeout 120 --out Xml
- name: 🧪 Lint rust code
continue-on-error: true
run: |
cd app; yarn cargo:clippy
# Upload coverage
- name: 📤 Upload coverage reports to codecov.io
if: matrix.platform == 'ubuntu-latest' && github.ref == 'refs/heads/master'
uses: codecov/codecov-action@v5
continue-on-error: true
with:
fail_ci_if_error: false
files: ./app/coverage/cobertura-coverage.xml,./cobertura.xml,./target/tarpaulin/coverage.json