Tests using conda #234
This file contains hidden or 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: Tests using conda | |
| on: | |
| push: | |
| branches: | |
| - main | |
| pull_request: | |
| types: [ "opened", "synchronize", "reopened", "labeled", "unlabeled" ] | |
| branches: [ "main" ] | |
| schedule: | |
| # Syntax: "[min] [hour] [day of the month] [month] [day of the week]" | |
| # Note: day of the week starts in Sunday (0), ends in Saturday (6) | |
| - cron: "0 0 * * 1" # runs at 00:00 UTC on Mondays | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| tests: | |
| name: ${{ matrix.os }} -- Python ${{ matrix.python-version }} | |
| runs-on: ${{ matrix.os }} | |
| env: | |
| IS_ENV_LOCKED: true # set as 'true' if using conda-lock | |
| PY: ${{ matrix.python-version }} | |
| permissions: | |
| # Gives the action the necessary permissions for publishing new | |
| # comments in pull requests. Required for Coverage reports. | |
| pull-requests: write | |
| contents: write | |
| checks: write | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: ["windows-latest", "ubuntu-latest", "macos-13"] | |
| python-version: ["3.11", "3.12"] | |
| steps: | |
| - uses: actions/checkout@v5 | |
| with: | |
| fetch-depth: 0 | |
| - name: Set up Python ${{ matrix.python-version }} | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| architecture: x64 | |
| - name: Display Python version | |
| run: python -c "import sys; print(sys.version)" | |
| - name: Setup Conda | |
| uses: conda-incubator/setup-miniconda@v3 | |
| with: | |
| channels: conda-forge | |
| channel-priority: true | |
| auto-activate-base: false | |
| allow-softlinks: true | |
| activate-environment: '' | |
| - name: Check Conda | |
| run: | | |
| conda info | |
| conda list | |
| conda config --show-sources | |
| conda config --show | |
| - name: Configuring conda-lock | |
| if: env.IS_ENV_LOCKED | |
| run: | | |
| conda install conda-lock | |
| - name: Configuring conda-devenv | |
| run: | | |
| conda install "conda-devenv>=3" | |
| conda devenv | |
| - name: Build and Test on Ubuntu/macOS | |
| if: matrix.os != 'windows-latest' | |
| shell: bash -el {0} | |
| run: | | |
| conda activate blank-project | |
| inv tests -n 2 --generate-cov-xml --check-coverage | |
| inv tests-ipynb --generate-cov-xml --check-coverage --cov-append | |
| - name: Build and Test on Windows | |
| if: matrix.os == 'windows-latest' | |
| shell: pwsh | |
| run: | | |
| conda activate blank-project | |
| inv tests -n 2 --generate-cov-xml --check-coverage | |
| inv tests-ipynb --generate-cov-xml --check-coverage --cov-append | |
| - name: Upload Coverage PR comment | |
| if: ${{ matrix.os == 'ubuntu-latest' && matrix.python-version == '3.12' }} | |
| uses: py-cov-action/python-coverage-comment-action@v3 | |
| with: | |
| GITHUB_TOKEN: ${{ github.token }} | |
| ANNOTATE_MISSING_LINES: true | |
| ANNOTATION_TYPE: error | |
| - name: Check if diff code has 100% of coverage (Unix) | |
| if: matrix.os != 'windows-latest' | |
| shell: bash -el {0} | |
| run: | | |
| conda activate blank-project | |
| inv diff-coverage | |
| - name: Check if diff code has 100% of coverage (Win) | |
| if: matrix.os == 'windows-latest' | |
| shell: pwsh | |
| run: | | |
| conda activate blank-project | |
| inv diff-coverage |