Skip to content

Commit

Permalink
ci: switch from jenkins to github actions
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
tiagolobocastro committed Jan 2, 2025
1 parent 204b91c commit e8fc7df
Show file tree
Hide file tree
Showing 29 changed files with 1,813 additions and 55 deletions.
1 change: 0 additions & 1 deletion .github/auto_assign.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ addAssignees: false
reviewers:
- tiagolobocastro
- Abhinandan-Purkait
- chriswldenyer

# A list of keywords to be skipped the process that add reviewers if pull requests include it
skipKeywords:
Expand Down
68 changes: 68 additions & 0 deletions .github/workflows/bdd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
name: BDD CI
on:
workflow_call:
# push:
# branches:
# - ci

env:
CARGO_TERM_COLOR: always
CARGO_INCREMENTAL: 0
CI: 1

jobs:
bdd-tests:
runs-on: ubuntu-latest-16-cores
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: 'recursive'
- uses: DeterminateSystems/nix-installer-action@v14
- uses: DeterminateSystems/magic-nix-cache-action@v8
- name: Pre-populate nix-shell
run: |
export NIX_PATH=nixpkgs=$(jq '.nixpkgs.url' nix/sources.json -r)
echo "NIX_PATH=$NIX_PATH" >> $GITHUB_ENV
nix-shell --run "echo" shell.nix
- name: Handle Rust dependencies caching
uses: Swatinem/rust-cache@v2
- name: Build binaries
run: nix-shell --run "cargo build --bins"
- name: Setup Test Pre-Requisites
run: |
sudo sysctl -w vm.nr_hugepages=3072
sudo apt-get install linux-modules-extra-$(uname -r)
sudo modprobe nvme_tcp
echo "never" | sudo tee /sys/kernel/mm/transparent_hugepage/enabled
- name: Run BDD Tests
run: |
nix-shell --run "deployer start --image-pull-policy always -w 60s && deployer stop"
# while [ $? -eq 0 ]; do
# nix-shell --run "./scripts/python/test.sh -x"
# done
nix-shell --run "./scripts/python/test.sh"
- uses: actions/upload-artifact@v4
if: failure()
with:
name: failed-docker-logs
path: docker-logs.txt
- name: Cleanup
if: always()
run: |
nix-shell --run "./scripts/python/test-residue-cleanup.sh"
cat /proc/meminfo | grep -i huge
- name: Surface failing tests
if: always()
uses: pmeier/pytest-results-action@main
with:
path: report.xml
summary: true
display-options: a
fail-on-empty: true
title: Test results
# debugging
# - name: Setup tmate session
# if: ${{ failure() }}
# timeout-minutes: 240
# uses: mxschmitt/action-tmate@v3
20 changes: 20 additions & 0 deletions .github/workflows/image-pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: ImageBuild CI
on:
workflow_call:

env:
CARGO_TERM_COLOR: always
CARGO_INCREMENTAL: 0
CI: 1

jobs:
image-build-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: 'recursive'
- uses: DeterminateSystems/nix-installer-action@v14
- uses: DeterminateSystems/magic-nix-cache-action@v8
- name: Test building the release images
run: ./scripts/release.sh --skip-publish --build-bins
30 changes: 30 additions & 0 deletions .github/workflows/image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Image Push
on:
push:
branches:
- develop
- 'release/**'
tags:
- 'v[0-9]+.[0-9]+.[0-9]+**'

env:
CARGO_TERM_COLOR: always
CARGO_INCREMENTAL: 0
CI: 1

jobs:
image-build-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: 'recursive'
- uses: DeterminateSystems/nix-installer-action@v14
- uses: DeterminateSystems/magic-nix-cache-action@v8
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push the release images
run: ./scripts/release.sh
31 changes: 31 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Linter CI
on:
workflow_call:

env:
CARGO_TERM_COLOR: always
CARGO_INCREMENTAL: 0
CI: 1

jobs:
linter:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: 'recursive'
- uses: DeterminateSystems/nix-installer-action@v14
- uses: DeterminateSystems/magic-nix-cache-action@v8
- name: Pre-populate nix-shell
run: |
export NIX_PATH=nixpkgs=$(jq '.nixpkgs.url' nix/sources.json -r)
echo "NIX_PATH=$NIX_PATH" >> $GITHUB_ENV
nix-shell --run "echo" shell.nix
- name: Handle Rust dependencies caching
uses: Swatinem/rust-cache@v2
- name: Lint rust code
run: nix-shell --run "./scripts/rust/linter.sh"
- name: Lint python code
run: nix-shell --run "black --diff --check tests/bdd/"
- name: Lint nix code
run: nix-shell --run "nixpkgs-fmt --check ."
15 changes: 15 additions & 0 deletions .github/workflows/nightly-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: Nightly CI
on:
workflow_dispatch:

jobs:
ci:
uses: ./.github/workflows/pr-ci.yml
nightly-ci:
if: ${{ success() }}
needs:
- ci
runs-on: ubuntu-latest
steps:
- name: CI succeeded
run: exit 0
28 changes: 28 additions & 0 deletions .github/workflows/pr-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Bors CI
on:
workflow_call:
push:
branches:
- staging
- trying

jobs:
lint-ci:
uses: ./.github/workflows/lint.yml
int-ci:
uses: ./.github/workflows/unit-int.yml
bdd-ci:
uses: ./.github/workflows/bdd.yml
image-ci:
uses: ./.github/workflows/image-pr.yml
bors-ci:
if: ${{ success() }}
needs:
- lint-ci
- int-ci
- bdd-ci
- image-ci
runs-on: ubuntu-latest
steps:
- name: CI succeeded
run: exit 0
51 changes: 51 additions & 0 deletions .github/workflows/unit-int.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Integration CI
on:
workflow_call:

env:
CARGO_TERM_COLOR: always
CARGO_INCREMENTAL: 0
CI: 1

jobs:
int-tests:
runs-on: ubuntu-latest-16-cores
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: 'recursive'
- uses: DeterminateSystems/nix-installer-action@v14
- uses: DeterminateSystems/magic-nix-cache-action@v8
- name: Pre-populate nix-shell
run: |
export NIX_PATH=nixpkgs=$(jq '.nixpkgs.url' nix/sources.json -r)
echo "NIX_PATH=$NIX_PATH" >> $GITHUB_ENV
nix-shell --run "echo" shell.nix
- name: Handle Rust dependencies caching
uses: Swatinem/rust-cache@v2
with:
save-if: ${{ startsWith(github.ref_name, 'release/') || github.ref_name == 'develop' }}
- name: Build rust binaries
run: nix-shell --run "cargo build --bins"
- name: Build the tests
run: nix-shell --run "./scripts/rust/test.sh --no-run"
- name: Setup Test Pre-Requisites
run: |
sudo sysctl -w vm.nr_hugepages=2560
sudo apt-get install linux-modules-extra-$(uname -r)
sudo modprobe nvme_tcp
- name: Run Tests
run: |
# pre-pull the required container images
deployer start --image-pull-policy always -w 60s && deployer stop
# includes both unit and integration tests
nix-shell --run "./scripts/rust/test.sh"
- name: Cleanup
if: always()
run: nix-shell --run "./scripts/rust/deployer-cleanup.sh"
# debugging
# - name: Setup tmate session
# if: ${{ failure() }}
# timeout-minutes: 120
# uses: mxschmitt/action-tmate@v3
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,5 @@ __pycache__
/rpc/mayastor-api
/local-fio-0-verify.state
/report.xml
/docker-logs.txt
/.tmp
1 change: 1 addition & 0 deletions control-plane/agents/src/bin/core/tests/controller/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ async fn store_lease_lock() {
.await
.unwrap();

tokio::time::sleep(std::time::Duration::from_secs(1)).await;
let lease_ttl = std::time::Duration::from_secs(2);
let _core_agent = Etcd::new_leased(
["0.0.0.0:2379"],
Expand Down
Loading

0 comments on commit e8fc7df

Please sign in to comment.