-
Notifications
You must be signed in to change notification settings - Fork 0
98 lines (87 loc) · 2.83 KB
/
test_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
name: Try building binaries
on:
pull_request:
types: [synchronize]
jobs:
build:
name: Build
strategy:
matrix:
job:
- target: aarch64-unknown-linux-gnu
os: ubuntu-latest
- target: x86_64-unknown-linux-gnu
os: ubuntu-latest
- target: aarch64-apple-darwin
os: macos-latest
- target: x86_64-apple-darwin
os: macos-latest
- target: x86_64-pc-windows-msvc
os: windows-latest
runs-on: ${{ matrix.job.os }}
env:
CARGO_TARGET_DIR: target
LEPTOS_BIN_TARGET_TRIPLE: ${{ matrix.job.target }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Initialize workflow variables
id: vars
shell: bash
run: |
TARGET=${{ matrix.job.target }}
case $TARGET in
*-pc-windows-*) BINARY="file-share.exe" ;;
*) BINARY="file-share" ;;
esac;
echo "BINARY=${BINARY}"
echo "BINARY=${BINARY}" >> "$GITHUB_ENV"
case $TARGET in
x86_64-*) CROSS="false" ;;
*) CROSS="true" ;;
esac;
echo "CROSS=${CROSS}"
echo "CROSS=${CROSS}" >> "$GITHUB_ENV"
case $TARGET in
*-linux-*) ARCHIVE="file-share_$TARGET.tar.gz" ;;
*) ARCHIVE="file-share_$TARGET.zip" ;;
esac;
echo "ARCHIVE=${ARCHIVE}"
echo "ARCHIVE=${ARCHIVE}" >> "$GITHUB_ENV"
RELEASE="target/${{ matrix.job.target }}/release"
echo "RELEASE=${RELEASE}"
echo "RELEASE=${RELEASE}" >> "$GITHUB_ENV"
- name: Install gcc and linker for other archs
if: contains(matrix.job.target, 'linux')
run: |
sudo apt-get -y update
case ${{ matrix.job.target }} in
aarch64-*linux*) sudo apt-get -y install gcc-aarch64-linux-gnu ;;
x86_64-*linux*) sudo apt-get -y install mold ;;
esac;
- name: Install NodeJS
uses: actions/setup-node@v4
with:
node-version: lts
- uses: pnpm/action-setup@v4
name: Install pnpm and Tailwind
with:
version: 9
run_install: true
- name: Install rust tooling
uses: moonrepo/setup-rust@v1
with:
bins: cargo-leptos, cross
targets: "${{ matrix.job.target }},wasm32-unknown-unknown"
profile: minimal
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Compile
if: ${{ env.CROSS == 'false' }}
run: cargo leptos build --release
- name: Compile with cross
if: ${{ env.CROSS == 'true' }}
run: cargo leptos build --release
env:
LEPTOS_BIN_CARGO_COMMAND: cross
LEPTOS_BIN_TARGET: ${{ matrix.job.target }}