mirror of
https://github.com/nicolargo/glances.git
synced 2026-10-09 02:12:12 -04:00
The test-freebsd job has been commented out since it was written, and as written it could not have worked: it used two separate vmactions steps, one to install dependencies and one to run pytest, and each step boots its own VM -- so pytest ran in a VM where the dependencies were never installed. It also carried an actions/setup-python step and a python-version matrix, which only configure the Linux host. Fold it into a single step with prepare/run, drop the host-side Python setup, and cache the prepared VM image. Install only the runtime requirements: dev-requirements.txt pulls in matplotlib's build chain (contourpy, cffi) and FreeBSD ships no wheels for those, so pip builds them from source and the job runs past its timeout. pytest and psutil come from packages instead.
173 lines
5.1 KiB
YAML
173 lines
5.1 KiB
YAML
# Run unitary test
|
|
|
|
name: test
|
|
|
|
on:
|
|
workflow_call:
|
|
|
|
jobs:
|
|
|
|
source-code-checks:
|
|
runs-on: ubuntu-24.04
|
|
timeout-minutes: 5
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
steps:
|
|
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
|
|
|
# - name: Check formatting with Ruff
|
|
# uses: chartboost/ruff-action@e18ae971ccee1b2d7bbef113930f00c670b78da4 # v1
|
|
# with:
|
|
# args: 'format --check'
|
|
|
|
- name: Check linting with Ruff
|
|
uses: chartboost/ruff-action@e18ae971ccee1b2d7bbef113930f00c670b78da4 # v1
|
|
with:
|
|
args: 'check'
|
|
|
|
# - name: Static type check
|
|
# run: |
|
|
# echo "Skipping static type check for the moment, too much error...";
|
|
# # pip install pyright
|
|
# # pyright glances
|
|
|
|
|
|
test-linux:
|
|
|
|
needs: source-code-checks
|
|
# https://github.com/actions/runner-images?tab=readme-ov-file#available-images
|
|
runs-on: ubuntu-24.04
|
|
timeout-minutes: 15
|
|
strategy:
|
|
matrix:
|
|
# Python EOL version are note tested
|
|
# Multiple Python version only tested for Linux
|
|
python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"]
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
|
|
|
- name: Set up Python ${{ matrix.python-version }}
|
|
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6
|
|
with:
|
|
python-version: ${{ matrix.python-version }}
|
|
cache: 'pip'
|
|
|
|
- name: Install dependencies
|
|
run: |
|
|
if [ -f dev-requirements.txt ]; then python -m pip install -r dev-requirements.txt; fi
|
|
if [ -f requirements.txt ]; then python -m pip install -r requirements.txt; fi
|
|
|
|
- name: Unitary tests
|
|
run: |
|
|
python -m pytest ./tests/test_core.py
|
|
|
|
test-windows:
|
|
|
|
needs: source-code-checks
|
|
# https://github.com/actions/runner-images?tab=readme-ov-file#available-images
|
|
runs-on: windows-2025
|
|
timeout-minutes: 15
|
|
strategy:
|
|
matrix:
|
|
python-version: ["3.14"]
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
|
|
|
- name: Set up Python ${{ matrix.python-version }}
|
|
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6
|
|
with:
|
|
python-version: ${{ matrix.python-version }}
|
|
cache: 'pip'
|
|
|
|
- name: Install dependencies
|
|
run: |
|
|
if (Test-Path -PathType Leaf "dev-requirements.txt") { python -m pip install -r dev-requirements.txt }
|
|
if (Test-Path -PathType Leaf "requirements.txt") { python -m pip install -r requirements.txt }
|
|
pip install pytest
|
|
pip install .
|
|
|
|
- name: Unitary tests
|
|
run: |
|
|
python -m pytest ./tests/test_core.py
|
|
|
|
test-macos:
|
|
|
|
needs: source-code-checks
|
|
# https://github.com/actions/runner-images?tab=readme-ov-file#available-images
|
|
runs-on: macos-15
|
|
timeout-minutes: 15
|
|
strategy:
|
|
matrix:
|
|
# Only test the latest stable version
|
|
python-version: ["3.14"]
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
|
|
|
- name: Set up Python ${{ matrix.python-version }}
|
|
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6
|
|
with:
|
|
python-version: ${{ matrix.python-version }}
|
|
cache: 'pip'
|
|
|
|
- name: Install dependencies
|
|
run: |
|
|
if [ -f dev-requirements.txt ]; then python -m pip install -r dev-requirements.txt; fi
|
|
if [ -f requirements.txt ]; then python -m pip install -r requirements.txt; fi
|
|
|
|
- name: Unitary tests
|
|
run: |
|
|
python -m pytest ./tests/test_core.py
|
|
|
|
test-freebsd:
|
|
|
|
needs: source-code-checks
|
|
# FreeBSD is not offered by the GitHub-hosted runners, so the tests run in
|
|
# a FreeBSD VM booted under QEMU/KVM on a Linux runner. The whole job has
|
|
# to live in a single vmactions step: each step starts its own VM, so
|
|
# installing dependencies in one step and running pytest in another would
|
|
# run pytest in a VM that never saw the dependencies.
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 30
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
|
|
|
- name: Unitary tests
|
|
uses: vmactions/freebsd-vm@77ed28d336d03fe19a3f4f7266c1d2c4714dd79d # v1.5.2
|
|
with:
|
|
usesh: true
|
|
cache-after-prepare: true
|
|
prepare: |
|
|
pkg install -y python3 gcc devel/py-pip devel/py-pytest sysutils/py-psutil
|
|
run: |
|
|
set -e
|
|
python3 --version
|
|
# Only the runtime requirements are installed here.
|
|
# dev-requirements.txt pulls in matplotlib's build chain (contourpy,
|
|
# cffi, ...), and FreeBSD has no wheels for those, so pip builds them
|
|
# from source and the job times out. tests/test_core.py does not need
|
|
# them.
|
|
python3 -m pip install --break-system-packages -r requirements.txt
|
|
python3 -m pytest ./tests/test_core.py
|