Merge pull request #835 from FlorianPfaff/dependabot/pip/astropy-iers… #604
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: Test workflow | |
permissions: | |
contents: read | |
checks: write | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
backend: [numpy, pytorch, jax] | |
permissions: | |
checks: write | |
pull-requests: write | |
steps: | |
- name: Check out repository | |
uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.11" | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
python -m pip install poetry | |
poetry env use python | |
poetry install --extras "healpy_support" | |
- name: Install pytorch specific dependencies | |
if: ${{ matrix.backend == 'pytorch' }} | |
run: | | |
poetry install --extras "healpy_support" --extras "pytorch_support" | |
poetry run python -m pip install torch==2.1.0+cpu torchaudio==2.1.0+cpu -f https://download.pytorch.org/whl/torch_stable.html | |
- name: Run tests | |
run: | | |
export PYRECEST_BACKEND=${{ matrix.backend }} | |
poetry run python -m pytest --rootdir . -v --strict-config --junitxml=junit_test_results_${{ matrix.backend }}.xml ./pyrecest | |
env: | |
PYTHONPATH: ${{ github.workspace }} | |
- name: Upload test result artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ matrix.backend }}-test-results | |
path: junit_test_results_${{ matrix.backend }}.xml | |
publish-results: | |
needs: test | |
runs-on: ubuntu-latest | |
if: always() | |
permissions: | |
checks: write | |
pull-requests: write | |
steps: | |
- name: Download all test result artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
path: test-results | |
- name: Publish test results | |
uses: EnricoMi/publish-unit-test-result-action@v2 | |
with: | |
files: | | |
test-results/numpy-test-results/junit_test_results_numpy.xml | |
test-results/pytorch-test-results/junit_test_results_pytorch.xml | |
test-results/jax-test-results/junit_test_results_jax.xml |