-
Notifications
You must be signed in to change notification settings - Fork 14
65 lines (63 loc) · 2.15 KB
/
test.yml
File metadata and controls
65 lines (63 loc) · 2.15 KB
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
on: [push, pull_request]
name: Test and Lint
jobs:
test:
name: Test
runs-on: ubuntu-22.04
strategy:
matrix:
target:
- x86_64-unknown-linux-musl
- aarch64-unknown-linux-musl
env:
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_MUSL_LINKER: aarch64-linux-gnu-gcc
steps:
- uses: actions/checkout@v3
- run: sudo apt-get update
- run: sudo apt-get install -y musl-tools busybox-static
- run: sudo apt-get install -y gcc-aarch64-linux-gnu
if: matrix.target == 'aarch64-unknown-linux-musl'
- run: rustup target add ${{ matrix.target }}
- uses: actions/cache@v3
with:
path: |
target/
~/.cargo/git/db/
~/.cargo/registry/cache/
~/.cargo/registry/index/
key: "${{ runner.os }}-cargo-${{ matrix.target }}-${{ hashFiles('**/Cargo.lock') }}"
- run: cargo build --release --all-features --target=${{ matrix.target }} --locked
- uses: actions/upload-artifact@v3
with:
name: musl-executable-${{ matrix.target }}
path: ./target/${{ matrix.target }}/release/magicpak
- run: cargo test --release --all-features --target=${{ matrix.target }}
if: matrix.target == 'x86_64-unknown-linux-musl' # TODO: test aarch64
fmt:
name: Rustfmt
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- run: cargo fmt --all -- --check
clippy:
name: Clippy
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- run: cargo clippy --all-features -- -D warnings
test_examples:
name: Test examples
runs-on: ubuntu-22.04
needs: test
steps:
- uses: actions/checkout@v3
- uses: actions/download-artifact@v3
with:
name: musl-executable-x86_64-unknown-linux-musl
- run: mkdir -p dist/amd64 && mv ./magicpak ./dist/amd64/magicpak
- uses: docker/setup-buildx-action@v2
- name: Build examples
run: docker buildx bake --set '*.cache-from=type=gha' --set '*.cache-to=type=gha,mode=max' --set 'base.platform=linux/amd64' example
env:
BIN_DIR: ./dist
VERSION: 1.4.0