feat(testing): allow tests to be run using pytest-xdist (#2172) #231
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: Run tests (emulated) | |
on: | |
# Trigger the workflow on master but also allow it to run manually. | |
workflow_dispatch: | |
push: | |
branches: | |
- master | |
jobs: | |
run_tox_emulate: | |
name: tox -e py310_cython (${{ matrix.architecture }}) | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
architecture: | |
- s390x | |
- arm64v8 | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 2 | |
- name: Cache PIP | |
uses: actions/cache@v3 | |
with: | |
path: | | |
.pip | |
key: python-${{ matrix.architecture }}-${{ hashFiles('requirements/tests') }} | |
- name: Set up emulation | |
run: | | |
docker run --rm --privileged multiarch/qemu-user-static --reset -p yes | |
# TODO(vytas): Revisit second half of 2021 to see if we still need to pin tox | |
# | |
# See also: https://github.com/tox-dev/tox/issues/1777 | |
# | |
- name: Run tox s390x | |
if: ${{ matrix.architecture == 's390x' }} | |
uses: docker://s390x/python:3.10-buster | |
env: | |
PIP_CACHE_DIR: /github/workspace/.pip/ | |
with: | |
# NOTE: without 'pip install ujson' tox fails to install it with "Requested ujson from <url> has different version in metadata: '0.0.0'" | |
# NOTE(vytas): installing fixtures/pbr because otherwise pip install | |
# inside tox fails with an import error on some older CPythons | |
args: | | |
/bin/bash -c " | |
lscpu && | |
mkdir -p $PIP_CACHE_DIR && | |
chown -R $(whoami) $PIP_CACHE_DIR && | |
pip install -U fixtures pip tox && | |
python --version && | |
pip --version && | |
tox --version && | |
pip install ujson && | |
tox -e py310_cython" | |
- name: Run tox arm64v8 | |
if: ${{ matrix.architecture == 'arm64v8' }} | |
uses: docker://arm64v8/python:3.10-buster | |
env: | |
PIP_CACHE_DIR: /github/workspace/.pip/ | |
with: | |
args: | | |
/bin/bash -c " | |
lscpu && | |
mkdir -p $PIP_CACHE_DIR && | |
chown -R $(whoami) $PIP_CACHE_DIR && | |
pip install -U fixtures pip tox && | |
python --version && | |
pip --version && | |
tox --version && | |
tox -e py310_cython" | |
- name: Fix cache permission | |
run: | | |
sudo chmod -R 777 .pip | |
sudo chmod -R 777 .tox |