Update GitHub Actions to latest major versions #368
Workflow file for this run
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: Tests | |
on: | |
pull_request: | |
push: | |
branches: [main] | |
jobs: | |
pre-commit: | |
name: Lint | |
runs-on: ubuntu-latest | |
steps: | |
- name: Cancel Previous Runs | |
uses: styfle/[email protected] | |
with: | |
access_token: ${{ github.token }} | |
- uses: actions/[email protected] | |
- uses: actions/[email protected] | |
with: | |
python-version: '3.10' | |
- uses: pre-commit/[email protected] | |
test: | |
name: Python | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: ["3.8", "3.9", "3.10", "3.11"] | |
steps: | |
- name: Cancel Previous Runs | |
uses: styfle/[email protected] | |
with: | |
access_token: ${{ github.token }} | |
- uses: actions/[email protected] | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/[email protected] | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install dependencies | |
run: | | |
python3 -m pip install --upgrade pip | |
python3 -m pip install -r requirements/CI-tests-pip/requirements.txt | |
- name: Test with pytest | |
run: | | |
python3 -m pytest --cov=tstrait --cov-report=xml --cov-branch -n 0 tests | |
- name: Upload coverage reports to Codecov | |
uses: codecov/[email protected] | |
env: | |
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | |
- name: Delete coverage | |
run: | | |
rm .coverage | |
dist-tests: | |
name: Distribution | |
runs-on: ubuntu-latest | |
steps: | |
- name: Cancel Previous Runs | |
uses: styfle/[email protected] | |
with: | |
access_token: ${{ github.token }} | |
- uses: actions/[email protected] | |
- uses: actions/[email protected] | |
with: | |
python-version: '3.10' | |
- name: Install dependencies | |
run: | | |
python3 -m pip install --upgrade pip | |
python3 -m pip install twine build | |
- name: Build sdist and wheel | |
run: | | |
python -m build | |
- name: Check distribution artefacts | |
run: | | |
python3 -m twine check dist/* | |
- name: Install wheel | |
run: | | |
python3 -m pip install dist/*.whl | |
- name: Import package | |
# Don't import from current dir | |
run: | | |
cd / | |
python3 -c "import tstrait" |