|
| 1 | +name: CI |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - main |
| 7 | + tags: |
| 8 | + - '**' |
| 9 | + pull_request: |
| 10 | + |
| 11 | +env: |
| 12 | + MPLBACKEND: Agg |
| 13 | + PYTEST_ADDOPTS: --color=yes |
| 14 | + GITHUB_PR_NUMBER: ${{ github.event.number }} |
| 15 | + |
| 16 | +jobs: |
| 17 | + tests: |
| 18 | + runs-on: ${{ matrix.os }} |
| 19 | + strategy: |
| 20 | + matrix: |
| 21 | + include: |
| 22 | + - os: ubuntu-latest |
| 23 | + python-version: "3.10" |
| 24 | + install-method: mamba |
| 25 | + |
| 26 | + - os: ubuntu-latest |
| 27 | + python-version: "3.11" |
| 28 | + install-method: mamba |
| 29 | + extra-args: ["codecov"] |
| 30 | + |
| 31 | + defaults: |
| 32 | + run: |
| 33 | + # We need login shells (-l) for micromamba to work. |
| 34 | + shell: bash -leo pipefail {0} |
| 35 | + |
| 36 | + steps: |
| 37 | + - uses: actions/checkout@v4 |
| 38 | + with: |
| 39 | + fetch-depth: 0 |
| 40 | + |
| 41 | + - name: Prepare mamba installation |
| 42 | + if: matrix.install-method == 'mamba' && contains(github.event.pull_request.labels.*.name, 'documentation-only') == false |
| 43 | + env: |
| 44 | + PYTHON_VERSION: ${{ matrix.python-version }} |
| 45 | + run: | |
| 46 | + # setup correct python version |
| 47 | + sed -i -e "s/- python.*/- python=$PYTHON_VERSION/g" environment.yml |
| 48 | +
|
| 49 | + - name: mamba setup |
| 50 | + if: matrix.install-method == 'mamba' && contains(github.event.pull_request.labels.*.name, 'documentation-only') == false |
| 51 | + uses: mamba-org/setup-micromamba@v1 |
| 52 | + with: |
| 53 | + environment-file: environment.yml |
| 54 | + cache-downloads: true |
| 55 | + |
| 56 | + - name: Install dependencies |
| 57 | + env: |
| 58 | + PYTHON_VERSION: ${{ matrix.python-version }} |
| 59 | + run: | |
| 60 | + python --version |
| 61 | + pip install pytest-cov restructuredtext-lint pytest-xdist 'coverage!=6.3.0' |
| 62 | + pip install -e .[all] |
| 63 | + pip freeze |
| 64 | + pip list |
| 65 | +
|
| 66 | + - name: List installed package versions (conda) |
| 67 | + if: matrix.environment-type == 'mamba' |
| 68 | + run: micromamba list |
| 69 | + |
| 70 | + - name: Initialize CASAData |
| 71 | + run: | |
| 72 | + mkdir -p ~/.casa/data/ |
| 73 | + python -c "import casatools;" |
| 74 | +
|
| 75 | + - name: Tests |
| 76 | + run: | |
| 77 | + pytest -vv --cov --cov-branch --cov-report=xml |
| 78 | +
|
| 79 | + - name: Upload coverage to Codecov |
| 80 | + uses: codecov/codecov-action@v5 |
| 81 | + env: |
| 82 | + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} |
0 commit comments