-
Notifications
You must be signed in to change notification settings - Fork 4
119 lines (90 loc) · 3.92 KB
/
build.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
name: Test and Build
on: [push, pull_request]
env:
CARGO_TERM_COLOR: always
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install build dependencies - Rustup
run: |
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- --default-toolchain stable --profile minimal --target x86_64-unknown-linux-musl wasm32-unknown-unknown -y
echo "$HOME/.cargo/bin" >> $GITHUB_PATH
- name: Check code style
run: cargo fmt -- --check
- name: Install build dependencies - Cargo-Binstall
uses: cargo-bins/cargo-binstall@main
- name: Install build dependencies - Trunk
run: cargo binstall -y trunk
- name: Building frontend (wasm32)
working-directory: src/webpage
run: trunk build --release --locked --verbose
- name: Building tests
run: SKIP_FRONTEND=1 cargo test --no-run --locked --verbose
- name: Run Tests
run: SKIP_FRONTEND=1 cargo test --verbose -- --nocapture
build:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: macos-latest
TARGET: aarch64-apple-darwin
- os: macos-latest
TARGET: x86_64-apple-darwin
- os: ubuntu-latest
TARGET: arm-unknown-linux-musleabihf
- os: ubuntu-latest
TARGET: aarch64-unknown-linux-musl
- os: ubuntu-latest
TARGET: armv7-unknown-linux-musleabihf
- os: ubuntu-latest
TARGET: x86_64-unknown-linux-musl
- os: windows-latest
TARGET: x86_64-pc-windows-msvc
EXTENSION: .exe
steps:
- name: Building ${{ matrix.TARGET }}
run: echo "${{ matrix.TARGET }}"
- uses: actions/checkout@v4
# Required for cargo-binstall
- name: Fix openssl on Windows
if: runner.os == 'Windows'
run: |
echo "VCPKG_ROOT=$env:VCPKG_INSTALLATION_ROOT" | Out-File -FilePath $env:GITHUB_ENV -Append
vcpkg install openssl:x64-windows-static-md
- name: Install build dependencies - Rustup
run: |
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- --default-toolchain stable --profile minimal --target ${{ matrix.TARGET }} wasm32-unknown-unknown -y
echo "$HOME/.cargo/bin" >> $GITHUB_PATH
- name: Install build dependencies - Cargo-Binstall
uses: cargo-bins/cargo-binstall@main
- name: Install build dependencies - Cross, Trunk
run: cargo binstall -y trunk cross
- name: Building frontend (wasm32)
working-directory: src/webpage
run: trunk build --release --locked --verbose
- name: Building for ${{ matrix.os }} ${{ matrix.target }}
if: ${{ contains(matrix.TARGET, 'linux') }}
run: SKIP_FRONTEND=1 cross build --release --locked --target ${{matrix.target}} --verbose
- name: Building for ${{ matrix.os }} ${{ matrix.target }}
if: ${{ !contains(matrix.TARGET, 'linux') }}
run: cross build --release --locked --target ${{matrix.target}} --verbose
- name: Rename
run: cp target/${{ matrix.TARGET }}/release/${{ github.event.repository.name }}${{ matrix.EXTENSION }} ${{ github.event.repository.name }}-${{ matrix.TARGET }}${{ matrix.EXTENSION }}
- uses: actions/upload-artifact@v4
with:
name: ${{ github.event.repository.name }}-${{ matrix.TARGET }}${{ matrix.EXTENSION }}
path: ${{ github.event.repository.name }}-${{ matrix.TARGET }}${{ matrix.EXTENSION }}
- uses: svenstaro/upload-release-action@v2
name: Upload binaries to release
if: ${{ github.event_name == 'push' }}
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: ${{ github.event.repository.name }}-${{ matrix.TARGET }}${{ matrix.EXTENSION }}
asset_name: ${{ github.event.repository.name }}-${{ matrix.TARGET }}${{ matrix.EXTENSION }}
tag: ${{ github.ref }}
prerelease: ${{ !startsWith(github.ref, 'refs/tags/') }}
overwrite: true