Skip to content

Commit cbfd136

Browse files
MaisenbacherDigaw
authored andcommitted
tests: Use container image to run nightly tests
Using the pre-build linux-nvme/debian.python container to avoid installing dependencies every time which fails occasionally. Also drop clean up steps as this is part of the self-hosted runner now. Signed-off-by: Dennis Maisenbacher <[email protected]>
1 parent 1024886 commit cbfd136

File tree

1 file changed

+14
-35
lines changed

1 file changed

+14
-35
lines changed

.github/workflows/run-nightly-tests.yml

Lines changed: 14 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -9,52 +9,40 @@ on:
99
jobs:
1010
nightly-tests:
1111
runs-on: nvme-nvm
12+
container:
13+
image: ghcr.io/linux-nvme/debian.python:latest
14+
#Expose all devices to the container through the `privileged` flag.
15+
#
16+
#BDEV0 is an environment variable of the self-hosted runner instance
17+
#that contains a valid nvme ctrl name which is capable of the nvm
18+
#command set.
19+
options: '--privileged -e BDEV0'
1220
steps:
1321
- name: Output kernel version
1422
run: |
1523
uname -a
16-
- name: Clean up test device
17-
run: |
18-
#BDEV0 is an environment variable of the self-hosted runner instance
19-
#that contains a valid nvme ctrl name which is capable of the nvm
20-
#command set.
21-
CONTROLLER=$(echo /dev/${BDEV0} | sed 's/n[0-9]*$//')
22-
sudo nvme delete-ns $CONTROLLER -n 0xffffffff
23-
sudo nvme format $CONTROLLER -n 0xffffffff -l 0 -f
24-
SIZE=$(sudo nvme id-ctrl $CONTROLLER --output-format=json | jq -r '{tnvmcap} | .[]' | awk '{print $1/512}')
25-
sudo nvme create-ns -s $SIZE -c $SIZE -f 0 -d 0 --csi=0 $CONTROLLER
26-
sudo nvme attach-ns $CONTROLLER -n 1 -c 0
2724
- uses: actions/checkout@v4
2825
- name: Install dependencies
2926
run: |
30-
sudo apt-get update
31-
sudo apt-get install --no-install-recommends -y \
32-
meson gcc pkg-config git libjson-c-dev libssl-dev libkeyutils-dev \
33-
libdbus-1-dev libpython3-dev pipx python3-dev swig xz-utils
34-
pipx ensurepath
35-
sudo PIPX_BIN_DIR=/usr/local/bin pipx install nose2
36-
sudo PIPX_BIN_DIR=/usr/local/bin pipx install flake8
37-
sudo PIPX_BIN_DIR=/usr/local/bin pipx install mypy
38-
sudo PIPX_BIN_DIR=/usr/local/bin pipx install autopep8
39-
sudo PIPX_BIN_DIR=/usr/local/bin pipx install isort
27+
PIPX_BIN_DIR=/usr/local/bin pipx install nose2 --force
4028
- name: Build and install nvme-cli
4129
run: |
4230
scripts/build.sh -b release -c gcc
43-
sudo meson install -C .build-ci
44-
sudo ldconfig /usr/local/lib64
4531
- name: Overwrite test config
4632
run: |
4733
CONTROLLER=$(echo /dev/${BDEV0} | sed 's/n[0-9]*$//')
4834
cat > tests/config.json << EOF
4935
{
5036
"controller" : "$CONTROLLER",
5137
"ns1": "/dev/${BDEV0}",
52-
"log_dir": "tests/nvmetests/"
38+
"log_dir": "tests/nvmetests/",
39+
"nvme_bin": "$(pwd)/.build-ci/nvme"
5340
}
5441
EOF
42+
cat tests/config.json
5543
- name: Run on device tests
5644
run: |
57-
sudo nose2 --verbose --start-dir tests \
45+
nose2 --verbose --start-dir tests \
5846
nvme_attach_detach_ns_test \
5947
nvme_compare_test \
6048
nvme_copy_test \
@@ -79,15 +67,6 @@ jobs:
7967
uses: actions/upload-artifact@v4
8068
if: always()
8169
with:
82-
name: logs files
70+
name: nvme-cli-test-logs
8371
path: |
8472
./tests/nvmetests/**/*.log
85-
- name: Clean up test device
86-
if: always()
87-
run: |
88-
CONTROLLER=$(echo /dev/${BDEV0} | sed 's/n[0-9]*$//')
89-
sudo nvme delete-ns $CONTROLLER -n 0xffffffff
90-
sudo nvme format $CONTROLLER -n 0xffffffff -l 0 -f
91-
SIZE=$(sudo nvme id-ctrl $CONTROLLER --output-format=json | jq -r '{tnvmcap} | .[]' | awk '{print $1/512}')
92-
sudo nvme create-ns -s $SIZE -c $SIZE -f 0 -d 0 --csi=0 $CONTROLLER
93-
sudo nvme attach-ns $CONTROLLER -n 1 -c 0

0 commit comments

Comments
 (0)