Fix: Add sudo #20
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |