Skip to content

Commit

Permalink
Merge pull request #115 from takonomura/aarch64
Browse files Browse the repository at this point in the history
Add support for aarch64
  • Loading branch information
takonomura authored Aug 8, 2023
2 parents c98bab2 + 553e5db commit 214b087
Show file tree
Hide file tree
Showing 2 changed files with 63 additions and 1 deletion.
16 changes: 15 additions & 1 deletion .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ jobs:

- name: Setup Rust
uses: actions-rs/toolchain@16499b5e05bf2e26879000db0c1d13f7e13fa3af # v1.0.7
with:
target: aarch64-unknown-linux-gnu

- name: Setup Zig
uses: goto-bus-stop/setup-zig@6fede2f0550d71291c0accf2834b216e69a2d67a # v2.1.1
Expand All @@ -33,8 +35,20 @@ jobs:
command: zigbuild
args: --target x86_64-unknown-linux-gnu.2.17 --release

- name: Build (aarch64)
uses: actions-rs/cargo@844f36862e911db73fe0815f00a4a2602c279505 # v1.0.3
with:
command: zigbuild
args: --target aarch64-unknown-linux-gnu.2.17 --release

- name: Rename aarch64 artifact
run: |
mv target/aarch64-unknown-linux-gnu/release/libnss_jsonfile{,-aarch64}.so
- name: Release
uses: softprops/action-gh-release@de2c0eb89ae2a093876385947365aca7b0e5f844 # v0.1.15
if: startsWith(github.ref, 'refs/tags/')
with:
files: target/x86_64-unknown-linux-gnu/release/libnss_jsonfile.so
files: |
target/x86_64-unknown-linux-gnu/release/libnss_jsonfile.so
target/aarch64-unknown-linux-gnu/release/libnss_jsonfile-aarch64.so
48 changes: 48 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -86,3 +86,51 @@ jobs:
- name: Test
run: |
./test.sh
aarch64:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3

- name: Setup Rust
uses: actions-rs/toolchain@16499b5e05bf2e26879000db0c1d13f7e13fa3af # v1.0.7
with:
target: aarch64-unknown-linux-gnu

- name: Setup Zig
uses: goto-bus-stop/setup-zig@6fede2f0550d71291c0accf2834b216e69a2d67a # v2.1.1
with:
version: 0.11.0 # renovate: zig-version

- name: Install cargo-zigbuild
run: |
CARGO_ZIGBUILD_VERSION=v0.17.0
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
uses: actions-rs/cargo@844f36862e911db73fe0815f00a4a2602c279505 # v1.0.3
with:
command: zigbuild
args: --target aarch64-unknown-linux-gnu.2.17 --release

- name: Setup QEMU
uses: docker/setup-qemu-action@2b82ce82d56a2a04d2637cd93a637ae1b359c0a7 # v2.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

0 comments on commit 214b087

Please sign in to comment.