Skip to content

Merge pull request #5 from 21cmfast/pre-commit-ci-update-config #36

Merge pull request #5 from 21cmfast/pre-commit-ci-update-config

Merge pull request #5 from 21cmfast/pre-commit-ci-update-config #36

Workflow file for this run

name: Tests
on:
- push
- pull_request
jobs:
tests:
env:
ENV_NAME: tests
PYTHON: ${{ matrix.python-version }}
OS: ${{ matrix.os }}
name: Testing
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest]
python-version: ["3.9", "3.10", "3.11"]
steps:
- uses: actions/checkout@master
with:
fetch-depth: 0
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: set PY
run: echo "PY=$(python -c 'import hashlib, sys;print(hashlib.sha256(sys.version.encode()+sys.executable.encode()).hexdigest())')" >> $GITHUB_ENV
- name: Setup Environment
run: |
pip install -U coverage
pip install .[dev]
- name: Run Tests
run: |
coverage run --parallel-mode -m pytest
- name: Upload coverage data
uses: actions/upload-artifact@v4
with:
name: coverage-data-tests-${{ matrix.python-version }}-${{ matrix.os }}
path: ".coverage.*"
if-no-files-found: error
downstream:
env:
PYTHON: 3.11
OS: ubuntu-latest
name: Downstream
runs-on: ubuntu-latest
strategy:
matrix:
package: ['py21cmfast-tools']
fail-fast: false
steps:
- uses: actions/checkout@master
with:
fetch-depth: 0
- uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON }}
- name: Setup Environment
run: |
pip install -U coverage
pip install .[dev]
- name: Get downstream package
run: |
cd ..
git clone https://github.com/21cmfast/${{ matrix.package }}
cd ${{ matrix.package }}
pip install .[dev]
- name: Run Tests
run: |
coverage run --parallel-mode -m pytest ../${{ matrix.package}}
- name: Upload coverage data
uses: actions/upload-artifact@v4
with:
name: coverage-data-downstream-${{ matrix.package }}
path: ".coverage.*"
if-no-files-found: error
codecov:
needs: [tests]
name: Codecov Reporting
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Download coverage data.
uses: actions/download-artifact@v4
with:
pattern: coverage-data-*
merge-multiple: true
- uses: actions/setup-python@v5
with:
python-version: 3.11
- name: Install dependencies
run: pip install .[dev]
- name: Combine coverage data and display human readable report
run: |
coverage combine
coverage report
- name: Create coverage report
run: |
coverage xml
- name: Upload coverage report
uses: codecov/[email protected]
with:
token: ${{ secrets.CODECOV_TOKEN }}