GitHub workflow: specify Ubuntu 22.04 LTS to avoid Git issue with poetry-publish action #283
Workflow file for this run
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: tests | |
on: | |
push: | |
branches: | |
- master | |
pull_request: | |
jobs: | |
test: | |
timeout-minutes: 45 | |
defaults: | |
run: | |
shell: bash | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-latest, macos-latest, windows-latest] | |
python-version: ["3.9", "3.10", "3.11"] | |
env: | |
OS: ${{ matrix.os }} | |
PYTHON: ${{ matrix.python-version }} | |
steps: | |
- name: Set OS Environment Variables (Windows) | |
if: runner.os == 'Windows' | |
run: | | |
echo 'ACTIVATE_PYTHON_VENV=.venv/scripts/activate' >> $GITHUB_ENV | |
- name: Set OS Environment Variables (not Windows) | |
if: runner.os != 'Windows' | |
run: | | |
echo 'ACTIVATE_PYTHON_VENV=.venv/bin/activate' >> $GITHUB_ENV | |
- name: Check out repository | |
uses: actions/checkout@v3 | |
- name: Cache $HOME/.local # Significantly speeds up Poetry Install | |
uses: actions/cache@v3 | |
with: | |
path: ~/.local | |
key: dotlocal-${{ runner.os }}-${{ hashFiles('.github/workflows/tests.yml') }} | |
- name: Set up python ${{ matrix.python-version }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: 3.9 | |
- name: Upgrade pip | |
run: python -m pip install --upgrade pip | |
- name: Install poetry | |
uses: snok/install-poetry@v1 | |
with: | |
virtualenvs-create: true | |
virtualenvs-in-project: true | |
installer-parallel: false # Currently there seems to be some race-condition in windows | |
- name: Install library | |
run: poetry install --no-interaction | |
- name: Install ALSA development headers (Ubuntu) | |
if: runner.os == 'Linux' | |
run: sudo apt-get update && sudo apt-get install -y libasound2-dev | |
- uses: actions/cache@v3 | |
with: | |
path: ~/.cache/pre-commit/ | |
key: pre-commit-4|${{ env.pythonLocation }}|${{ hashFiles('.pre-commit-config.yaml') }} | |
- name: Pre-commit run | |
run: | | |
source ${{ env.ACTIVATE_PYTHON_VENV }} | |
pre-commit run --show-diff-on-failure --color=always --all-files | |
- name: Check tests folder existence | |
id: check_test_files | |
uses: andstor/file-existence-action@v2 | |
with: | |
files: "tests" | |
- name: Run tests | |
if: steps.check_test_files.outputs.files_exists == 'true' | |
run: | | |
source ${{ env.ACTIVATE_PYTHON_VENV }} | |
python -m pytest --cov=pyht --cov-report term --cov-report xml --junitxml=testresults.xml | |
coverage report | |
- name: Upload coverage to Codecov | |
if: steps.check_test_files.outputs.files_exists == 'true' | |
uses: codecov/codecov-action@v3 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
flags: unittests | |
env_vars: OS,PYTHON | |
name: Python ${{ matrix.python-version }} on ${{ runner.os }} | |
#---------------------------------------------- | |
# make sure docs build | |
#---------------------------------------------- | |
- name: Build HTML docs | |
run: | | |
source ${{ env.ACTIVATE_PYTHON_VENV }} | |
sphinx-build -b html docs/source/ docs/build/html |