Remove hfx_filename and perfmon from expected_to_fail #210
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
name: Build and test | |
on: | |
push: | |
pull_request: | |
schedule: | |
# run daily, this refreshes the cache | |
- cron: '13 2 * * *' | |
concurrency: # On new push, cancel old workflows from the same PR, branch or tag: | |
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
cancel-in-progress: true | |
jobs: | |
python-test: | |
name: Python tests | |
runs-on: ubuntu-22.04 | |
strategy: | |
fail-fast: false | |
matrix: | |
python-version: ['2.7', '3.11'] | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 # To check which files changed: origin/master..HEAD | |
- uses: LizardByte/setup-python-action@master | |
with: | |
python-version: ${{matrix.python-version}} | |
- uses: actions/cache@v3 | |
name: Setup cache for running pre-commit fast | |
with: | |
path: ~/.cache/pre-commit | |
key: pre-commit|${{ env.pythonLocation }}|${{ hashFiles('.pre-commit-config.yaml') }} | |
- run: echo "::add-matcher::.github/workflows/python-warning-matcher.json" | |
name: "Setup GitHub for reporting Python warnings as annotations in pull request code review" | |
- uses: pre-commit/action@v3.0.0 | |
name: Run pre-commit checks (no spaces at end of lines, etc) | |
if: ${{ matrix.python-version != '2.7' }} | |
with: | |
extra_args: --all-files --verbose --hook-stage commit | |
env: | |
SKIP: no-commit-to-branch | |
- name: Install dependencies only needed for python 2 | |
if: ${{ matrix.python-version == '2.7' }} | |
run: pip install enum | |
- name: Install dependencies only needed for python 3 | |
if: ${{ matrix.python-version != '2.7' }} | |
run: pip install pandas pytype toml | |
- name: Install common dependencies for Python ${{matrix.python-version}} | |
run: pip install mock pytest-coverage pytest-mock | |
- name: Run Pytest tests for Python ${{matrix.python-version}} | |
run: > | |
pytest --cov scripts scripts/ -vv -rA | |
--junitxml=.git/pytest${{matrix.python-version}}.xml | |
--cov-report term-missing | |
--cov-report xml:.git/coverage${{matrix.python-version}}.xml | |
env: | |
PYTHONDEVMODE: yes | |
- name: Upload Python ${{matrix.python-version}} coverage report to Codecov | |
uses: codecov/codecov-action@v3 | |
with: | |
directory: .git | |
files: coverage${{matrix.python-version}}.xml | |
env_vars: OS,PYTHON | |
fail_ci_if_error: false | |
flags: python${{matrix.python-version}} | |
name: coverage${{matrix.python-version}} | |
verbose: true | |
- uses: dciborow/action-pylint@0.1.0 | |
if: ${{ matrix.python-version != '2.7' }} | |
with: | |
reporter: github-pr-review | |
level: warning | |
# To be customized to cover remaining Python scripts: | |
glob_pattern: "**/*.py" | |
- name: Run pytype checks | |
if: ${{ matrix.python-version != '2.7' }} | |
run: ./pytype_reporter.py | |
env: | |
PR_NUMBER: ${{ github.event.number }} | |
# Try to add pytype_report.py's summary file as a comment to the PR: | |
# Documentation: https://github.com/marketplace/actions/add-pr-comment | |
- name: Add the pytype summary as a comment to the PR (if permitted) | |
uses: mshick/add-pr-comment@v2 | |
# Depends on pytype checks, which are not run for python 2.7: | |
if: ${{ matrix.python-version != '2.7' }} | |
# Fails for user workflows without permissions(fork-based pull requests): | |
continue-on-error: true | |
with: | |
message-path: .git/pytype-summary.md # Add the content of it as comment | |
ocaml-test: | |
name: Ocaml tests | |
runs-on: ubuntu-20.04 | |
env: | |
XAPI_VERSION: "v0.0.0" | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Pull configuration from xs-opam | |
run: | | |
curl --fail --silent https://raw.githubusercontent.com/xapi-project/xs-opam/master/tools/xs-opam-ci.env | cut -f2 -d " " > .env | |
- name: Load environment file | |
id: dotenv | |
uses: falti/dotenv-action@v1.0.4 | |
- name: Update Ubuntu repositories | |
run: sudo apt-get update | |
- name: Use ocaml | |
uses: ocaml/setup-ocaml@v2 | |
with: | |
ocaml-compiler: ${{ steps.dotenv.outputs.ocaml_version_full }} | |
opam-repositories: | | |
xs-opam: ${{ steps.dotenv.outputs.repository }} | |
dune-cache: true | |
- name: Install dependencies | |
run: opam install . --deps-only --with-test -v | |
- name: Configure | |
run: opam exec -- ./configure --xapi_version="$XAPI_VERSION" | |
- name: Build | |
run: opam exec -- make | |
- name: Run tests | |
run: opam exec -- make test | |
- name: Check all code | |
run: opam exec -- make check | |
- name: Run stress tests | |
run: opam exec -- make stresstest | |
if: ${{ github.event_name == 'schedule' }} | |
- name: Build SDK | |
run: | | |
mkdir -p /opt/xensource/sm | |
wget -O /opt/xensource/sm/XE_SR_ERRORCODES.xml https://raw.githubusercontent.com/xapi-project/sm/master/drivers/XE_SR_ERRORCODES.xml | |
opam exec -- make sdk | |
- name: Make install smoketest | |
run: | | |
opam exec -- make install DESTDIR=$(mktemp -d) | |
opam exec -- make install DESTDIR=$(mktemp -d) BUILD_PY2=NO | |
- name: Sanity test SDK | |
run: | | |
opam exec -- make sdksanity | |
- name: Uninstall unversioned packages and remove pins | |
# This should purge them from the cache, unversioned package have | |
# 'master' as its version | |
run: | | |
opam list | awk -F " " '$2 == "master" { print $1 }' | xargs opam uninstall | |
opam pin list | cut -f1 -d "." | xargs opam unpin | |
deprecation-test: | |
name: Deprecation tests | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Generate empty configuration for make to be happy | |
run: touch config.mk | |
- name: quality-gate | |
run: make quality-gate | |
- uses: reviewdog/action-actionlint@v1 | |
name: GitHub Action linter from https://github.com/reviewdog/action-actionlint | |
- name: pyflakes | |
uses: reviewdog/action-pyflakes@master | |
with: | |
github_token: ${{ secrets.github_token }} | |
reporter: github-pr-review | |
level: error | |
# uses: tsuyoshicho/action-mypy@v3.13.0 | |
- uses: bernhardkaindl/action-mypy@36cb3a857d01c1bdaa2811893106c71580132d71 | |
env: | |
MYPYPATH: scripts/examples/python:scripts/examples:scripts/plugins:scripts:. | |
with: | |
filter_mode: nofilter | |
setup_method: install | |
setup_command: pip install mypy mock | |
mypy_flags: | | |
--scripts-are-modules | |
--check-untyped-defs | |
--allow-redefinition | |
--hide-error-context | |
--ignore-missing-imports | |
--no-pretty | |
--warn-unreachable | |
--disable-error-code attr-defined | |
--disable-error-code call-overload | |
--disable-error-code import-not-found | |
--disable-error-code import-untyped | |
--disable-error-code type-arg | |
--disable-error-code var-annotated | |
--exclude ocaml/events/event_listen.py | |
--exclude ocaml/idl | |
--exclude ocaml/message-switch | |
--exclude ocaml/tests/tests/looper.py | |
--exclude ocaml/xcp-rrdd/scripts/rrdd/rrdd.py | |
--exclude scripts/examples | |
--exclude scripts/examples/python/monitor-unwanted-domains.py | |
--exclude scripts/scalability-tests/ping-master.py | |
--exclude scripts/backup-sr-metadata.py | |
--exclude scripts/restore-sr-metadata.py | |
--exclude scripts/nbd_client_manager.py | |
target: | | |
scripts/perfmon | |
scripts/hfx_filename | |
scripts/mail-alarm | |
scripts/host-display | |
github_token: ${{ secrets.github_token }} | |
reporter: github-pr-review | |
- uses: dciborow/action-pylint@0.1.1 | |
with: | |
filter_mode: nofilter | |
glob_pattern: scripts/examples/python/XenAPIPlugin.py | |
pylint_args: | | |
--verbose | |
--disable bad-indentation | |
--disable consider-using-dict-comprehension | |
--disable consider-using-f-string | |
--disable consider-using-with | |
--disable import-error | |
--disable import-outside-toplevel | |
--disable invalid-name | |
--disable missing-final-newline | |
--disable missing-class-docstring | |
--disable missing-function-docstring | |
--disable multiple-imports | |
--disable redefined-outer-name | |
--disable trailing-whitespace | |
--max-line-length 112 | |
scripts/perfmon | |
scripts/hfx_filename | |
scripts/test_perfmon.py | |
scripts/test_hfx_filename.py | |
github_token: ${{ secrets.github_token }} | |
reporter: github-pr-review |