Skip to content

Commit

Permalink
ci: Migrate to Poetry
Browse files Browse the repository at this point in the history
Signed-off-by: Samuel Giffard <[email protected]>
  • Loading branch information
Mulugruntz committed Jan 17, 2024
1 parent 6edea1f commit 2e5b957
Show file tree
Hide file tree
Showing 3 changed files with 780 additions and 24 deletions.
47 changes: 27 additions & 20 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -96,53 +96,60 @@ jobs:
- uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
architecture: x64

- name: Show system
run: |
python --version
uname -a
lsb_release -a
- name: Install Poetry
uses: snok/install-poetry@v1
with:
virtualenvs-create: true
virtualenvs-in-project: true

- name: Load cached venv
id: cached-poetry-dependencies
uses: actions/cache@v3
with:
path: .venv
key: venv-${{ runner.os }}-${{ matrix.python-version }}-${{ matrix.celery }}-${{ hashFiles('**/poetry.lock') }}

- name: Install dependencies
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install -r requirements_test.txt
pip install "celery${{ matrix.celery }}"
pip install pytest-github-actions-annotate-failures
poetry install --no-interaction --no-root --with=ci --with=dev
poetry add "celery${{ matrix.celery }}"
- name: Install project
run: poetry install --no-interaction

- name: Check with black
run: black --check .
run: poetry run black --check .

- name: Check with mypy
if: ${{ !startsWith(matrix.python-version, 'pypy') }}
run: mypy
run: poetry run mypy

- name: Lint with flake8
run: |
pip install flake8
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics --exclude .github
poetry run flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics --exclude .github
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics --exclude .github
poetry run flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics --exclude .github
- name: Test with pytest
run: |
coverage run -m pytest -v -s tests
coverage report
poetry run coverage run -m pytest -v -s tests
poetry run coverage report
- name: Code Climate Coverage Action
uses: paambaati/codeclimate-action@v3.2.0
uses: paambaati/codeclimate-action@v5.0.0
env:
# According to CodeClimate documentation, this is not considered a sensitive value.
# https://docs.codeclimate.com/docs/finding-your-test-coverage-token#regenerating-a-repos-test-reporter-id
CC_TEST_REPORTER_ID: 4967416d540739937e0eebfb13a3cf2f8dfbddd762f2b1ec800e83d18fb5efbb
with:
coverageCommand: coverage xml
coverageCommand: poetry run coverage xml
debug: true

- name: Prepare badges
Expand Down
Loading

0 comments on commit 2e5b957

Please sign in to comment.