1+ on : [push, pull_request, workflow_dispatch]
2+
3+ name : CI
4+
5+ # env:
6+ # RUSTFLAGS: -D warnings
7+ # RUSTDOCFLAGS: -D warnings
8+
9+ jobs :
10+ check :
11+ name : Check
12+ runs-on : ubuntu-latest
13+ steps :
14+ - uses : actions/checkout@v4
15+ - uses : actions-rs/toolchain@v1
16+ with :
17+ profile : minimal
18+ toolchain : stable
19+ override : true
20+ - uses : actions-rs/cargo@v1
21+ with :
22+ command : check
23+ args : --all-features
24+
25+ # check_wasm:
26+ # name: Check wasm32
27+ # runs-on: ubuntu-latest
28+ # steps:
29+ # - uses: actions/checkout@v4
30+ # - uses: actions-rs/toolchain@v1
31+ # with:
32+ # profile: minimal
33+ # toolchain: stable
34+ # target: wasm32-unknown-unknown
35+ # override: true
36+ # - uses: actions-rs/cargo@v1
37+ # with:
38+ # command: check
39+ # args: --all-features --lib --target wasm32-unknown-unknown
40+
41+ # test:
42+ # name: Test Suite
43+ # runs-on: ubuntu-latest
44+ # steps:
45+ # - uses: actions/checkout@v4
46+ # - uses: actions-rs/toolchain@v1
47+ # with:
48+ # profile: minimal
49+ # toolchain: stable
50+ # override: true
51+ # - run: sudo apt-get install libxcb-render0-dev libxcb-shape0-dev libxcb-xfixes0-dev libxkbcommon-dev libssl-dev
52+ # - uses: actions-rs/cargo@v1
53+ # with:
54+ # command: test
55+ # args: --lib
56+
57+ # fmt:
58+ # name: Rustfmt
59+ # runs-on: ubuntu-latest
60+ # steps:
61+ # - uses: actions/checkout@v4
62+ # - uses: actions-rs/toolchain@v1
63+ # with:
64+ # profile: minimal
65+ # toolchain: stable
66+ # override: true
67+ # components: rustfmt
68+ # - uses: actions-rs/cargo@v1
69+ # with:
70+ # command: fmt
71+ # args: --all -- --check
72+
73+ clippy :
74+ name : Clippy
75+ runs-on : ubuntu-latest
76+ steps :
77+ - uses : actions/checkout@v4
78+ - uses : actions-rs/toolchain@v1
79+ with :
80+ profile : minimal
81+ toolchain : stable
82+ override : true
83+ components : clippy
84+ - uses : actions-rs/cargo@v1
85+ with :
86+ command : clippy
87+ # args: -- -D warnings
88+
89+ # trunk:
90+ # name: trunk
91+ # runs-on: ubuntu-latest
92+ # steps:
93+ # - uses: actions/checkout@v4
94+ # - uses: actions-rs/toolchain@v1
95+ # with:
96+ # profile: minimal
97+ # toolchain: 1.76.0
98+ # target: wasm32-unknown-unknown
99+ # override: true
100+ # - name: Download and install Trunk binary
101+ # run: wget -qO- https://github.com/thedodd/trunk/releases/latest/download/trunk-x86_64-unknown-linux-gnu.tar.gz | tar -xzf-
102+ # - name: Build
103+ # run: ./trunk build
104+
105+ build :
106+ runs-on : ${{ matrix.os }}
107+ strategy :
108+ fail-fast : false
109+ matrix : # can't afford this many platforms atm I think with gh actions
110+ include :
111+ - os : macos-latest
112+ TARGET : aarch64-apple-darwin
113+
114+ # I recommend building on a raspberry pi if you're going to use one and not this build.
115+ - os : ubuntu-latest
116+ TARGET : aarch64-unknown-linux-gnu
117+
118+ # s- os: ubuntu-latest
119+ # TARGET: armv7-unknown-linux-gnueabihf
120+
121+
122+ - os : ubuntu-latest
123+ TARGET : x86_64-unknown-linux-gnu
124+
125+ - os : ubuntu-latest
126+ TARGET : i686-unknown-linux-musl
127+
128+ - os : ubuntu-latest
129+ TARGET : x86_64-unknown-linux-musl
130+
131+ - os : windows-latest
132+ TARGET : x86_64-pc-windows-msvc
133+ EXTENSION : .exe
134+
135+ steps :
136+ - name : Building ${{ matrix.TARGET }}
137+ run : echo "${{ matrix.TARGET }}"
138+
139+ - uses : actions/checkout@master
140+ - name : Install build dependencies - Rustup
141+ run : |
142+ curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- --default-toolchain stable --profile default --target ${{ matrix.TARGET }} -y
143+ echo "$HOME/.cargo/bin" >> $GITHUB_PATH
144+
145+ # For linux, it's necessary to use cross from the git repository to avoid glibc problems
146+ # Ref: https://github.com/cross-rs/cross/issues/1510
147+ - name : Install cross for linux
148+ if : contains(matrix.TARGET, 'linux')
149+ run : |
150+ cargo install cross --git https://github.com/cross-rs/cross --rev 1b8cf50d20180c1a394099e608141480f934b7f7
151+
152+ - name : Install cross for mac and windows
153+ if : ${{ !contains(matrix.TARGET, 'linux') }}
154+ run : |
155+ cargo install cross
156+
157+ - name : Build
158+ run : |
159+ cross build --verbose --release --target=${{ matrix.TARGET }}
160+
161+ - name : Rename
162+ run : cp target/${{ matrix.TARGET }}/release/lrcsync${{ matrix.EXTENSION }} lrcsync-${{ matrix.TARGET }}${{ matrix.EXTENSION }}
163+
164+ - uses : actions/upload-artifact@master
165+ with :
166+ name : lrcsync-${{ matrix.TARGET }}${{ matrix.EXTENSION }}
167+ path : lrcsync-${{ matrix.TARGET }}${{ matrix.EXTENSION }}
168+
169+ # - uses: svenstaro/upload-release-action@v2
170+ # name: Upload binaries to release
171+ # if: ${{ github.event_name == 'push' }}
172+ # with:
173+ # repo_token: ${{ secrets.GITHUB_TOKEN }}
174+ # file: lrcsync-${{ matrix.TARGET }}${{ matrix.EXTENSION }}
175+ # asset_name: lrcsync-${{ matrix.TARGET }}${{ matrix.EXTENSION }}
176+ # tag: ${{ github.ref }}
177+ # prerelease: ${{ !startsWith(github.ref, 'refs/tags/') }}
178+ # overwrite: true
0 commit comments