Skip to content

Commit

Permalink
CI improvements (#5061)
Browse files Browse the repository at this point in the history
* Add step to vendor dependencies in the Makefile

* Reorganize the order of jobs and dependencies

* Make all jobs run only after the lint stage
  • Loading branch information
oz123 committed Apr 20, 2022
1 parent 853aaf8 commit 891486e
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 23 deletions.
53 changes: 30 additions & 23 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
name: CI

on:
push:
paths-ignore:
Expand Down Expand Up @@ -29,10 +28,38 @@ on:
- ".gitmodules"
- ".gitattributes"
- ".editorconfig"

jobs:
lint:
name: Check code linting
runs-on: ubuntu-latest
env:
PIPENV_DEFAULT_PYTHON_VERSION: ${{ matrix.python-version }}
PYTHONWARNINGS: ignore:DEPRECATION
PYTHONIOENCODING: "utf-8"
GIT_ASK_YESNO: "false"
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: 3.9
- run: |
python -m pip install pre-commit
pre-commit run --all-files --verbose --show-diff-on-failure
vendor:
name: Vendoring
needs: lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: 3.9
- run: |
python -m pip install --upgrade wheel invoke parver bs4 vistir towncrier
python -m invoke vendoring.update
tests:
name: ${{matrix.os}} / ${{ matrix.python-version }}
needs: lint
runs-on: ${{ matrix.os }}-latest
strategy:
fail-fast: false
Expand All @@ -52,7 +79,6 @@ jobs:
id: python-path
run: |
echo ::set-output name=path::$(python -c "import sys; print(sys.executable)")
- name: Install latest pip, setuptools, wheel
run: |
python -m pip install --upgrade pip setuptools wheel --upgrade-strategy=eager
Expand All @@ -67,14 +93,6 @@ jobs:
git submodule update --init --recursive
python -m pip install -e . --upgrade
pipenv install --deploy --dev --python=${{ steps.python-path.outputs.path }}
- name: Lint check of the code
env:
PIPENV_DEFAULT_PYTHON_VERSION: ${{ matrix.python-version }}
PYTHONWARNINGS: ignore:DEPRECATION
PYTHONIOENCODING: "utf-8"
GIT_ASK_YESNO: "false"
run: |
pipenv run pre-commit run --all-files --verbose --show-diff-on-failure
- name: Run tests
env:
PIPENV_DEFAULT_PYTHON_VERSION: ${{ matrix.python-version }}
Expand All @@ -90,6 +108,7 @@ jobs:
build:
name: Build Package
needs: lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
Expand All @@ -100,15 +119,3 @@ jobs:
- run: |
python -m build
twine check dist/*
vendor:
name: Vendoring
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: 3.9
- run: |
python -m pip install --upgrade wheel invoke parver bs4 vistir towncrier
python -m invoke vendoring.update
7 changes: 7 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,13 @@ tests: virtualenv submodules test-install
. $(get_venv_path)/bin/activate && \
pipenv run pytest -ra $(parallel) -vvv --full-trace --tb=long

.PHONY: vendor
vendor: virtualenv
. $(get_venv_path)/bin/activate && \
python -m pip install invoke && \
python -m pip install -e .[dev] && \
python -m invoke vendoring.update

.PHONY: test-specific
test-specific: submodules virtualenv test-install
. $(get_venv_path)/bin/activate && pipenv run pytest -ra -k '$(tests)'
Expand Down
1 change: 1 addition & 0 deletions news/5061.process.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Make all CI jobs run only after the lint stage. Also added a makefile target for vendoring the packages.

0 comments on commit 891486e

Please sign in to comment.