Skip to content

Commit 5333718

Browse files
mayastor-borstiagolobocastro
andcommitted
Merge #1793
1793: ci: switch from jenkins to github actions r=tiagolobocastro a=tiagolobocastro Jenkins has become troublesome to maintain and makes it harder for users to see and test output without adding new users. We could probably spend some time improving that, but the current Jenkins is also setup on systems managed by the sponsoring company so it makes sense to move away from that at least. In order to run the CI tests we need a relatively powerful CI system so we are making use of the ubuntu-latest-16-cores runners. The tests seem to run slower than on Jenkins. Part of it may be explained because the dependencies are not pre-cache and also the pre-requisites which take time to install. Signed-off-by: Tiago Castro <[email protected]> Co-authored-by: Tiago Castro <[email protected]>
2 parents 37f0fbe + 8e63745 commit 5333718

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+409
-120
lines changed

.github/bors.toml

Lines changed: 1 addition & 1 deletion
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/bdd.yml

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
name: BDD 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+
bdd-tests:
12+
runs-on: ubuntu-latest-16-cores
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+
- name: Build binaries
28+
run: nix-shell --run "cargo build --bins --features=io-engine-testing"
29+
- name: Setup Test Pre-Requisites
30+
run: |
31+
sudo sysctl -w vm.nr_hugepages=2560
32+
sudo apt-get install linux-modules-extra-$(uname -r)
33+
for module in nvme_tcp nbd nvme_rdma; do
34+
sudo modprobe $module
35+
done
36+
# for the coredump check
37+
sudo apt-get install gdb
38+
- name: Setup VENV
39+
run: nix-shell --run "./test/python/setup.sh"
40+
- name: Run BDD Tests
41+
run: |
42+
echo "TEST_START_DATE=$(date +"%Y-%m-%d %H:%M:%S")" >> $GITHUB_ENV
43+
nix-shell --run "./scripts/pytest-tests.sh"
44+
- name: Test Report
45+
if: always()
46+
uses: pmeier/pytest-results-action@main
47+
with:
48+
path: test/python/reports/**/xunit-report.xml
49+
summary: true
50+
display-options: a
51+
fail-on-empty: true
52+
title: Test results
53+
- name: Cleanup
54+
if: always()
55+
run: nix-shell --run "./scripts/pytest-tests.sh --clean-all-exit"
56+
- name: Check Coredumps
57+
run: sudo ./scripts/check-coredumps.sh --since "${TEST_START_DATE}"
58+
# debugging
59+
# - name: Setup tmate session
60+
# if: ${{ failure() }}
61+
# timeout-minutes: 240
62+
# uses: mxschmitt/action-tmate@v3

.github/workflows/image-pr.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
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

.github/workflows/image.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
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-test:
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

.github/workflows/lint.yml

Lines changed: 35 additions & 0 deletions
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+
code-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 "FMT_OPTS=--check ./scripts/rust-style.sh"
29+
nix-shell --run "./scripts/rust-linter.sh"
30+
- name: Lint JS code
31+
run: nix-shell --run "./scripts/js-check.sh"
32+
- name: Lint python code
33+
run: nix-shell --run "black --diff --check test/python"
34+
- name: Lint Nix code
35+
run: nix-shell --run "nixpkgs-fmt --check ."

.github/workflows/nightly-ci.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
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

.github/workflows/pr-ci.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
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+
int-ci:
13+
uses: ./.github/workflows/unit-int.yml
14+
bdd-ci:
15+
uses: ./.github/workflows/bdd.yml
16+
image-ci:
17+
uses: ./.github/workflows/image-pr.yml
18+
bors-ci:
19+
if: ${{ success() }}
20+
needs:
21+
- lint-ci
22+
- int-ci
23+
- bdd-ci
24+
- image-ci
25+
runs-on: ubuntu-latest
26+
steps:
27+
- name: CI succeeded
28+
run: exit 0

.github/workflows/unit-int.yml

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
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-16-cores
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 binaries
30+
run: nix-shell --run "cargo build --bins --features=io-engine-testing"
31+
- name: Setup Test Pre-Requisites
32+
run: |
33+
sudo sysctl -w vm.nr_hugepages=3584
34+
sudo apt-get install linux-modules-extra-$(uname -r)
35+
for module in nvme_tcp nbd nvme_rdma; do
36+
sudo modprobe $module
37+
done
38+
sudo apt-get install gdb
39+
- name: Run Rust Tests
40+
run: |
41+
echo "TEST_START_DATE=$(date +"%Y-%m-%d %H:%M:%S")" >> $GITHUB_ENV
42+
nix-shell --run "./scripts/cargo-test.sh"
43+
- name: Cleanup
44+
if: always()
45+
run: nix-shell --run "./scripts/clean-cargo-tests.sh"
46+
- name: Check Coredumps
47+
run: sudo ./scripts/check-coredumps.sh --since "${TEST_START_DATE}"
48+
- name: Run JS Grpc Tests
49+
run: |
50+
echo "TEST_START_DATE=$(date +"%Y-%m-%d %H:%M:%S")" >> $GITHUB_ENV
51+
nix-shell --run "./scripts/grpc-test.sh"
52+
mkdir js-reports
53+
for file in *-xunit-report.xml; do
54+
echo "<testsuites>" > "js-reports/$file"
55+
cat $file >> "js-reports/$file"
56+
echo "</testsuites>" >> "js-reports/$file"
57+
done
58+
- name: Test Report
59+
if: always()
60+
uses: pmeier/pytest-results-action@main
61+
with:
62+
path: 'js-reports/*-xunit-report.xml'
63+
summary: true
64+
display-options: a
65+
fail-on-empty: true
66+
title: Test results
67+
- name: Cleanup
68+
if: always()
69+
run: nix-shell --run "./scripts/clean-cargo-tests.sh"
70+
- name: Check Coredumps
71+
run: sudo ./scripts/check-coredumps.sh --since "${TEST_START_DATE}"
72+
# debugging
73+
# - name: Setup tmate session
74+
# if: ${{ failure() }}
75+
# timeout-minutes: 240
76+
# uses: mxschmitt/action-tmate@v3

io-engine-tests/src/lib.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,7 @@ pub fn mount_and_get_md5(device: &str) -> Result<String, String> {
342342
pub fn fio_run_verify(device: &str) -> Result<String, String> {
343343
let (exit, stdout, stderr) = run_script::run(
344344
r"
345-
fio --name=randrw --rw=randrw --ioengine=libaio --direct=1 --time_based=1 \
345+
$FIO --name=randrw --rw=randrw --ioengine=libaio --direct=1 --time_based=1 \
346346
--runtime=5 --bs=4k --verify=crc32 --group_reporting=1 --output-format=terse \
347347
--verify_fatal=1 --verify_async=2 --filename=$1
348348
",
@@ -511,11 +511,11 @@ pub async fn wait_for_rebuild(dst_uri: String, state: RebuildState, timeout: Dur
511511
pub fn fio_verify_size(device: &str, size: u64) -> i32 {
512512
let (exit, stdout, stderr) = run_script::run(
513513
r"
514-
fio --thread=1 --numjobs=1 --iodepth=16 --bs=512 \
514+
$FIO --thread=1 --numjobs=1 --iodepth=16 --bs=512 \
515515
--direct=1 --ioengine=libaio --rw=randwrite --verify=crc32 \
516516
--verify_fatal=1 --name=write_verify --filename=$1 --size=$2
517517
518-
fio --thread=1 --numjobs=1 --iodepth=16 --bs=512 \
518+
$FIO --thread=1 --numjobs=1 --iodepth=16 --bs=512 \
519519
--direct=1 --ioengine=libaio --verify=crc32 --verify_only \
520520
--verify_fatal=1 --name=verify --filename=$1
521521
",

io-engine/.cargo/runner.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
ARGS="${@}"
55

66
if [[ $EUID -ne 0 ]]; then
7-
MAYBE_SUDO='sudo -E'
7+
MAYBE_SUDO='sudo -E --preserve-env=PATH'
88
else
99
MAYBE_SUDO=''
1010
fi

0 commit comments

Comments
 (0)