Update elements #197
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: main | |
on: [push, pull_request] | |
jobs: | |
lint: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install Hatch | |
run: pipx install hatch | |
- name: Set up python 3.8 | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.8" | |
cache: "pip" | |
cache-dependency-path: "pyproject.toml" | |
- name: Check formatting with black | |
run: hatch run black --check | |
- name: Check docstrings with darglint | |
run: hatch run darglint | |
- name: Type check with mypy | |
run: hatch run mypy | |
- name: Lint with ruff | |
run: hatch run ruff | |
test: | |
runs-on: ${{ matrix.os }}-latest | |
strategy: | |
matrix: | |
os: [ubuntu, macos, windows] | |
python-version: | |
- "3.7" | |
- "3.8" | |
- "3.9" | |
- "3.10" | |
- "3.11" | |
- "3.12" | |
- "pypy3.7" | |
- "pypy3.8" | |
- "pypy3.9" | |
- "pypy3.10" | |
fail-fast: false | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install Hatch | |
run: pipx install hatch | |
- name: Set up python ${{ matrix.python-version }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
allow-prereleases: true | |
cache: "pip" | |
cache-dependency-path: "pyproject.toml" | |
- name: Test with pytest | |
run: hatch run pytest-ci ${{ matrix.python-version }} | |
- name: Upload coverage to Codecov | |
uses: codecov/codecov-action@v3 | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install Hatch | |
run: pipx install hatch | |
- name: Build project | |
run: hatch build | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: artifacts | |
path: dist/* | |
if-no-files-found: error | |
pypi-publish: | |
runs-on: ubuntu-latest | |
needs: | |
- lint | |
- test | |
- build | |
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') | |
environment: pypi-publish | |
permissions: | |
id-token: write | |
steps: | |
- name: Download artifacts | |
uses: actions/download-artifact@v3 | |
with: | |
name: artifacts | |
path: dist | |
- name: Publish to PyPI | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
lint-spec-parser: | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
working-directory: spec_parser | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install Poetry | |
run: pipx install poetry | |
- name: Set up python 3.8 | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.8" | |
cache: "poetry" | |
cache-dependency-path: "spec_parser/poetry.lock" | |
- name: Install dependencies | |
run: poetry install --sync | |
- name: Check formatting with black | |
run: poetry run poe black --check | |
- name: Type check with mypy | |
run: poetry run poe mypy | |
- name: Lint with ruff | |
run: poetry run poe ruff | |
dummy-required-job: | |
runs-on: ubuntu-latest | |
needs: | |
- lint | |
- test | |
- build | |
- lint-spec-parser | |
if: always() | |
steps: | |
- run: exit 1 | |
if: ${{ contains( needs.*.result, 'failure' ) || contains( needs.*.result, 'cancelled' ) }} |