Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: takonomura/nss-jsonfile
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v0.2.0
Choose a base ref
...
head repository: takonomura/nss-jsonfile
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref
Loading
Showing with 127 additions and 105 deletions.
  1. +17 −11 .github/workflows/release.yaml
  2. +58 −31 .github/workflows/test.yaml
  3. +37 −55 Cargo.lock
  4. +5 −5 Cargo.toml
  5. +6 −2 renovate.json
  6. +0 −1 rust-toolchain
  7. +4 −0 rust-toolchain.toml
28 changes: 17 additions & 11 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -9,32 +9,38 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2

- name: Setup Rust
uses: actions-rs/toolchain@16499b5e05bf2e26879000db0c1d13f7e13fa3af # v1.0.7
run: rustup show

- name: Setup Zig
uses: goto-bus-stop/setup-zig@869a4299cf8ac7db4ebffaec36ad82a682f88acb # v2.0.1
uses: goto-bus-stop/setup-zig@abea47f85e598557f500fa1fd2ab7464fcb39406 # v2.2.1
with:
version: 0.10.1 # renovate: zig-version
version: 0.13.0 # renovate: zig-version

- name: Install cargo-zigbuild
run: |
CARGO_ZIGBUILD_VERSION=v0.16.2
CARGO_ZIGBUILD_VERSION=v0.19.8
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 x86_64-unknown-linux-gnu.2.17 --release
run: cargo zigbuild --target x86_64-unknown-linux-gnu.2.17 --release

- name: Build (aarch64)
run: cargo zigbuild --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
uses: softprops/action-gh-release@c95fe1489396fe8a9eb87c0abf8aa5b2ef267fda # v2.2.1
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
89 changes: 58 additions & 31 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -10,79 +10,106 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2

- name: Setup Rust
uses: actions-rs/toolchain@16499b5e05bf2e26879000db0c1d13f7e13fa3af # v1.0.7
run: rustup show

- name: cargo check
uses: actions-rs/cargo@844f36862e911db73fe0815f00a4a2602c279505 # v1.0.3
with:
command: check
args: --all-features
run: cargo check --all-features

clippy:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2

- name: Setup Rust
uses: actions-rs/toolchain@16499b5e05bf2e26879000db0c1d13f7e13fa3af # v1.0.7
with:
components: clippy
run: rustup show

- name: cargo clippy
uses: actions-rs/cargo@844f36862e911db73fe0815f00a4a2602c279505 # v1.0.3
with:
command: clippy
args: --all-features
run: cargo clippy --all-features

rustfmt:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2

- name: Setup Rust
uses: actions-rs/toolchain@16499b5e05bf2e26879000db0c1d13f7e13fa3af # v1.0.7
with:
components: rustfmt
run: rustup show

- name: cargo fmt
uses: actions-rs/cargo@844f36862e911db73fe0815f00a4a2602c279505 # v1.0.3
with:
command: fmt
args: --all --check
run: cargo fmt --all --check

e2e:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2

- name: Setup Rust
uses: actions-rs/toolchain@16499b5e05bf2e26879000db0c1d13f7e13fa3af # v1.0.7
run: rustup show

- name: Setup Zig
uses: goto-bus-stop/setup-zig@869a4299cf8ac7db4ebffaec36ad82a682f88acb # v2.0.1
uses: goto-bus-stop/setup-zig@abea47f85e598557f500fa1fd2ab7464fcb39406 # v2.2.1
with:
version: 0.10.1 # renovate: zig-version
version: 0.13.0 # renovate: zig-version

- name: Install cargo-zigbuild
run: |
CARGO_ZIGBUILD_VERSION=v0.16.2
CARGO_ZIGBUILD_VERSION=v0.19.8
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 x86_64-unknown-linux-gnu.2.17 --release
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.8
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@29109295f81e9208d7d86ff1c6c12d2833863392 # v3.6.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
92 changes: 37 additions & 55 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "nss-jsonfile"
version = "0.2.0"
version = "0.3.0"
authors = ["takonomura"]
edition = "2021"
repository = "https://github.com/takonomura/nss-jsonfile"
@@ -12,9 +12,9 @@ crate-type = ["cdylib"]

[dependencies]
lazy_static = "1.4.0"
libc = "0.2.139"
libc = "0.2.154"
# Use master branch to use initgroups features
libnss = { git = "https://github.com/csnewman/libnss-rs" }
paste = "1.0.12"
serde = { version = "1.0.152", features = ["derive"] }
serde_json = "1.0.94"
paste = "1.0.14"
serde = { version = "1.0.200", features = ["derive"] }
serde_json = "1.0.116"
Loading