Skip to content

Py3: Add Python3 support to scripts/usb_reset.py #97

Py3: Add Python3 support to scripts/usb_reset.py

Py3: Add Python3 support to scripts/usb_reset.py #97

Workflow file for this run

name: Build and test
on:
push:
pull_request:
schedule:
# run daily, this refreshes the cache
- cron: '13 2 * * *'
jobs:
python2-test:
name: Python2 tests
runs-on: ubuntu-22.04
container: python:2.7.18-alpine3.11
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Install Python2 dependencies
run: pip install enum mock pytest-coverage pytest-mock
- name: Run Python2 tests
run: >
pytest --cov scripts scripts/ -vv -rA
--junitxml=.git/pytest27.xml
--cov-report term-missing
--cov-report html:.git/coverage27.html
--cov-report xml:.git/coverage27.xml
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3
with:
directory: .git
files: coverage27.xml
env_vars: OS,PYTHON
fail_ci_if_error: false
flags: python2.7
name: coverage27
verbose: true
- name: Add Pytest coverage comment (if write permission is available)
if: ${{ ! github.event.pull_request.head.repo.fork }}
uses: MishaKav/pytest-coverage-comment@main
continue-on-error: true
with:
junitxml-path: .git/pytest.xml
pytest-xml-coverage-path: .git/coverage27.xml
unique-id-for-comment: pre-commit-coverage-python27
title: >
Python2 coverage comment from
https://github.com/marketplace/actions/pytest-coverage-comment
python3-test:
name: Python3 tests
runs-on: ubuntu-22.04
steps:
- name: Checkout code
uses: actions/checkout@v3
# https://www.python4data.science/en/latest/productive/git/advanced/hooks/ci.html
- uses: actions/setup-python@v4
id: python
with:
python-version: '3.10'
cache: 'pip'
- 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-problemMatcher-xen-api.json"
- uses: pre-commit/[email protected]
name: Run pre-commit checks
with:
# Show the output of the commands for the problem matcher, see above.
extra_args: --all-files --verbose
env:
PYTHONDEVMODE: yes # Enable Python3 checks. See the comment above.
# Skip the no-commit-to-branch check inside of GitHub CI (for CI on merge to master)
SKIP: no-commit-to-branch
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3
with:
directory: .git
env_vars: OS,PYTHON
# 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 ) }}
name: coverage
verbose: true
- name: Add Pytest coverage comment (if write permission is available)
if: ${{ ! github.event.pull_request.head.repo.fork }}
uses: MishaKav/pytest-coverage-comment@main
continue-on-error: true
with:
junitxml-path: .git/pytest.xml
pytest-xml-coverage-path: .git/coverage.xml
unique-id-for-comment: pre-commit-coverage
title: >
Python3 coverage comment from
https://github.com/marketplace/actions/pytest-coverage-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/[email protected]
- 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