-
Notifications
You must be signed in to change notification settings - Fork 10
50 lines (45 loc) · 1.41 KB
/
sub-image-check.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
name: "[sub-image] Lint and build"
on:
push:
paths:
- "sub-image/**"
- ".github/workflows/sub-image-*.yml"
workflow_dispatch:
jobs:
lint:
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./sub-image
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Setup rust
run: |
rustup component add clippy
rustup target add x86_64-unknown-linux-gnu
rustup target add aarch64-unknown-linux-gnu
- name: Cache target
uses: Swatinem/rust-cache@v2
- name: Run check
run: |
cargo clippy
cargo fmt -- --check
cargo test
- name: Build binary
if: github.ref_name == 'main'
working-directory: .
run: |
sudo apt-get update
sudo apt-get install -y libssl-dev pkg-config
cargo build --release --target x86_64-unknown-linux-gnu
cargo build --release --target aarch64-unknown-linux-gnu
mkdir /tmp/sub-image/arm64 -p
mkdir /tmp/sub-image/amd64 -p
cp target/x86_64-unknown-linux-gnu/release/sub-image /tmp/sub-image/amd64/sub-image
cp target/aarch64-unknown-linux-gnu/release/sub-image /tmp/sub-image/arm64/sub-image
- name: Build image
if: github.ref_name == 'main'
uses: ./.github/actions/build
with:
directory-name: sub-image