CI #133
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: CI | |
on: | |
push: | |
branches: ["main", "master", "ci-testing-*"] | |
pull_request: | |
branches: ["main", "master"] | |
schedule: | |
- cron: "0 6 * * MON" # Every Monday morning | |
workflow_dispatch: | |
jobs: | |
tests: | |
name: "Python ${{ matrix.python-version }} / ${{ matrix.os }}" | |
runs-on: "${{ matrix.os }}" | |
env: | |
USING_COVERAGE: "3.8,3.9,3.10,3.11" | |
strategy: | |
matrix: | |
os: [ubuntu-latest, macos-latest, windows-latest] | |
python-version: | |
- "3.7" | |
- "3.8" | |
- "3.9" | |
- "3.10" | |
- "3.11" | |
- "3.12.0-rc.1" | |
- "pypy3.9" | |
exclude: | |
- os: macos-latest | |
python-version: pypy3 | |
steps: | |
- uses: "actions/checkout@v3" | |
with: | |
# We want our tags here | |
fetch-depth: 0 | |
- uses: "actions/setup-python@v4" | |
with: | |
python-version: "${{ matrix.python-version }}" | |
- name: "Install dependencies" | |
run: | | |
python -VV | |
python -msite | |
python -m pip install --upgrade pip setuptools wheel | |
python -m pip install --upgrade coverage[toml] virtualenv tox tox-gh-actions | |
- name: "Run tox targets for ${{ matrix.python-version }}" | |
run: "python -m tox" | |
- name: Upload coverage data | |
uses: actions/upload-artifact@v3 | |
with: | |
name: coverage-data | |
path: ".coverage.*" | |
if-no-files-found: ignore | |
coverage: | |
needs: | |
- tests | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: "3.11" | |
- name: Install coverage | |
run: python -m pip install --upgrade coverage[toml] | |
- name: Download coverage data | |
uses: actions/download-artifact@v2 | |
with: | |
name: coverage-data | |
- name: Combine coverage | |
run: python -m coverage combine | |
# ignore-errors is so that we don't gag on missing code in .tox environments | |
- name: Generate the HTML report | |
run: python -m coverage html --skip-covered --skip-empty --ignore-errors | |
- name: Upload the HTML report | |
uses: actions/upload-artifact@v3 | |
with: | |
name: html-report | |
path: htmlcov | |
# ignore-errors is so that we don't gag on missing code in .tox environments | |
- name: Enforce the coverage | |
run: python -m coverage report --ignore-errors --fail-under 95 | |
package: | |
name: "Build & verify package" | |
runs-on: "ubuntu-latest" | |
steps: | |
- uses: "actions/checkout@v3" | |
with: | |
# We want our tags here | |
fetch-depth: 0 | |
- uses: hynek/[email protected] | |
install-dev: | |
strategy: | |
matrix: | |
os: ["ubuntu-latest", "windows-latest", "macos-latest"] | |
name: "Verify dev env / ${{ matrix.os }}" | |
runs-on: "${{ matrix.os }}" | |
steps: | |
- uses: "actions/checkout@v3" | |
- uses: "actions/setup-python@v4" | |
with: | |
python-version: "3.11" | |
- name: "Install in dev mode" | |
run: "python -m pip install -e .[dev]" | |
- name: "Import package" | |
run: "python -c 'import hamcrest; print(hamcrest.__version__)'" |