Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

move dependency check in dedicated workflow #3451

Merged
merged 9 commits into from
Jan 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
78 changes: 78 additions & 0 deletions .github/workflows/dependencies.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
name: Check deps

on:
pull_request:
paths:
- setup.py
- requirements.txt
- requirements-dev.in
- requirements-dev.txt
- .github/workflows/dependencies.yml

env:
DEBIAN_FRONTEND: noninteractive

permissions:
contents: write

jobs:
quality:
name: Checking dependency graph
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: ['ubuntu-20.04']
python-version: ['3.8']

steps:
- uses: actions/checkout@v3

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

- uses: actions/cache@v3
with:
path: |
~/.cache/pip
~/.wheel_dir

key: ${{ matrix.os }}-pip-${{ matrix.python-version }}
restore-keys: |
${{ matrix.os }}-pip-${{ matrix.python-version }}

- name: Install dependencies
run: |
pip3 wheel --wheel-dir=~/.wheel_dir pip wheel setuptools
pip3 install --find-links=~/.wheel_dir --upgrade pip wheel setuptools
pip3 wheel --wheel-dir=~/.wheel_dir -r requirements-dev.txt
pip3 install --find-links=~/.wheel_dir --upgrade -r requirements-dev.txt

- name: Check dependency graph
run: |
pip-compile -q
pip-compile -q requirements-dev.in

- name: Verify dependency graph is ok
uses: tj-actions/verify-changed-files@v13
id: verify-changed-files
with:
files: |
requirements.txt
requirements-dev.txt

- name: Validating graph
if: steps.verify-changed-files.outputs.files_changed == 'true' && github.actor != 'dependabot[bot]'
run: |
echo "Dependency file(s) changed: ${{ steps.verify-changed-files.outputs.changed_files }}"
core.setFailed('Please add your new dependencies in setup.py and/or requirements-dev.in then run pip-compile to add them in requirements. (see docs/contribute/development)')

- name: Dependabot commit dependencies
uses: stefanzweifel/git-auto-commit-action@v4
if: ${{ github.actor == 'dependabot[bot]' }}
with:
commit_message: Apply dependencies update by dependabot
commit_user_name: dependabot[bot]
commit_user_email: [email protected]
commit_author: dependabot[bot] <[email protected]>
61 changes: 26 additions & 35 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,22 @@
name: Linting

on:
push:
pull_request:
paths:
- 'geotrek/**'
- '.github/workflows/lint.yml'

env:
DEBIAN_FRONTEND: noninteractive

permissions:
contents: write

jobs:
quality:
name: Checking dependency graph and code quality
runs-on: ubuntu-20.04
flake8:
name: Checking Flake8 rules
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: ['ubuntu-20.04']
python-version: ['3.8']

steps:
- uses: actions/checkout@v3
Expand All @@ -22,40 +26,27 @@ jobs:
test $(ls geotrek/*/migrations/*.py | xargs grep -l srid | xargs grep -L SRID | wc -l) -eq 0


- name: Set up Python 3.8
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.8 # lint with minimal version supported (3.8 in 18.04)

- name: Install dependencies
run: |
pip3 install --upgrade pip wheel setuptools
pip3 install -r requirements-dev.txt -U

- name: Check dependency graph
run: |
pip-compile -q
pip-compile -q requirements-dev.in
python-version: ${{ matrix.python-version }}

- name: Verify dependency graph is ok
uses: tj-actions/verify-changed-files@v13
id: verify-changed-files
- uses: actions/cache@v3
with:
files: |
requirements.txt
requirements-dev.txt
path: |
~/.cache/pip
~/.wheel_dir

- name: Validating graph
if: steps.verify-changed-files.outputs.files_changed == 'true' && github.actor != 'dependabot[bot]'
run: |
echo "Dependency file(s) changed: ${{ steps.verify-changed-files.outputs.changed_files }}"
core.setFailed('Please add your new dependencies in setup.py and/or requirements-dev.in then run pip-compile to add them in requirements. (see docs/contribute/development)')
key: ${{ matrix.os }}-pip-${{ matrix.python-version }}
restore-keys: |
${{ matrix.os }}-pip-${{ matrix.python-version }}

- name: Dependabot commit dependencies
uses: stefanzweifel/git-auto-commit-action@v4
if: ${{ github.actor == 'dependabot[bot]' }}
with:
commit_message: Apply dependencies update by dependabot
- name: Install dependencies
run: |
pip3 wheel --wheel-dir=~/.wheel_dir pip wheel setuptools
pip3 install --find-links=~/.wheel_dir --upgrade pip wheel setuptools
pip3 wheel --wheel-dir=~/.wheel_dir -r requirements-dev.txt
pip3 install --find-links=~/.wheel_dir --upgrade -r requirements-dev.txt

- name: Flake8
run: |
Expand Down
7 changes: 4 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,9 @@ jobs:
~/.cache/pip
~/.wheel_dir

key: ${{ runner.os }}-pip-${{ matrix.python-version }}
key: ${{ matrix.os }}-pip-${{ matrix.python-version }}
restore-keys: |
${{ runner.os }}-pip-${{ matrix.python-version }}
${{ matrix.os }}-pip-${{ matrix.python-version }}

- name: Install System dependencies
run: |
Expand Down Expand Up @@ -118,7 +118,8 @@ jobs:

- name: Install python dependencies
run: |
python3 -m pip install --upgrade pip setuptools wheel
pip3 wheel --wheel-dir=~/.wheel_dir pip wheel setuptools
pip3 install --find-links=~/.wheel_dir --upgrade pip wheel setuptools
pip3 wheel --wheel-dir=~/.wheel_dir -r requirements.txt
pip3 wheel --wheel-dir=~/.wheel_dir -r requirements-dev.txt
pip3 install --find-links=~/.wheel_dir -r requirements.txt
Expand Down