-
Notifications
You must be signed in to change notification settings - Fork 13
75 lines (73 loc) · 3.09 KB
/
ci.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
name: CI
on:
pull_request:
branches:
- "**"
workflow_call: # Needed to make this a reusable workflow for releasing artifacts https://docs.github.com/en/actions/using-workflows/reusing-workflows
jobs:
CI:
strategy:
matrix:
architecture: [X64, ARM64]
distribution: [Ubuntu, AL2]
runs-on:
- self-hosted
- Linux
- ${{matrix.architecture}}
- ${{matrix.distribution}}
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@1.73.0
with:
components: rustfmt, clippy
- uses: Swatinem/rust-cache@v1
- name: Install gcc on Ubuntu
if: ${{ matrix.distribution == 'Ubuntu' }}
run: sudo apt install -y build-essential
- name: Install gcc on AL2
if: ${{ matrix.distribution == 'AL2' }}
run: sudo yum install -y "@Development Tools"
- name: Install NodeJs
run: |
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.3/install.sh | bash \
&& source ~/.nvm/nvm.sh && nvm install v16.16.0
- name: Install musl on Ubuntu
if: ${{ matrix.distribution == 'Ubuntu' }}
run: sudo apt-get install -y musl-tools
- name: Build & install musl on AL2
if: ${{ matrix.distribution == 'AL2' }}
run: |
wget https://git.musl-libc.org/cgit/musl/snapshot/musl-1.2.3.tar.gz \
&& tar xvf musl-1.2.3.tar.gz && cd musl-1.2.3 \
&& ./configure && sudo make install && cd .. && sudo rm -rf musl-1.2.3
- name: Symlink musl-gcc on ARM64 & Ubuntu
if: ${{ matrix.architecture == 'ARM64' && matrix.distribution == 'Ubuntu' }}
run: sudo ln -snf /usr/bin/musl-gcc /usr/bin/aarch64-linux-musl-gcc
- name: Symlink musl-gcc on AL2 & ARM64
if: ${{ matrix.architecture == 'ARM64' && matrix.distribution == 'AL2' }}
run: sudo ln -snf /usr/local/musl/bin/musl-gcc /usr/bin/aarch64-linux-musl-gcc
- name: Symlink musl-gcc on AL2 & X64
if: ${{ matrix.architecture == 'X64' && matrix.distribution == 'AL2' }}
run: sudo ln -snf /usr/local/musl/bin/musl-gcc /usr/bin/musl-gcc
- name: Build for X64
if: ${{ matrix.architecture == 'X64' }}
run: |
rustup target add x86_64-unknown-linux-musl \
&& source ~/.nvm/nvm.sh \
&& cargo build --release --target x86_64-unknown-linux-musl
- name: Build for ARM64
if: ${{ matrix.architecture == 'ARM64' }}
run: |
rustup target add aarch64-unknown-linux-musl \
&& source ~/.nvm/nvm.sh \
&& cargo build --release --target aarch64-unknown-linux-musl
- name: Set perf_event_paranoid to 0
run: echo 0 | sudo tee /proc/sys/kernel/perf_event_paranoid
- name: Run tests
run: source ~/.nvm/nvm.sh && cargo test --verbose -- --nocapture --color always
- name: Run clippy
run: source ~/.nvm/nvm.sh && cargo clippy --all-targets --all-features
- name: Run rustfmt
run: source ~/.nvm/nvm.sh && cargo fmt --all -- --check