Merge pull request #122 from liulinC/private/linl/yangtze #835
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#-------------------------------------------------------------------------------------- | ||
# This GitHub Actions workflow can be run locally using https://github.com/nektos/act | ||
# | ||
# act normally uses docker, but it can also be run using podman on Fedora 37: | ||
# dnf install act-cli podman | ||
# podman system service -t 0 & | ||
# act --bind --container-daemon-socket $XDG_RUNTIME_DIR/podman/podman.sock -W .github/workflows/main.yml | ||
#-------------------------------------------------------------------------------------- | ||
name: "Pytest test suites" | ||
# | ||
# The GitHub events that trigger this workflow: | ||
# Checks can be skipped by adding "skip-checks: true" to a commit message, | ||
# or requested by adding "request-checks: true" if disabled by default for pushes: | ||
# https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/collaborating-on-repositories-with-code-quality-features/about-status-checks#skipping-and-requesting-checks-for-individual-commits | ||
# | ||
on: [push, pull_request] | ||
# | ||
# Cancel a currently running workflow from the same PR, branch or tag | ||
# when a new workflow is triggered: | ||
# https://stackoverflow.com/questions/66335225/how-to-cancel-previous-runs-in-the-pr-when-you-push-new-commitsupdate-the-curre | ||
# | ||
concurrency: | ||
cancel-in-progress: true | ||
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | ||
env: | ||
DEBIAN_FRONTEND: noninteractive | ||
# No warnings for pip and pytest themselves; pytest enables warnings in conftest.py | ||
PYTHONWARNINGS: ignore | ||
jobs: | ||
container-tests: | ||
name: "Python2: Container tests" | ||
runs-on: ubuntu-22.04 | ||
# https://github.com/Docker-Hub-frolvlad/docker-alpine-python2 | ||
container: frolvlad/alpine-python2 | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Install test tools | ||
run: apk add --no-cache libxml2-utils bash | ||
- name: Install python requirements | ||
run: pip install -r requirements.txt | ||
- name: Test sar file collection, extended by XSI-1385 with plain-text SARs | ||
run: bash -x tests/integration/sar-file-collection.test.sh | ||
- name: Test creating a tarball for /etc/systemd | ||
run: bash -x tests/integration/xenserver-config-systemd.sh | ||
python2-tests: | ||
name: "Python2: PyLint and Pytest" | ||
runs-on: ubuntu-20.04 | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: LizardByte/setup-python-action@master | ||
with: | ||
python-version: 2.7 | ||
- name: Install dependencies | ||
run: | | ||
if [ -f requirements.txt ]; then pip2 install -r requirements.txt; fi | ||
if [ -f requirements-dev.txt ]; then pip2 install -r requirements-dev.txt; fi | ||
pip2 install pylint==1.9.4 | ||
- name: Run pylint-1.9.4 for pylint --py3k linting (configured in .pylintrc) | ||
run: python2 -m pylint xen-bugtool | ||
- name: Run python2 -m pytest to execute all unit and integration tests | ||
run: > | ||
python2 -m pytest -v -rA | ||
--cov xen-bugtool | ||
--cov tests/ | ||
--junitxml=.git/pytest27.xml | ||
--cov-report term-missing | ||
--cov-report xml:.git/coverage27.xml | ||
- name: Upload coverage reports to Codecov for the Python 2.7 tests | ||
# Until CODECOV_TOKEN is set, use the legacy tokenless codecov action: | ||
uses: codecov/codecov-action@v3 | ||
env: | ||
PYTHON: python2.7 | ||
with: | ||
directory: .git | ||
files: coverage27.xml | ||
flags: python2.7-xs8-yangtze | ||
env_vars: OS,PYTHON | ||
name: Python 2.7 Coverage for XS8/Yangtze | ||
# Whether the job should fail if Codecov runs into an error during upload. | ||
# Not failing the job in this case is ok because the pre-commit checks | ||
# also contain a diff-cover job which would fail on missing changed lines: | ||
fail_ci_if_error: false | ||
flags: > | ||
${{ format('python{0}', steps.python.outputs.python-version ) }} | ||
verbose: true |