Skip to content

Commit 96844d0

Browse files
ci: try using gha
Signed-off-by: Tiago Castro <[email protected]>
1 parent 204b91c commit 96844d0

File tree

11 files changed

+232
-4
lines changed

11 files changed

+232
-4
lines changed

.github/workflows/bdd.yml

+53
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: BDD CI
2+
on:
3+
workflow_call:
4+
5+
env:
6+
CARGO_TERM_COLOR: always
7+
CARGO_INCREMENTAL: 0
8+
9+
jobs:
10+
bdd-tests:
11+
runs-on: ubuntu-latest-16-cores
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+
- name: Build binaries
27+
run: nix-shell --run "cargo build --bins"
28+
- name: Setup Test Pre-Requisites
29+
run: |
30+
sudo sysctl -w vm.nr_hugepages=3072
31+
sudo apt-get install linux-modules-extra-$(uname -r)
32+
sudo modprobe nvme_tcp
33+
- name: Run BDD Tests
34+
run: |
35+
nix-shell --run "deployer start --image-pull-policy always -w 60s && deployer stop"
36+
nix-shell --run "./scripts/python/test.sh"
37+
- name: Cleanup
38+
if: always()
39+
run: nix-shell --run "./scripts/python/test-residue-cleanup.sh"
40+
- name: Surface failing tests
41+
if: always()
42+
uses: pmeier/pytest-results-action@main
43+
with:
44+
path: report.xml
45+
summary: true
46+
display-options: a
47+
fail-on-empty: true
48+
title: Test results
49+
# debugging
50+
- name: Setup tmate session
51+
if: ${{ failure() }}
52+
timeout-minutes: 120
53+
uses: mxschmitt/action-tmate@v3

.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/lint.yml

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
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+
rust-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: nix-shell --run "./scripts/rust/linter.sh"

.github/workflows/nightly-ci.yml

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

.github/workflows/pr-ci.yml

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

+50
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
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-16-cores
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 rust 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: Setup Test Pre-Requisites
33+
run: |
34+
sudo sysctl -w vm.nr_hugepages=1536
35+
sudo apt-get install linux-modules-extra-$(uname -r)
36+
sudo modprobe nvme_tcp
37+
- name: Run Tests
38+
run: |
39+
# pre-pull the required container images
40+
deployer start --image-pull-policy always -w 60s && deployer stop
41+
# includes both unit and integration tests
42+
nix-shell --run "./scripts/rust/test.sh"
43+
- name: Cleanup
44+
if: always()
45+
run: nix-shell --run "./scripts/rust/deployer-cleanup.sh"
46+
# debugging
47+
- name: Setup tmate session
48+
if: ${{ failure() }}
49+
timeout-minutes: 120
50+
uses: mxschmitt/action-tmate@v3

control-plane/agents/src/bin/core/tests/controller/mod.rs

+1
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ async fn store_lease_lock() {
8181
.await
8282
.unwrap();
8383

84+
tokio::time::sleep(std::time::Duration::from_secs(1)).await;
8485
let lease_ttl = std::time::Duration::from_secs(2);
8586
let _core_agent = Etcd::new_leased(
8687
["0.0.0.0:2379"],

scripts/rust/test.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ cleanup_handler() {
2727
}
2828

2929
cleanup_handler >/dev/null
30-
trap cleanup_handler INT QUIT TERM HUP EXIT
30+
#trap cleanup_handler INT QUIT TERM HUP EXIT
3131

3232
set -euxo pipefail
3333

shell.nix

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ mkShell {
4040
pre-commit
4141
python3
4242
utillinux
43-
rdma-core
4443
which
4544
paperclip
4645
] ++ pkgs.lib.optional (!norust) rust
@@ -54,6 +53,7 @@ mkShell {
5453
tini
5554
udev
5655
lvm2
56+
rdma-core
5757
] ++ pkgs.lib.optional (system == "aarch64-darwin") darwin.apple_sdk.frameworks.Security;
5858

5959
LIBCLANG_PATH = "${llvmPackages.libclang.lib}/lib";

tests/bdd/features/health_probes/test_readiness_probe.py

+5-2
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,18 @@
1515

1616
def ready_http_get(context_msg_prefix: str):
1717
try:
18-
response = requests.get("http://localhost:8081/ready", timeout=(0.003, 0.010))
18+
response = requests.get("http://localhost:8081/ready", timeout=(0.1, 0.1))
1919
logger.info(
2020
f"{context_msg_prefix}: response.status_code: {response.status_code}"
2121
)
2222
return response
23-
except requests.exceptions.Timeout:
23+
except requests.exceptions.Timeout as e:
2424
logger.error(f"{context_msg_prefix}: the request timed out")
25+
raise e
26+
2527
except requests.exceptions.RequestException as e:
2628
logger.error(f"{context_msg_prefix}: an error occurred: {e}")
29+
raise e
2730

2831

2932
@pytest.fixture(scope="module")

0 commit comments

Comments
 (0)