-
Notifications
You must be signed in to change notification settings - Fork 1
121 lines (113 loc) · 3.77 KB
/
Copy pathci.yml
File metadata and controls
121 lines (113 loc) · 3.77 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
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
name: CI
on:
push:
branches: [master]
pull_request:
permissions:
contents: read
env:
CARGO_TERM_COLOR: always
RUST_TOOLCHAIN: "1.97.0"
K3D_VERSION: v5.9.0
TEST_IMAGES: >-
ghcr.io/openprojectx/dockerhub/rustfs/rustfs:1.0.0-beta.8
ghcr.io/openprojectx/dockerhub/rancher/k3s:v1.34.9-k3s1
K3S_SYSTEM_IMAGES: >-
docker.io/rancher/mirrored-pause:3.6
docker.io/rancher/mirrored-coredns-coredns:1.14.4
docker.io/rancher/local-path-provisioner:v0.0.36
jobs:
lint-and-unit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Cache rust toolchain
uses: actions/cache@v4
with:
path: ~/.rustup/toolchains
key: rustup-${{ runner.os }}-1.97.0
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: "1.97.0"
components: rustfmt, clippy
- uses: Swatinem/rust-cache@v2
- name: Format
run: cargo fmt --check
- name: Clippy
run: cargo clippy --all-targets --features integration,e2e -- -D warnings
- name: Unit tests
run: cargo test
chart-tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Chart lint, render and validation tests
run: bash scripts/chart-tests.sh
container-tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Cache rust toolchain
uses: actions/cache@v4
with:
path: ~/.rustup/toolchains
key: rustup-${{ runner.os }}-1.97.0
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: "1.97.0"
- uses: Swatinem/rust-cache@v2
- uses: ./.github/actions/cached-images
with:
images: ${{ env.TEST_IMAGES }}
cache-key: test-images-rustfs-beta8-k3s-1.34.9
- name: Integration tests (RustFS container)
run: cargo test --features integration --test integration_rustfs
- name: E2E tests (k3s + RustFS containers)
run: cargo test --features e2e --test e2e_k3s
# Validates the Dockerfile and seeds the buildx GHA cache on the default
# branch, so tag-triggered release builds can restore it (Actions cache is
# isolated per ref except for the default branch).
image-build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: docker/setup-buildx-action@v3
- uses: docker/build-push-action@v6
with:
context: .
push: false
cache-from: type=gha
cache-to: type=gha,mode=max
# Real Helm flow against a k3d cluster: CRDs chart, operator chart with a
# values-bootstrapped ClusterConnection, resources chart, convergence and
# finalizer cleanup — using the image built from this commit.
chart-e2e:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: docker/setup-buildx-action@v3
- name: Build operator image
uses: docker/build-push-action@v6
with:
context: .
load: true
tags: rustfs-operator:ci
cache-from: type=gha
- name: Cache k3d binary
id: k3d-cache
uses: actions/cache@v4
with:
path: ~/.local/bin/k3d
key: k3d-${{ env.K3D_VERSION }}-linux-amd64
- name: Install k3d (cache miss)
if: steps.k3d-cache.outputs.cache-hit != 'true'
run: |
mkdir -p ~/.local/bin
curl -fsSL "https://github.com/k3d-io/k3d/releases/download/${K3D_VERSION}/k3d-linux-amd64" -o ~/.local/bin/k3d
chmod +x ~/.local/bin/k3d
- uses: ./.github/actions/cached-images
with:
images: ${{ env.TEST_IMAGES }} ${{ env.K3S_SYSTEM_IMAGES }}
cache-key: chart-e2e-images-v1
- name: Run chart e2e
run: IMAGE=rustfs-operator:ci bash scripts/chart-e2e.sh