|
| 1 | +name: CI |
| 2 | + |
| 3 | +on: |
| 4 | + pull_request: |
| 5 | + branches: [main] |
| 6 | + push: |
| 7 | + branches-ignore: [main] |
| 8 | + workflow_dispatch: |
| 9 | + |
| 10 | +jobs: |
| 11 | + pre-commit: |
| 12 | + runs-on: ubuntu-latest |
| 13 | + steps: |
| 14 | + - uses: actions/checkout@v4.2.2 |
| 15 | + - uses: actions/setup-python@v5 |
| 16 | + - uses: pre-commit/action@v3.0.1 |
| 17 | + |
| 18 | + test: |
| 19 | + name: Test (Python ${{ matrix.python-version }}) |
| 20 | + runs-on: ubuntu-latest |
| 21 | + strategy: |
| 22 | + fail-fast: true |
| 23 | + matrix: |
| 24 | + python-version: ["3.11", "3.12", "3.13"] |
| 25 | + |
| 26 | + steps: |
| 27 | + - name: Checkout source |
| 28 | + uses: actions/checkout@v4.2.2 |
| 29 | + |
| 30 | + - name: Setup conda environment |
| 31 | + uses: conda-incubator/setup-miniconda@v3 |
| 32 | + with: |
| 33 | + miniconda-version: "latest" |
| 34 | + python-version: ${{ matrix.python-version }} |
| 35 | + environment-file: ci/environment-${{ matrix.python-version }}.yml |
| 36 | + activate-environment: access-nri-intake-test |
| 37 | + auto-activate-base: false |
| 38 | + |
| 39 | + - name: Install source |
| 40 | + shell: bash -l {0} |
| 41 | + run: python -m pip install . |
| 42 | + |
| 43 | + - name: Create default config file |
| 44 | + shell: bash -l {0} |
| 45 | + run: | |
| 46 | + mkdir -p ~/.mopper |
| 47 | + cat <<EOF > ~/.mopper/user.yml |
| 48 | + creator_name: "CI Bot" |
| 49 | + organisation: "ACCESS-NRI" |
| 50 | + creator_email: "ci@example.com" |
| 51 | + creator_url: "https://example.com" |
| 52 | + EOF |
| 53 | +
|
| 54 | + - name: List installed packages |
| 55 | + shell: bash -l {0} |
| 56 | + run: conda list |
| 57 | + |
| 58 | + - name: Run tests |
| 59 | + shell: bash -l {0} |
| 60 | + run: coverage run -m --source=access_nri_intake pytest tests |
| 61 | + |
| 62 | + - name: Generate coverage report |
| 63 | + shell: bash -l {0} |
| 64 | + run: coverage xml |
| 65 | + |
| 66 | + - name: Upload code coverage |
| 67 | + uses: codecov/codecov-action@v5 |
| 68 | + with: |
| 69 | + token: ${{ secrets.codecov_token }} |
| 70 | + files: ./coverage.xml |
0 commit comments