Build and test #810
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 * * *' | |
jobs: | |
python-test: | |
name: Python tests | |
runs-on: ubuntu-22.04 | |
strategy: | |
fail-fast: false | |
matrix: | |
docker-image: # See https://hub.docker.com/_/python/tags for images | |
- python:2.7.18-alpine3.11 | |
- python:3.11.4-alpine3.18 | |
container: ${{ matrix.docker-image }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Install python 2 dependencies | |
if: ${{ startsWith(matrix.docker-image, 'python:2.7.18') }} | |
run: pip install enum | |
- name: Install dependencies | |
run: pip install mock pytest | |
- name: Run python tests | |
run: pytest scripts | |
ocaml-test: | |
name: Ocaml tests | |
runs-on: ubuntu-20.04 | |
env: | |
XAPI_VERSION: "v0.0.0" | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
# The checkout action performs a shallow, this triggers dune to set the | |
# version to <hash>-dirty. Work around this dune behaviour and tag the | |
# commit so a proper version is always picked up | |
- name: Tag current commit | |
run: | | |
git config user.name "Dune workaround" | |
git config user.email "<>" | |
git tag -am "workaround for dune" "$XAPI_VERSION" | |
- 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: 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 |