-
Notifications
You must be signed in to change notification settings - Fork 0
95 lines (86 loc) · 3.6 KB
/
Copy pathci.yml
File metadata and controls
95 lines (86 loc) · 3.6 KB
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
name: CI
on:
pull_request:
push:
branches: [main]
permissions:
contents: read
env:
CARGO_TERM_COLOR: always
TOFU_VERSION: 1.11.5
jobs:
rust:
runs-on: ubuntu-24.04
timeout-minutes: 30
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
with:
persist-credentials: false
- uses: cachix/install-nix-action@630ae543ea3a38a9a4166f03376c02c50f408342
- name: Install pinned OpenTofu
run: |
curl --fail --location --silent --show-error \
--output tofu.zip \
"https://github.com/opentofu/opentofu/releases/download/v${TOFU_VERSION}/tofu_${TOFU_VERSION}_linux_amd64.zip"
curl --fail --location --silent --show-error \
--output SHA256SUMS \
"https://github.com/opentofu/opentofu/releases/download/v${TOFU_VERSION}/tofu_${TOFU_VERSION}_SHA256SUMS"
expected="$(awk -v file="tofu_${TOFU_VERSION}_linux_amd64.zip" '$2 == file { print $1 }' SHA256SUMS)"
test -n "$expected"
test "$(sha256sum tofu.zip | cut -d ' ' -f 1)" = "$expected"
unzip -q tofu.zip -d "$RUNNER_TEMP/tofu"
echo "$RUNNER_TEMP/tofu" >> "$GITHUB_PATH"
- run: cargo fmt --all -- --check
- run: cargo clippy --workspace --all-targets --locked -- -D warnings
- run: cargo test --workspace --locked
- name: Smoke packaged binary
run: |
nix flake check
nix build .#yaffle
file result/bin/yaffle | grep -Eq "static(-pie|ally) linked"
version="$(nix eval .#yaffle.version --raw)"
mkdir -p dist/package
cp result/bin/yaffle README.md LICENSE dist/package/
tar -C dist/package -czf dist/yaffle-smoke.tar.gz yaffle README.md LICENSE
mkdir dist/extracted
tar -C dist/extracted -xzf dist/yaffle-smoke.tar.gz
test "$(cd dist/extracted && PATH=/usr/bin:/bin ./yaffle --version)" = "yaffle $version"
cd dist/extracted
PATH=/usr/bin:/bin ./yaffle --help >/dev/null
opentofu-compatibility:
runs-on: ubuntu-24.04
timeout-minutes: 30
strategy:
matrix:
tofu-version: [1.8.8, 1.11.5]
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
with:
persist-credentials: false
- name: Install OpenTofu ${{ matrix.tofu-version }}
env:
TOFU_VERSION: ${{ matrix.tofu-version }}
run: |
curl --fail --location --silent --show-error \
--output tofu.zip \
"https://github.com/opentofu/opentofu/releases/download/v${TOFU_VERSION}/tofu_${TOFU_VERSION}_linux_amd64.zip"
curl --fail --location --silent --show-error \
--output SHA256SUMS \
"https://github.com/opentofu/opentofu/releases/download/v${TOFU_VERSION}/tofu_${TOFU_VERSION}_SHA256SUMS"
expected="$(awk -v file="tofu_${TOFU_VERSION}_linux_amd64.zip" '$2 == file { print $1 }' SHA256SUMS)"
test -n "$expected"
test "$(sha256sum tofu.zip | cut -d ' ' -f 1)" = "$expected"
unzip -q tofu.zip -d "$RUNNER_TEMP/tofu"
echo "$RUNNER_TEMP/tofu" >> "$GITHUB_PATH"
- run: cargo test -p yaffle-tofu --locked
- run: cargo test -p yaffle-engine --test fixture-repos --locked
dependencies:
runs-on: ubuntu-24.04
timeout-minutes: 20
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
with:
persist-credentials: false
- run: cargo tree --workspace --locked --duplicates
- run: cargo install cargo-audit --locked
- run: cargo audit --deny warnings