Skip to content

Add: Add check

Add: Add check #25

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 g++-aarch64-linux-gnu
cargo build --release --target aarch64-unknown-linux-gnu
cargo build --release --target x86_64-unknown-linux-gnu
mkdir ./tmp
cp target/x86_64-unknown-linux-gnu/release/sub-image ./tmp/amd64
cp target/aarch64-unknown-linux-gnu/release/sub-image ./tmp/arm64
- name: Build image
if: github.ref_name == 'main'
uses: ./.github/actions/build
with:
directory-name: sub-image