Merge pull request #12 from yoyonel/2024-08/refacto #90
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: Test & Lint | |
on: | |
pull_request: | |
push: | |
branches: | |
- master | |
- develop | |
jobs: | |
lint_cruft: | |
name: Check if automatic project update was successful | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
with: | |
ref: ${{ github.event.pull_request.head.sha }} | |
- name: Fail if .rej files exist as structure update was not successful | |
run: test -z "$(find . -iname '*.rej')" | |
lint: | |
name: Lint | |
needs: [lint_cruft] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.event.pull_request.head.sha }} | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.10' | |
- name: Resolve poetry dependency | |
uses: Gr1N/setup-poetry@v8 | |
- name: Poetry version | |
run: poetry --version | |
- name: Install project dependencies | |
run: poetry install | |
- name: Configure GIT to use https:// instead of git:// | |
run: git config --global url."https://".insteadOf git:// | |
- name: Mypy install types | |
run: | | |
poetry run mypy . 2>&1 || true | |
poetry run mypy --install-types --non-interactive | |
- name: Lint | |
run: poetry run pre-commit run -a | |
test: | |
name: Test | |
needs: [lint_cruft] | |
runs-on: ${{ matrix.platform }} | |
strategy: | |
max-parallel: 12 | |
matrix: | |
platform: [ubuntu-latest, windows-latest, macos-latest] | |
python-version: [3.9, '3.10', 3.11, 3.12] | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
ref: ${{ github.event.pull_request.head.sha }} | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v2 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install tox tox-gh-actions coveralls | |
- name: Test with tox | |
run: tox | |
env: | |
PLATFORM: ${{ matrix.platform }} | |
- name: Coveralls | |
# Error: Container action is only supported on Linux | |
# https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idstepsif | |
if: ${{ matrix.platform == 'ubuntu-latest' }} | |
uses: AndreMiras/coveralls-python-action@develop | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
parallel: true | |
coveralls_finish: | |
needs: [test] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Coveralls Finished | |
uses: AndreMiras/coveralls-python-action@develop | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
parallel-finished: true |