-
Notifications
You must be signed in to change notification settings - Fork 0
62 lines (62 loc) · 2.17 KB
/
ci.yml
File metadata and controls
62 lines (62 loc) · 2.17 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
name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
permissions:
contents: read
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: dtolnay/rust-toolchain@stable
with:
components: clippy, rustfmt
- uses: Swatinem/rust-cache@v2
- run: cargo fmt --check
- run: cargo clippy -- -D warnings
lockfile:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Verify Cargo.lock matches Cargo.toml
run: |
TOML_VERSION=$(grep '^version' Cargo.toml | head -1 | sed 's/.*"\(.*\)"/\1/')
LOCK_VERSION=$(sed -n '/^name = "initium"/{n;s/^version = "\(.*\)"/\1/p;}' Cargo.lock)
if [ "$TOML_VERSION" != "$LOCK_VERSION" ]; then
echo "::error::Cargo.toml version ($TOML_VERSION) does not match Cargo.lock version ($LOCK_VERSION). Run 'cargo update --workspace' and commit Cargo.lock."
exit 1
fi
dprint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: dprint/check@v2.3
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- run: cargo test --all
helm-lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: azure/setup-helm@v4
- run: helm plugin install --verify=false https://github.com/helm-unittest/helm-unittest.git --version v0.5.1
- run: helm lint charts/initium
- run: helm template test-release charts/initium --set sampleDeployment.enabled=true --set 'initContainers[0].name=wait' --set 'initContainers[0].command[0]=wait-for' --set 'initContainers[0].args[0]=--target' --set 'initContainers[0].args[1]=tcp://localhost:5432'
- run: helm unittest charts/initium
ci:
if: always()
needs: [lint, test, helm-lint, dprint, lockfile]
runs-on: ubuntu-latest
steps:
- run: |
if [[ "${{ contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled') }}" == "true" ]]; then
echo "One or more jobs failed or were cancelled"
exit 1
fi