Merge pull request #353 from European-XFEL/dependabot/pip/dot-github/… #849
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] | |
tags: ["*"] | |
pull_request: | |
env: | |
SYSTEM_PACKAGES: gcc g++ xvfb qtbase5-dev | |
jobs: | |
tests: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: ["3.10"] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Cache APT Packages | |
uses: awalsh128/[email protected] | |
with: | |
packages: ${{ env.SYSTEM_PACKAGES }} | |
- uses: actions/cache@v4 | |
with: | |
path: ~/.cache/pip | |
key: ${{ runner.os }}-${{ matrix.python-version }}-pip-${{ hashFiles('**/pyproject.toml') }}-${{ hashFiles('.github/dependabot/constraints.txt') }} | |
- name: Install Python dependencies | |
run: | | |
python3 -m pip install -e .[gui,backend,test] --constraint .github/dependabot/constraints.txt | |
- name: Test with pytest | |
run: | | |
python3 -m pytest --cov=damnit --cov-report=xml -v | |
- name: Upload coverage reports to Codecov | |
uses: codecov/codecov-action@v4 | |
with: | |
fail_ci_if_error: true | |
token: ${{ secrets.CODECOV_TOKEN }} | |
verbose: true | |
publish: | |
runs-on: ubuntu-latest | |
if: ${{ startsWith(github.ref, 'refs/tags/') }} | |
needs: tests | |
permissions: | |
id-token: write | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Set up Python 3.10 | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.10" | |
- name: Build packages | |
run: | | |
python3 -m pip install build | |
python3 -m build | |
- name: Publish package distributions to PyPI | |
uses: pypa/gh-action-pypi-publish@release/v1 |