Handle optional test paths for pytest #32
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: mutmut | |
on: | |
push: | |
branches: | |
- spike-mutation-testing-mutmut | |
jobs: | |
python-dependencies: | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v3 | |
- run: | | |
echo "PYTHON_VERSION=$(cat .python-version)" >> $GITHUB_ENV | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ env.PYTHON_VERSION }} | |
cache: 'pipenv' | |
- name: Install Pipenv | |
run: pip install pipenv==2023.8.22 | |
- name: Install virtual environment | |
run: | | |
sudo apt-get install libsnappy-dev | |
pipenv install --dev | |
test-mutmut: | |
needs: python-dependencies | |
strategy: | |
matrix: | |
mutation-package-under-test: [ authentication, forms, publisher, questionnaire, routes ] | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v3 | |
- run: | | |
echo "PYTHON_VERSION=$(cat .python-version)" >> $GITHUB_ENV | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ env.PYTHON_VERSION }} | |
cache: 'pipenv' | |
- name: Install apt dependencies | |
run: | | |
sudo apt-get install libsnappy-dev libgconf-2-4 jq | |
# Install wkthtmltopdf with patched Qt | |
sudo apt-get install -y xfonts-base xfonts-75dpi | |
wget https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6-1/wkhtmltox_0.12.6-1.bionic_amd64.deb | |
sudo dpkg -i wkhtmltox_0.12.6-1.bionic_amd64.deb | |
- name: Write app version | |
run: printf "local" > .application-version | |
- name: Install pipenv | |
run: pip install pipenv==2023.8.22 | |
- name: Install virtual environment | |
run: pipenv install --dev | |
- name: Load templates | |
run: make load-design-system-templates | |
- name: Compile translations | |
run: make translate | |
- name: Link env vars | |
run: ln -sf .development.env .env | |
- name: Run mutmut | |
run: | | |
# hacky way to handle unit and integration paths for the package under test for now | |
packages_to_run_with_pytest="" | |
if [ -d tests/app/${{ matrix.mutation-package-under-test }} ]; then | |
packages_to_run_with_pytest="tests/app/${{ matrix.mutation-package-under-test }}" | |
fi | |
if [ -d tests/integration/${{ matrix.mutation-package-under-test }} ]; then | |
packages_to_run_with_pytest="${packages_to_run_with_pytest} tests/integration/${{ matrix.mutation-package-under-test }}" | |
fi | |
echo ${packages_to_run_with_pytest} | |
pipenv run mutmut run \ | |
--paths-to-mutate "app/${{ matrix.mutation-package-under-test }}/" \ | |
--runner "py.test -n auto ${packages_to_run_with_pytest}" \ | |
--no-progress \ | |
--CI | |
- name: Save HTML output | |
run: | | |
pipenv run mutmut html | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: mutation-test-report-${{ matrix.mutation-package-under-test }} | |
path: html/ |