Merge pull request #294 from takonomura/renovate/libc-0.x-lockfile #604
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: Test | |
on: | |
push: | |
branches: [master] | |
pull_request: | |
jobs: | |
check: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
- name: Setup Rust | |
run: rustup show | |
- name: cargo check | |
run: cargo check --all-features | |
clippy: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
- name: Setup Rust | |
run: rustup show | |
- name: cargo clippy | |
run: cargo clippy --all-features | |
rustfmt: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
- name: Setup Rust | |
run: rustup show | |
- name: cargo fmt | |
run: cargo fmt --all --check | |
e2e: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
- name: Setup Rust | |
run: rustup show | |
- name: Setup Zig | |
uses: goto-bus-stop/setup-zig@abea47f85e598557f500fa1fd2ab7464fcb39406 # v2.2.1 | |
with: | |
version: 0.13.0 # renovate: zig-version | |
- name: Install cargo-zigbuild | |
run: | | |
CARGO_ZIGBUILD_VERSION=v0.19.4 | |
curl -sSLO "https://github.com/rust-cross/cargo-zigbuild/releases/download/${CARGO_ZIGBUILD_VERSION}/cargo-zigbuild-${CARGO_ZIGBUILD_VERSION}.x86_64-unknown-linux-musl.tar.gz" | |
tar xf "cargo-zigbuild-${CARGO_ZIGBUILD_VERSION}.x86_64-unknown-linux-musl.tar.gz" cargo-zigbuild | |
mv cargo-zigbuild /usr/local/bin/ | |
rm "cargo-zigbuild-${CARGO_ZIGBUILD_VERSION}.x86_64-unknown-linux-musl.tar.gz" | |
- name: Build | |
run: cargo zigbuild --target x86_64-unknown-linux-gnu.2.17 --release | |
- name: Test | |
run: | | |
./test.sh | |
aarch64: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
- name: Setup Rust | |
run: rustup show | |
- name: Setup Zig | |
uses: goto-bus-stop/setup-zig@abea47f85e598557f500fa1fd2ab7464fcb39406 # v2.2.1 | |
with: | |
version: 0.13.0 # renovate: zig-version | |
- name: Install cargo-zigbuild | |
run: | | |
CARGO_ZIGBUILD_VERSION=v0.19.4 | |
curl -sSLO "https://github.com/rust-cross/cargo-zigbuild/releases/download/${CARGO_ZIGBUILD_VERSION}/cargo-zigbuild-${CARGO_ZIGBUILD_VERSION}.x86_64-unknown-linux-musl.tar.gz" | |
tar xf "cargo-zigbuild-${CARGO_ZIGBUILD_VERSION}.x86_64-unknown-linux-musl.tar.gz" cargo-zigbuild | |
mv cargo-zigbuild /usr/local/bin/ | |
rm "cargo-zigbuild-${CARGO_ZIGBUILD_VERSION}.x86_64-unknown-linux-musl.tar.gz" | |
- name: Build | |
run: cargo zigbuild --target aarch64-unknown-linux-gnu.2.17 --release | |
- name: Setup QEMU | |
uses: docker/setup-qemu-action@49b3bc8e6bdd4a60e6116a5414239cba5943d3cf # v3.2.0 | |
with: | |
platforms: arm64 | |
- name: Test | |
run: | | |
expected="testuser1:*:2001:2001::/home/testuser:/bin/bash" | |
result="$(docker run --rm \ | |
--volume "$PWD/examples/passwd.json":/etc/passwd.json:ro \ | |
--volume "$PWD/target/aarch64-unknown-linux-gnu/release/libnss_jsonfile.so":/lib/aarch64-linux-gnu/libnss_jsonfile.so.2:ro \ | |
--platform linux/arm64 \ | |
docker.io/library/debian:buster \ | |
getent -s jsonfile passwd testuser1)" | |
echo "expected: $expected" | |
echo " got: $result" | |
[ "$result" = "$expected" ] || exit 1 |