Tidy CI pipelines and publish on tag #529
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: CI | |
on: | |
push: | |
branches: [master] | |
pull_request: ~ | |
env: | |
FORCE_COLOR: 1 | |
jobs: | |
lint: | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: actions/checkout@master | |
- uses: actions/cache@v3 | |
with: | |
path: ~/.local/share/virtualenvs | |
key: ${{ runner.os }}-poetry-${{ hashFiles('poetry.lock') }} | |
restore-keys: | | |
${{ runner.os }}-poetry- | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: '3.11' | |
- name: Install poetry | |
uses: abatilo/[email protected] | |
with: | |
poetry-version: '1.6.1' | |
- name: Install pip dependencies | |
run: poetry install | |
- name: pre-commit | |
run: poetry run pre-commit run --all-files --show-diff-on-failure | |
test: | |
strategy: | |
matrix: | |
python-version: ['3.11', '3.10', '3.9', '3.8', '3.7'] | |
poetry-version: ['1.6.1'] | |
runs-on: ubuntu-20.04 | |
env: | |
IS_COVERAGE_ALLOWED: ${{ secrets.CODECOV_TOKEN != '' }} | |
steps: | |
- uses: actions/checkout@master | |
- uses: actions/cache@v3 | |
with: | |
path: ~/.local/share/virtualenvs | |
key: ${{ runner.os }}-${{ matrix.python-version }}-poetry-${{ hashFiles('poetry.lock') }} | |
restore-keys: | | |
${{ runner.os }}-${{ matrix.python-version }}-poetry- | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install poetry | |
uses: abatilo/[email protected] | |
with: | |
poetry-version: ${{ matrix.poetry-version }} | |
- name: Install pip dependencies | |
run: poetry install | |
- name: Test | |
run: poetry run pytest --cov-report xml --cov=iolite_client test/ | |
- name: Upload coverage | |
if: ${{ matrix.python-version == '3.11' && env.IS_COVERAGE_ALLOWED == 'true' }} | |
uses: codecov/codecov-action@v3 | |
with: | |
files: coverage.xml |