-
Notifications
You must be signed in to change notification settings - Fork 0
136 lines (113 loc) · 4.58 KB
/
test.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
name: Test
on:
push:
branches: [master]
pull_request:
jobs:
check:
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
- name: cargo check
uses: actions-rs/cargo@844f36862e911db73fe0815f00a4a2602c279505 # v1.0.3
with:
command: check
args: --all-features
clippy:
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:
components: clippy
- name: cargo clippy
uses: actions-rs/cargo@844f36862e911db73fe0815f00a4a2602c279505 # v1.0.3
with:
command: clippy
args: --all-features
rustfmt:
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:
components: rustfmt
- name: cargo fmt
uses: actions-rs/cargo@844f36862e911db73fe0815f00a4a2602c279505 # v1.0.3
with:
command: fmt
args: --all --check
e2e:
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
- 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 x86_64-unknown-linux-gnu.2.17 --release
- 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