summaryrefslogtreecommitdiffstats
path: root/.github
diff options
context:
space:
mode:
authorBenjamin Drung <bdrung@debian.org>2023-06-10 08:55:33 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2023-06-10 09:21:49 +0000
commit88837172f69eabc408ae3945d82e0270b8e07440 (patch)
treed6b7fa06694f45d25f54f6ea9ded93c981e51f6f /.github
parentInitial commit. (diff)
downloadnvme-stas-88837172f69eabc408ae3945d82e0270b8e07440.tar.xz
nvme-stas-88837172f69eabc408ae3945d82e0270b8e07440.zip
Adding upstream version 2.2.1.upstream/2.2.1
Signed-off-by: Benjamin Drung <bdrung@debian.org>
Diffstat (limited to '.github')
-rw-r--r--.github/dependabot.yml11
-rw-r--r--.github/workflows/docker-publish.yml63
-rw-r--r--.github/workflows/docker-test.yml51
-rw-r--r--.github/workflows/meson-test.yml76
-rw-r--r--.github/workflows/pylint.yml104
5 files changed, 305 insertions, 0 deletions
diff --git a/.github/dependabot.yml b/.github/dependabot.yml
new file mode 100644
index 0000000..5bb8a98
--- /dev/null
+++ b/.github/dependabot.yml
@@ -0,0 +1,11 @@
+---
+version: 2
+updates:
+ - package-ecosystem: "github-actions"
+ directory: "/"
+ schedule:
+ interval: "weekly"
+ - package-ecosystem: "docker"
+ directory: "/"
+ schedule:
+ interval: "weekly" \ No newline at end of file
diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml
new file mode 100644
index 0000000..75f19fd
--- /dev/null
+++ b/.github/workflows/docker-publish.yml
@@ -0,0 +1,63 @@
+name: Docker
+
+# This workflow uses actions that are not certified by GitHub.
+# They are provided by a third-party and are governed by
+# separate terms of service, privacy policy, and support
+# documentation.
+
+on:
+ push:
+ branches: [ main ]
+ # Publish semver tags as releases.
+ tags: [ 'v*.*.*' ]
+ pull_request:
+ branches: [ main ]
+
+ workflow_dispatch:
+
+env:
+ # Use docker.io for Docker Hub if empty
+ REGISTRY: ghcr.io
+ # github.repository as <account>/<repo>
+ IMAGE_NAME: ${{ github.repository }}
+
+
+jobs:
+ docker-publish:
+ if: ${{ !github.event.act }} # skip during local actions testing
+ runs-on: ubuntu-latest
+ permissions:
+ contents: read
+ packages: write
+
+ steps:
+ - name: Checkout repository
+ uses: actions/checkout@v3
+
+ # Login against a Docker registry except on PR
+ # https://github.com/docker/login-action
+ - name: Log into registry ${{ env.REGISTRY }}
+ if: github.event_name != 'pull_request'
+ uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a
+ with:
+ registry: ${{ env.REGISTRY }}
+ username: ${{ github.actor }}
+ password: ${{ secrets.GITHUB_TOKEN }}
+
+ # Extract metadata (tags, labels) for Docker
+ # https://github.com/docker/metadata-action
+ - name: Extract Docker metadata
+ id: meta
+ uses: docker/metadata-action@507c2f2dc502c992ad446e3d7a5dfbe311567a96
+ with:
+ images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
+
+ # Build and push Docker image with Buildx (don't push on PR)
+ # https://github.com/docker/build-push-action
+ - name: Build and push Docker image
+ uses: docker/build-push-action@3b5e8027fcad23fda98b2e3ac259d8d67585f671
+ with:
+ context: .
+ push: ${{ github.event_name != 'pull_request' }}
+ tags: ${{ steps.meta.outputs.tags }}
+ labels: ${{ steps.meta.outputs.labels }}
diff --git a/.github/workflows/docker-test.yml b/.github/workflows/docker-test.yml
new file mode 100644
index 0000000..92284c0
--- /dev/null
+++ b/.github/workflows/docker-test.yml
@@ -0,0 +1,51 @@
+name: Test
+
+on:
+ push:
+ branches: [ main ]
+ pull_request:
+ branches: [ main ]
+
+ workflow_dispatch:
+
+jobs:
+ docker-run:
+ if: ${{ !github.event.act }} # skip during local actions testing
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v3
+
+ - name: Install requirements
+ # make sure nvme-cli installed (we need it for /etc/nvme/hostnqn and /etc/nvme/hostid)
+ run: sudo apt-get install --yes --quiet nvme-cli
+
+ - name: Load Kernel drivers
+ run: sudo modprobe -v nvme-fabrics
+
+ - name: Fix D-BUS
+ run: |
+ sed 's/@STAFD_DBUS_NAME@/org.nvmexpress.staf/g' etc/dbus-1/system.d/org.nvmexpress.staf.in.conf | sudo tee /usr/share/dbus-1/system.d/org.nvmexpress.staf.conf
+ sed 's/@STACD_DBUS_NAME@/org.nvmexpress.stac/g' etc/dbus-1/system.d/org.nvmexpress.stac.in.conf | sudo tee /usr/share/dbus-1/system.d/org.nvmexpress.stac.conf
+ sudo systemctl reload dbus.service
+
+ - name: Build & Start containers
+ run: docker-compose -f "docker-compose.yml" up --detach --build
+
+ - name: Run tests
+ run: |
+ docker-compose ps
+ docker-compose exec -T stafd stafctl ls
+ docker-compose exec -T stafd stafctl status
+ docker-compose exec -T stacd stacctl ls
+ docker-compose exec -T stacd stacctl status
+ docker-compose logs
+
+ - name: Logs
+ if: failure()
+ run: |
+ docker-compose ps || true
+ docker-compose logs || true
+
+ - name: Stop containers
+ if: always()
+ run: docker-compose -f "docker-compose.yml" down
diff --git a/.github/workflows/meson-test.yml b/.github/workflows/meson-test.yml
new file mode 100644
index 0000000..2909ffa
--- /dev/null
+++ b/.github/workflows/meson-test.yml
@@ -0,0 +1,76 @@
+name: Meson
+
+on:
+ push:
+ branches: [ main ]
+ pull_request:
+ branches: [ main ]
+
+ workflow_dispatch:
+
+jobs:
+ meson-build:
+ runs-on: ubuntu-latest
+ steps:
+ - name: "CHECKOUT: nvme-stas"
+ uses: actions/checkout@v3
+
+ - name: "INSTALL: Overall dependencies"
+ run: |
+ sudo apt-mark hold grub-efi-amd64-signed # Workaround for upstream issue
+ sudo apt-get update --yes --quiet
+ sudo apt-get upgrade --yes --quiet
+ sudo apt-get install --yes --quiet python3-pip cmake iproute2
+ sudo python3 -m pip install --upgrade pip
+ sudo python3 -m pip install --upgrade wheel meson ninja
+
+ - name: "INSTALL: nvme-stas dependencies"
+ run: |
+ sudo apt-get install --yes --quiet docbook-xml
+ sudo apt-get install --yes --quiet docbook-xsl
+ sudo apt-get install --yes --quiet xsltproc
+ sudo apt-get install --yes --quiet libglib2.0-dev
+ sudo apt-get install --yes --quiet libgirepository1.0-dev
+ sudo apt-get install --yes --quiet libsystemd-dev
+ sudo apt-get install --yes --quiet python3-systemd
+ sudo apt-get install --yes --quiet python3-pyudev
+ sudo apt-get install --yes --quiet python3-lxml
+ python3 -m pip install --upgrade dasbus pylint pyflakes PyGObject
+ python3 -m pip install --upgrade vermin pyfakefs importlib-resources
+
+ - name: "INSTALL: libnvme"
+ run: |
+ sudo apt-get install --yes --quiet swig libjson-c-dev
+ meson subprojects download
+ meson setup .build subprojects/libnvme -Dlibdbus=disabled -Dopenssl=disabled -Dbuildtype=release -Dprefix=/usr -Dpython=true
+ ninja -C .build
+ sudo meson install -C .build
+
+ - name: "CONFIG: PYTHONPATH"
+ run: |
+ echo "PYTHONPATH=.build:.build/subprojects/libnvme:/usr/lib/python3/dist-packages/" >> $GITHUB_ENV
+
+ - name: "TEST: nvme-stas"
+ uses: BSFishy/meson-build@v1.0.3
+ with:
+ action: test
+ directory: .build
+ setup-options: -Dman=true -Dhtml=true
+ options: --print-errorlogs --suite nvme-stas
+
+ # Preserve meson's log file on failure
+ - uses: actions/upload-artifact@v3
+ if: failure()
+ with:
+ name: "Linux_Meson_Testlog"
+ path: .build/meson-logs/*
+
+ - name: "Generate coverage report"
+ run: |
+ python3 -m pip install pytest
+ python3 -m pip install pytest-cov
+ PYTHONPATH=.build:.build/subprojects/libnvme:/usr/lib/python3/dist-packages/ pytest --cov=./staslib --cov-report=xml test/test-*.py
+
+ - uses: codecov/codecov-action@v3
+ with:
+ fail_ci_if_error: false \ No newline at end of file
diff --git a/.github/workflows/pylint.yml b/.github/workflows/pylint.yml
new file mode 100644
index 0000000..abd3c1b
--- /dev/null
+++ b/.github/workflows/pylint.yml
@@ -0,0 +1,104 @@
+name: Linters
+
+on:
+ push:
+ branches: [ main ]
+ pull_request:
+ branches: [ main ]
+
+ workflow_dispatch:
+
+jobs:
+
+ docker-lint:
+ if: ${{ !github.event.act }} # skip during local actions testing
+ runs-on: ubuntu-20.04
+ steps:
+ - uses: actions/checkout@v3
+ - uses: hadolint/hadolint-action@v3.1.0
+ with:
+ recursive: true
+ ignore: DL3041
+
+ python-lint:
+ runs-on: ubuntu-20.04
+
+ strategy:
+ fail-fast: false
+ matrix:
+ python-version: ["3.6", "3.7", "3.8", "3.9", "3.10"]
+
+ steps:
+ - name: "CHECKOUT: nvme-stas"
+ uses: actions/checkout@v3
+
+ - name: Set up Python ${{ matrix.python-version }}
+ uses: actions/setup-python@v4
+ with:
+ python-version: ${{ matrix.python-version }}
+
+# - name: "UPGRADE: existing packages"
+# run: |
+# sudo apt-get update --yes --quiet || true
+# sudo apt-get upgrade --yes --quiet || true
+
+ - name: "INSTALL: additional packages"
+ run: |
+ sudo apt-get install --yes --quiet python3-pip || true
+ sudo apt-get install --yes --quiet cmake || true
+ sudo apt-get install --yes --quiet libgirepository1.0-dev || true
+ sudo apt-get install --yes --quiet libsystemd-dev || true
+ sudo apt-get install --yes --quiet python3-systemd || true
+ sudo python3 -m pip install --upgrade pip
+ sudo python3 -m pip install --upgrade wheel
+ sudo python3 -m pip install --upgrade meson
+ sudo python3 -m pip install --upgrade ninja
+ python3 -m pip install --upgrade dasbus
+ python3 -m pip install --upgrade pylint
+ python3 -m pip install --upgrade pyflakes
+ python3 -m pip install --upgrade PyGObject
+ python3 -m pip install --upgrade lxml
+ python3 -m pip install --upgrade pyudev
+
+ - name: "BUILD: libnvme"
+ run: |
+ sudo apt-get install --yes --quiet swig libjson-c-dev || true
+ meson subprojects download
+ meson setup builddir subprojects/libnvme -Dlibdbus=disabled -Dopenssl=disabled -Dbuildtype=release -Dprefix=/usr -Dpython=true
+ ninja -C builddir
+ sudo meson install -C builddir
+
+ - name: Set PYTHONPATH
+ run: |
+ echo "PYTHONPATH=builddir:builddir/subprojects/libnvme:/usr/lib/python3/dist-packages/" >> $GITHUB_ENV
+
+ - name: Show test environment
+ run: |
+ echo -e "Build Directory:\n$(ls -laF builddir)"
+ python3 -VV
+ python3 -m site
+ python3 -m pylint --version
+ echo "pyflakes $(python3 -m pyflakes --version)"
+
+ - name: Pylint
+ run: |
+ python3 -m pylint --rcfile=test/pylint.rc *.py staslib
+
+ - name: Pyflakes
+ if: always()
+ run: |
+ python3 -m pyflakes *.py staslib
+
+ python-black:
+ if: ${{ !github.event.act }} # skip during local actions testing
+ name: python-black formatter
+ runs-on: ubuntu-latest
+ steps:
+ - name: "CHECKOUT: nvme-stas"
+ uses: actions/checkout@v3
+
+ - name: "BLACK"
+ uses: psf/black@stable
+ with:
+ options: "--check --diff --color --line-length 120 --skip-string-normalization --extend-exclude (subprojects|debian|.build)"
+ src: "."