Skip to content

Commit 39031ae

Browse files
author
mayastor-bors
committed
Try #594:
2 parents 776f7f0 + 016b50d commit 39031ae

12 files changed

+244
-23
lines changed

.github/bors.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
status = [ "continuous-integration/jenkins/branch" ]
1+
status = [ "bors-ci" ]
22
pr_status = [ "commitlint", "DCO" ]
33
timeout_sec = 10000
44
required_approvals = 2

.github/workflows/helm-chart.yml

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
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+
CI: 1
11+
12+
jobs:
13+
helm-chart-test:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@v4
17+
with:
18+
submodules: 'recursive'
19+
- uses: DeterminateSystems/nix-installer-action@v14
20+
- uses: DeterminateSystems/magic-nix-cache-action@v8
21+
- name: Pre-populate nix-shell
22+
run: |
23+
export NIX_PATH=nixpkgs=$(jq '.nixpkgs.url' nix/sources.json -r)
24+
echo "NIX_PATH=$NIX_PATH" >> $GITHUB_ENV
25+
nix-shell --run "echo" ./scripts/helm/shell.nix
26+
- name: HelmChart publish test
27+
run: |
28+
nix-shell --pure --run "./scripts/helm/test-publish-chart-yaml.sh" ./scripts/helm/shell.nix
29+
- name: HelmChart Readme
30+
run: nix-shell --run "./scripts/helm/generate-readme.sh" ./scripts/helm/shell.nix
31+
- name: HelmChart Template
32+
run: nix-shell --pure --run "./scripts/helm/test-template.sh" ./scripts/helm/shell.nix
33+

.github/workflows/image-pr.yml

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

.github/workflows/image.yml

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
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+
CI: 1
14+
15+
jobs:
16+
image-build-push:
17+
runs-on: ubuntu-latest
18+
steps:
19+
- uses: actions/checkout@v4
20+
with:
21+
submodules: 'recursive'
22+
- uses: DeterminateSystems/nix-installer-action@v14
23+
- uses: DeterminateSystems/magic-nix-cache-action@v8
24+
- name: Login to Docker Hub
25+
uses: docker/login-action@v3
26+
with:
27+
username: ${{ secrets.DOCKERHUB_USERNAME }}
28+
password: ${{ secrets.DOCKERHUB_TOKEN }}
29+
- name: Build and push the release images
30+
run: ./scripts/release.sh
31+

.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

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Linter CI
2+
on:
3+
workflow_call:
4+
5+
env:
6+
CARGO_TERM_COLOR: always
7+
CARGO_INCREMENTAL: 0
8+
CI: 1
9+
10+
jobs:
11+
linter:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v4
15+
with:
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+
- name: Lint rust code
27+
run: |
28+
nix-shell --run "./dependencies/control-plane/scripts/rust/generate-openapi-bindings.sh"
29+
nix-shell --run "./scripts/rust/linter.sh"
30+
- name: Lint python code
31+
run: nix-shell --run "black --diff --check tests/bdd"
32+
- name: Lint nix code
33+
run: nix-shell --run "nixpkgs-fmt --check ."
34+
- name: Check submodules
35+
run: nix-shell --run "./scripts/git/check-submodule-branches.sh"

.github/workflows/nightly-ci.yml

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
name: Nightly CI
2+
on:
3+
workflow_dispatch:
4+
5+
jobs:
6+
ci:
7+
uses: ./.github/workflows/pr-ci.yml
8+
nightly-ci:
9+
if: ${{ success() }}
10+
needs:
11+
- ci
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: CI succeeded
15+
run: exit 0
16+

.github/workflows/pr-ci.yml

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: Bors CI
2+
on:
3+
workflow_call:
4+
push:
5+
branches:
6+
- staging
7+
- trying
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
32+

.github/workflows/template-chart.yml

-22
This file was deleted.

.github/workflows/unit-int.yml

+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: Integration CI
2+
on:
3+
workflow_call:
4+
5+
env:
6+
CARGO_TERM_COLOR: always
7+
CARGO_INCREMENTAL: 0
8+
CI: 1
9+
10+
jobs:
11+
int-tests:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v4
15+
with:
16+
fetch-depth: 0
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" shell.nix
25+
- name: Handle Rust dependencies caching
26+
uses: Swatinem/rust-cache@v2
27+
with:
28+
save-if: ${{ startsWith(github.ref_name, 'release/') || github.ref_name == 'develop' }}
29+
- name: Build the binaries
30+
run: nix-shell --run "cargo build --bins"
31+
- name: Build the tests
32+
run: nix-shell --run "./scripts/rust/test.sh --no-run"
33+
- name: Run Tests
34+
run: |
35+
# includes both unit and integration tests
36+
nix-shell --run "./scripts/rust/test.sh"
37+
# debugging
38+
# - name: Setup tmate session
39+
# if: ${{ failure() }}
40+
# timeout-minutes: 120
41+
# uses: mxschmitt/action-tmate@v3
42+

scripts/rust/linter.sh

+1
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,4 @@ if [ -z "$OP" ] || [ "$OP" = "clippy" ]; then
2929
fi
3030

3131
exit ${FMT_ERROR:-0}
32+

scripts/rust/test.sh

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
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
29+

0 commit comments

Comments
 (0)