Skip to content

Commit 4d68d2c

Browse files
authored
copy rust.yml from other project
1 parent e34fe6b commit 4d68d2c

1 file changed

Lines changed: 178 additions & 0 deletions

File tree

.github/workflows/rust.yml

Lines changed: 178 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,178 @@
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+
- os: ubuntu-latest
115+
TARGET: aarch64-unknown-linux-gnu
116+
117+
# - os: ubuntu-latest
118+
# TARGET: armv7-unknown-linux-gnueabihf
119+
120+
- os: ubuntu-latest
121+
TARGET: x86_64-unknown-linux-gnu
122+
123+
- os: windows-latest
124+
TARGET: x86_64-pc-windows-msvc
125+
EXTENSION: .exe
126+
127+
steps:
128+
- name: Building ${{ matrix.TARGET }}
129+
run: echo "${{ matrix.TARGET }}"
130+
131+
- uses: actions/checkout@master
132+
- name: Install build dependencies - Rustup
133+
run: |
134+
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- --default-toolchain stable --profile default --target ${{ matrix.TARGET }} -y
135+
echo "$HOME/.cargo/bin" >> $GITHUB_PATH
136+
137+
# For linux, it's necessary to use cross from the git repository to avoid glibc problems
138+
# Ref: https://github.com/cross-rs/cross/issues/1510
139+
- name: Install cross for linux
140+
if: contains(matrix.TARGET, 'linux')
141+
run: |
142+
cargo install cross --git https://github.com/cross-rs/cross --rev 1b8cf50d20180c1a394099e608141480f934b7f7
143+
144+
- name: Install cross for mac and windows
145+
if: ${{ !contains(matrix.TARGET, 'linux') }}
146+
run: |
147+
cargo install cross
148+
149+
#- name: Nuke bugged gcc version
150+
# if: ${{ contains(matrix.TARGET, 'linux') }}
151+
# run: |
152+
# sudo apt-get remove gcc-9 || echo No gcc 9 to remove
153+
# sudo apt-get remove gcc-10 || echo No gcc 10 to remove
154+
# echo Checking cc version
155+
# cc --version
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

Comments
 (0)