Program builder interface #303
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: Pytest and coveralls | |
on: | |
workflow_dispatch: | |
pull_request: | |
types: | |
- opened | |
- reopened | |
- synchronize | |
branches: | |
- '**' | |
paths: | |
- 'qupulse/**y' | |
- 'qctoolkit/**' | |
- 'tests/**' | |
- 'setup.*' | |
- 'pyproject.toml' | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
python-version: ["3.8", "3.9", "3.10"] | |
time-type: ["fractions", "gmpy2"] | |
env: | |
INSTALL_EXTRAS: tests,plotting,zurich-instruments,tektronix,tabor-instruments | |
steps: | |
- name: Add gmpy extra feature | |
if: ${{ matrix.time-type }} == 'gmpy2' | |
run: | | |
echo "INSTALL_EXTRAS=${{ env.INSTALL_EXTRAS }},Faster-fractions" >> $GITHUB_ENV | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v2 | |
with: | |
python-version: ${{ matrix.python-version }} | |
# supported since 2.3 | |
cache: pip | |
cache-dependency-path: setup.cfg | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
python -m pip install coverage coveralls | |
- name: Install package | |
run: | | |
python -m pip install .[${{ env.INSTALL_EXTRAS }}] | |
- name: Test with pytest | |
run: | | |
coverage run -m pytest --junit-xml pytest.xml | |
- name: Upload coverage data to coveralls.io | |
run: coveralls --service=github | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
COVERALLS_FLAG_NAME: python-${{ matrix.python-version }}-${{ matrix.time-type }} | |
COVERALLS_PARALLEL: true | |
- name: Upload Test Results | |
if: always() | |
uses: actions/upload-artifact@v2 | |
with: | |
name: Unit Test Results ( ${{ matrix.python-version }}-${{ matrix.time-type }} ) | |
path: | | |
pytest.xml | |
coveralls: | |
name: Indicate completion to coveralls.io | |
needs: test | |
runs-on: ubuntu-latest | |
container: python:3-slim | |
steps: | |
- name: Finished | |
run: | | |
pip3 install --upgrade coveralls | |
coveralls --service=github --finish | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
event_file: | |
name: "Event File" | |
runs-on: ubuntu-latest | |
steps: | |
- name: Upload | |
uses: actions/upload-artifact@v2 | |
with: | |
name: Event File | |
path: ${{ github.event_path }} |