pytest #5868
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 | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: ${{ github.ref != 'refs/heads/master' }} | |
on: | |
push: | |
pull_request: | |
types: [opened, synchronize, reopened, ready_for_review] | |
schedule: | |
- cron: '0 6 * * 1' | |
workflow_dispatch: | |
# execute commands with conda aware shell by default: | |
defaults: | |
run: | |
shell: bash -l {0} | |
jobs: | |
event_file: | |
name: "Upload PR Event File" | |
runs-on: ubuntu-latest | |
steps: | |
- name: Upload | |
uses: actions/upload-artifact@v4 | |
with: | |
name: Event File | |
path: ${{ github.event_path }} | |
main: | |
name: pytest | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-latest] | |
py: ['3.9', '3.10', '3.11'] | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: '0' # Fetch all history for all tags and branches | |
- uses: CagtayFabry/pydeps2env@v1.2.0 | |
with: | |
files: 'pyproject.toml' | |
channels: 'conda-forge defaults' | |
extras: 'test vis media' | |
build_system: 'include' | |
- name: Setup Conda Environment | |
uses: mamba-org/setup-micromamba@v1.9.0 | |
with: | |
environment-file: ./environment.yml | |
environment-name: weldx | |
init-shell: >- | |
bash | |
powershell | |
cache-environment: true | |
create-args: >- | |
python=${{ matrix.py }} | |
wheel | |
pip | |
- name: pip installs | |
run: | | |
python -m pip install -e . | |
- name: activate env | |
run: micromamba activate weldx | |
- name: install cookiecutter | |
if: matrix.py == '3.10' | |
run: | | |
pip install cookiecutter | |
- name: create installable quality standard from repo | |
if: matrix.py == '3.10' | |
run: | | |
cookiecutter --no-input https://github.com/BAMWeldx/quality-standard-template | |
- name: install quality standard | |
if: matrix.py == '3.10' | |
run: | | |
pip install -e ./quality_standard_demo | |
- name: run pytest | |
run: | | |
pytest -n 2 --runslow --junit-xml pytest.xml | |
- name: Upload Test Results | |
if: always() && (matrix.py == '3.10') | |
uses: actions/upload-artifact@v4 | |
with: | |
name: Unit Test Results | |
path: pytest.xml | |
- name: run pytest on notebooks (append coverage) | |
if: matrix.py == '3.10' | |
run: | | |
pytest -n 2 --dist loadfile --nbval --current-env --cov-append ./doc/src/tutorials/ | |
- name: test with WeldxFile | |
if: matrix.py == '3.10' | |
run: | | |
pytest -n 2 --weldx-file-rw-buffer --weldx-file-rw-buffer-disp-header --cov-append ./weldx/tests/asdf_tests | |
- name: test quality standard | |
if: matrix.py == '3.10' | |
run: | | |
pytest --cov-append ./weldx/tests/asdf_tests/quality_standards_check.py | |
- name: test installable quality standard from template repository | |
if: matrix.py == '3.10' | |
run: | | |
pytest --cov-append ./weldx/tests/asdf_tests/installable_quality_standard_check.py | |
- name: coverage xml (combination is performed by pytest-cov) | |
if: matrix.py == '3.10' | |
run: coverage xml | |
- name: codecov.io | |
if: matrix.py == '3.10' | |
uses: codecov/codecov-action@v4.5.0 | |
compat: | |
name: pytest | |
if: | | |
(github.event.pull_request.draft == false) || | |
(github.event_name == 'workflow_dispatch') || | |
(github.ref == 'refs/heads/master') | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [windows-latest] | |
py: ['3.9'] | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: '0' # Fetch all history for all tags and branches | |
- uses: CagtayFabry/pydeps2env@v1.2.0 | |
with: | |
files: 'pyproject.toml' | |
channels: 'conda-forge defaults' | |
extras: 'test vis media' | |
build_system: 'include' | |
- name: Setup Conda Environment | |
uses: mamba-org/setup-micromamba@v1.9.0 | |
with: | |
environment-file: ./environment.yml | |
environment-name: weldx | |
init-shell: >- | |
bash | |
powershell | |
cache-environment: true | |
create-args: >- | |
python=${{ matrix.py }} | |
wheel | |
pip | |
- name: activate env | |
run: micromamba activate weldx | |
- name: pip installs | |
run: | | |
python -m pip install -e . | |
- name: setup matplotlib | |
if: startsWith(runner.os, 'Windows') | |
run: | | |
if not exist %userprofile%\.matplotlib\ ( mkdir %userprofile%\.matplotlib\ ) | |
echo backend: Agg > %userprofile%\.matplotlib\matplotlibrc | |
shell: cmd | |
- name: run pytest | |
run: | | |
pytest -n 2 --runslow | |
echo "Exited with '$?'" |