Skip to content

Commit f873ad6

Browse files
ci: try using gha
Signed-off-by: Tiago Castro <[email protected]>
1 parent 776f7f0 commit f873ad6

File tree

10 files changed

+231
-22
lines changed

10 files changed

+231
-22
lines changed

.github/workflows/helm-chart.yml

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: Helm Chart CI
2+
on:
3+
workflow_call:
4+
pull_request:
5+
types: ['opened', 'edited', 'reopened', 'synchronize']
6+
7+
env:
8+
CARGO_TERM_COLOR: always
9+
CARGO_INCREMENTAL: 0
10+
11+
jobs:
12+
helm-chart-test:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v4
16+
with:
17+
submodules: 'recursive'
18+
- uses: DeterminateSystems/nix-installer-action@v14
19+
- uses: DeterminateSystems/magic-nix-cache-action@v8
20+
- name: Pre-populate nix-shell
21+
run: |
22+
export NIX_PATH=nixpkgs=$(jq '.nixpkgs.url' nix/sources.json -r)
23+
echo "NIX_PATH=$NIX_PATH" >> $GITHUB_ENV
24+
nix-shell --run "echo" ./scripts/helm/shell.nix
25+
- name: HelmChart publish test
26+
run: |
27+
nix-shell --pure --run "./scripts/helm/test-publish-chart-yaml.sh" ./scripts/helm/shell.nix
28+
- name: HelmChart Readme
29+
run: nix-shell --run "./scripts/helm/generate-readme.sh" ./scripts/helm/shell.nix
30+
- name: HelmChart Template
31+
run: nix-shell --pure --run "./scripts/helm/test-template.sh" ./scripts/helm/shell.nix

.github/workflows/image-pr.yml

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: ImageBuild CI
2+
on:
3+
workflow_call:
4+
5+
env:
6+
CARGO_TERM_COLOR: always
7+
CARGO_INCREMENTAL: 0
8+
9+
jobs:
10+
image-build-test:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v4
14+
with:
15+
submodules: 'recursive'
16+
- uses: DeterminateSystems/nix-installer-action@v14
17+
- uses: DeterminateSystems/magic-nix-cache-action@v8
18+
- name: Test building the release images
19+
run: ./scripts/release.sh --skip-publish --build-bins

.github/workflows/image.yml

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: Image Push
2+
on:
3+
push:
4+
branches:
5+
- develop
6+
- 'release/**'
7+
tags:
8+
- 'v[0-9]+.[0-9]+.[0-9]+**'
9+
10+
env:
11+
CARGO_TERM_COLOR: always
12+
CARGO_INCREMENTAL: 0
13+
14+
jobs:
15+
image-build-test:
16+
runs-on: ubuntu-latest
17+
steps:
18+
- uses: actions/checkout@v4
19+
with:
20+
submodules: 'recursive'
21+
- uses: DeterminateSystems/nix-installer-action@v14
22+
- uses: DeterminateSystems/magic-nix-cache-action@v8
23+
- name: Test building the release images
24+
run: ./scripts/release.sh

.github/workflows/k8s-ci.yml

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ name: K8s CI
22
on:
33
pull_request:
44
types: ['opened', 'edited', 'reopened', 'synchronize']
5+
workflow_call:
56

67
jobs:
78
k8s-ci:

.github/workflows/lint.yml

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: Unit/Int CI
2+
on:
3+
workflow_call:
4+
5+
env:
6+
CARGO_TERM_COLOR: always
7+
CARGO_INCREMENTAL: 0
8+
9+
jobs:
10+
linter:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v4
14+
with:
15+
submodules: 'recursive'
16+
- uses: DeterminateSystems/nix-installer-action@v14
17+
- uses: DeterminateSystems/magic-nix-cache-action@v8
18+
- name: Pre-populate nix-shell
19+
run: |
20+
export NIX_PATH=nixpkgs=$(jq '.nixpkgs.url' nix/sources.json -r)
21+
echo "NIX_PATH=$NIX_PATH" >> $GITHUB_ENV
22+
nix-shell --run "echo" shell.nix
23+
- name: Handle Rust dependencies caching
24+
uses: Swatinem/rust-cache@v2
25+
- name: Lint rust code
26+
run: |
27+
nix-shell --run "./dependencies/control-plane/scripts/rust/generate-openapi-bindings.sh"
28+
nix-shell --run "./scripts/rust/linter.sh"
29+
- name: Check submodules
30+
run: nix-shell --run "./scripts/git/check-submodule-branches.sh"

.github/workflows/nightly-ci.yml

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: Nightly CI
2+
on:
3+
workflow_dispatch:
4+
5+
jobs:
6+
lint-ci:
7+
uses: ./.github/workflows/lint.yml
8+
helm-ci:
9+
uses: ./.github/workflows/helm-chart.yml
10+
int-ci:
11+
uses: ./.github/workflows/unit-int.yml
12+
image-ci:
13+
uses: ./.github/workflows/image-pr.yml
14+
k8s-ci:
15+
uses: ./.github/workflows/k8s-ci.yml
16+
bors-ci:
17+
if: ${{ success() }}
18+
needs:
19+
- lint-ci
20+
- helm-ci
21+
- int-ci
22+
- image-ci
23+
- k8s-ci
24+
runs-on: ubuntu-latest
25+
steps:
26+
- name: CI succeeded
27+
run: exit 0

.github/workflows/pr-ci.yml

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: Bors CI
2+
on:
3+
push:
4+
branches:
5+
- staging
6+
- trying
7+
- ci
8+
9+
jobs:
10+
lint-ci:
11+
uses: ./.github/workflows/lint.yml
12+
helm-ci:
13+
uses: ./.github/workflows/helm-chart.yml
14+
int-ci:
15+
uses: ./.github/workflows/unit-int.yml
16+
image-ci:
17+
uses: ./.github/workflows/image-pr.yml
18+
k8s-ci:
19+
uses: ./.github/workflows/k8s-ci.yml
20+
bors-ci:
21+
if: ${{ success() }}
22+
needs:
23+
- lint-ci
24+
- helm-ci
25+
- int-ci
26+
- image-ci
27+
- k8s-ci
28+
runs-on: ubuntu-latest
29+
steps:
30+
- name: CI succeeded
31+
run: exit 0

.github/workflows/template-chart.yml

-22
This file was deleted.

.github/workflows/unit-int.yml

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: Integration CI
2+
on:
3+
workflow_call:
4+
5+
env:
6+
CARGO_TERM_COLOR: always
7+
CARGO_INCREMENTAL: 0
8+
9+
jobs:
10+
int-tests:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v4
14+
with:
15+
fetch-depth: 0
16+
submodules: 'recursive'
17+
- uses: DeterminateSystems/nix-installer-action@v14
18+
- uses: DeterminateSystems/magic-nix-cache-action@v8
19+
- name: Pre-populate nix-shell
20+
run: |
21+
export NIX_PATH=nixpkgs=$(jq '.nixpkgs.url' nix/sources.json -r)
22+
echo "NIX_PATH=$NIX_PATH" >> $GITHUB_ENV
23+
nix-shell --run "echo" shell.nix
24+
- name: Handle Rust dependencies caching
25+
uses: Swatinem/rust-cache@v2
26+
with:
27+
save-if: ${{ startsWith(github.ref_name, 'release/') || github.ref_name == 'develop' || github.ref_name == 'ci' }}
28+
- name: Build the binaries
29+
run: nix-shell --run "cargo build --bins"
30+
- name: Build the tests
31+
run: nix-shell --run "./scripts/rust/test.sh --no-run"
32+
- name: Run Tests
33+
run: |
34+
# includes both unit and integration tests
35+
nix-shell --run "./scripts/rust/test.sh"
36+
# debugging
37+
# - name: Setup tmate session
38+
# if: ${{ failure() }}
39+
# timeout-minutes: 120
40+
# uses: mxschmitt/action-tmate@v3

scripts/rust/test.sh

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#!/usr/bin/env bash
2+
3+
SCRIPT_DIR="$(dirname "$0")"
4+
5+
ARGS=""
6+
OPTS=""
7+
DO_ARGS=
8+
while [ "$#" -gt 0 ]; do
9+
case $1 in
10+
--)
11+
DO_ARGS="y"
12+
shift;;
13+
*)
14+
if [ "$DO_ARGS" == "y" ]; then
15+
ARGS="$ARGS $1"
16+
else
17+
OPTS="$OPTS $1"
18+
fi
19+
shift;;
20+
esac
21+
done
22+
23+
set -euxo pipefail
24+
25+
# build test dependencies
26+
cargo build --bins
27+
28+
cargo test ${OPTS} -- ${ARGS} --test-threads=1

0 commit comments

Comments
 (0)