From 0b055e0699bf11173a99a920c63fc6e915586d74 Mon Sep 17 00:00:00 2001 From: J-E Castagnede Date: Mon, 30 Jan 2023 14:17:23 +0100 Subject: [PATCH 1/9] move dependency check in dedicated workflow --- .github/workflows/dependencies.yml | 56 ++++++++++++++++++++++++++++++ .github/workflows/lint.yml | 9 +++++ 2 files changed, 65 insertions(+) create mode 100644 .github/workflows/dependencies.yml diff --git a/.github/workflows/dependencies.yml b/.github/workflows/dependencies.yml new file mode 100644 index 0000000000..175d99474d --- /dev/null +++ b/.github/workflows/dependencies.yml @@ -0,0 +1,56 @@ +name: Check deps + +on: + push: + +env: + DEBIAN_FRONTEND: noninteractive + +permissions: + contents: write + +jobs: + quality: + name: Checking dependency graph + runs-on: ubuntu-20.04 + + steps: + - uses: actions/checkout@v3 + + - name: Set up Python 3.8 + 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 + + - 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: support@github.com + commit_author: dependabot[bot] diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 3ffbd34163..770941dcb6 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -1,7 +1,12 @@ name: Linting on: + pull_request: + paths-ignore: + - 'docs/**' push: + paths-ignore: + - 'docs/**' env: DEBIAN_FRONTEND: noninteractive @@ -56,6 +61,10 @@ jobs: if: ${{ github.actor == 'dependabot[bot]' }} with: commit_message: Apply dependencies update by dependabot + commit_user_name: dependabot[bot] + commit_user_email: support@github.com + commit_author: dependabot[bot] + - name: Flake8 run: | From f7415f7b5ebc720528eb7188b424cada2a573c8f Mon Sep 17 00:00:00 2001 From: J-E Castagnede Date: Mon, 30 Jan 2023 14:35:13 +0100 Subject: [PATCH 2/9] optimize cache in CI --- .github/workflows/dependencies.yml | 16 ++++++++++++++-- .github/workflows/lint.yml | 16 ++++++++++++++-- .github/workflows/test.yml | 3 ++- 3 files changed, 30 insertions(+), 5 deletions(-) diff --git a/.github/workflows/dependencies.yml b/.github/workflows/dependencies.yml index 175d99474d..ec79739893 100644 --- a/.github/workflows/dependencies.yml +++ b/.github/workflows/dependencies.yml @@ -22,10 +22,22 @@ jobs: with: python-version: 3.8 # lint with minimal version supported (3.8 in 18.04) + - uses: actions/cache@v3 + with: + path: | + ~/.cache/pip + ~/.wheel_dir + + key: ${{ runner.os }}-pip-${{ matrix.python-version }} + restore-keys: | + ${{ runner.os }}-pip-${{ matrix.python-version }} + - name: Install dependencies run: | - pip3 install --upgrade pip wheel setuptools - pip3 install -r requirements-dev.txt -U + 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: | diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 770941dcb6..995b2eb0f0 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -32,10 +32,22 @@ jobs: with: python-version: 3.8 # lint with minimal version supported (3.8 in 18.04) + - uses: actions/cache@v3 + with: + path: | + ~/.cache/pip + ~/.wheel_dir + + key: ${{ runner.os }}-pip-${{ matrix.python-version }} + restore-keys: | + ${{ runner.os }}-pip-${{ matrix.python-version }} + - name: Install dependencies run: | - pip3 install --upgrade pip wheel setuptools - pip3 install -r requirements-dev.txt -U + 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: | diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 12416f4717..663d07e6fe 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -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 From 35a79f95c222b02579f8aa705e4a591c9f9a3a6a Mon Sep 17 00:00:00 2001 From: J-E Castagnede Date: Mon, 30 Jan 2023 15:11:13 +0100 Subject: [PATCH 3/9] optimize cache in CI --- .github/workflows/dependencies.yml | 14 +++++++++----- .github/workflows/lint.yml | 10 +++++++--- .github/workflows/test.yml | 4 ++-- 3 files changed, 18 insertions(+), 10 deletions(-) diff --git a/.github/workflows/dependencies.yml b/.github/workflows/dependencies.yml index ec79739893..9d290b7045 100644 --- a/.github/workflows/dependencies.yml +++ b/.github/workflows/dependencies.yml @@ -12,15 +12,19 @@ permissions: jobs: quality: name: Checking dependency graph - runs-on: ubuntu-20.04 + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: ['ubuntu-20.04'] + python-version: ['3.8'] steps: - uses: actions/checkout@v3 - - 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) + python-version: ${{ matrix.python-version }} - uses: actions/cache@v3 with: @@ -28,9 +32,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 dependencies run: | diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 995b2eb0f0..5a32b0ec48 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -17,7 +17,11 @@ permissions: jobs: quality: name: Checking dependency graph and code quality - runs-on: ubuntu-20.04 + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: ['ubuntu-20.04'] + python-version: ['3.8'] steps: - uses: actions/checkout@v3 @@ -27,10 +31,10 @@ 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) + python-version: ${{ matrix.python-version }} - uses: actions/cache@v3 with: diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 663d07e6fe..d731e41031 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -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: | From 19793a584edc986be8e7bc4a5befaf1786a42d5d Mon Sep 17 00:00:00 2001 From: J-E Castagnede Date: Mon, 30 Jan 2023 17:01:57 +0100 Subject: [PATCH 4/9] limit CI --- .github/workflows/dependencies.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/dependencies.yml b/.github/workflows/dependencies.yml index 9d290b7045..488eaa1d35 100644 --- a/.github/workflows/dependencies.yml +++ b/.github/workflows/dependencies.yml @@ -1,7 +1,12 @@ name: Check deps on: + pull_request: + paths-ignore: + - 'docs/**' push: + paths-ignore: + - 'docs/**' env: DEBIAN_FRONTEND: noninteractive From 8dc7a02e3515bb9c16336440477af90a8e730511 Mon Sep 17 00:00:00 2001 From: J-E Castagnede Date: Mon, 30 Jan 2023 17:02:59 +0100 Subject: [PATCH 5/9] limit CI --- .github/workflows/dependencies.yml | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/.github/workflows/dependencies.yml b/.github/workflows/dependencies.yml index 488eaa1d35..dd665b217c 100644 --- a/.github/workflows/dependencies.yml +++ b/.github/workflows/dependencies.yml @@ -2,11 +2,17 @@ name: Check deps on: pull_request: - paths-ignore: - - 'docs/**' + paths: + - setup.py + - requirements.txt + - requirements-dev.in + - requirements-dev.txt push: - paths-ignore: - - 'docs/**' + paths: + - setup.py + - requirements.txt + - requirements-dev.in + - requirements-dev.txt env: DEBIAN_FRONTEND: noninteractive From e113335b2a4682a8cfc91ae19d97041d3041a688 Mon Sep 17 00:00:00 2001 From: J-E Castagnede Date: Mon, 30 Jan 2023 17:05:12 +0100 Subject: [PATCH 6/9] optimize CI --- .github/workflows/lint.yml | 41 ++++++-------------------------------- 1 file changed, 6 insertions(+), 35 deletions(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 5a32b0ec48..ffab03aef6 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -2,11 +2,11 @@ name: Linting on: pull_request: - paths-ignore: - - 'docs/**' + paths: + - 'geotrek/**' push: - paths-ignore: - - 'docs/**' + paths: + - 'geotrek/**' env: DEBIAN_FRONTEND: noninteractive @@ -42,9 +42,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 dependencies run: | @@ -53,35 +53,6 @@ jobs: 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: support@github.com - commit_author: dependabot[bot] - - - name: Flake8 run: | flake8 geotrek From 10b438e6749c1e1d26568dc383ede9b2a6251238 Mon Sep 17 00:00:00 2001 From: J-E Castagnede Date: Mon, 30 Jan 2023 17:07:17 +0100 Subject: [PATCH 7/9] optimize CI --- .github/workflows/dependencies.yml | 3 +++ .github/workflows/lint.yml | 2 ++ 2 files changed, 5 insertions(+) diff --git a/.github/workflows/dependencies.yml b/.github/workflows/dependencies.yml index dd665b217c..acc6d0b41d 100644 --- a/.github/workflows/dependencies.yml +++ b/.github/workflows/dependencies.yml @@ -7,12 +7,15 @@ on: - requirements.txt - requirements-dev.in - requirements-dev.txt + - .github/workflows/dependencies.yml + push: paths: - setup.py - requirements.txt - requirements-dev.in - requirements-dev.txt + - .github/workflows/dependencies.yml env: DEBIAN_FRONTEND: noninteractive diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index ffab03aef6..b8c5c8c11a 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -4,9 +4,11 @@ on: pull_request: paths: - 'geotrek/**' + - '.github/workflows/lint.yml' push: paths: - 'geotrek/**' + - '.github/workflows/lint.yml' env: DEBIAN_FRONTEND: noninteractive From 460b93b06e71caad755cda9ff04c7ea335a30ec4 Mon Sep 17 00:00:00 2001 From: J-E Castagnede Date: Mon, 30 Jan 2023 17:07:44 +0100 Subject: [PATCH 8/9] optimize CI --- .github/workflows/dependencies.yml | 8 -------- .github/workflows/lint.yml | 4 ---- 2 files changed, 12 deletions(-) diff --git a/.github/workflows/dependencies.yml b/.github/workflows/dependencies.yml index acc6d0b41d..a6be0e2249 100644 --- a/.github/workflows/dependencies.yml +++ b/.github/workflows/dependencies.yml @@ -9,14 +9,6 @@ on: - requirements-dev.txt - .github/workflows/dependencies.yml - push: - paths: - - setup.py - - requirements.txt - - requirements-dev.in - - requirements-dev.txt - - .github/workflows/dependencies.yml - env: DEBIAN_FRONTEND: noninteractive diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index b8c5c8c11a..8913a6b387 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -5,10 +5,6 @@ on: paths: - 'geotrek/**' - '.github/workflows/lint.yml' - push: - paths: - - 'geotrek/**' - - '.github/workflows/lint.yml' env: DEBIAN_FRONTEND: noninteractive From 3ef8641c3925e9febafede7fdac90a75d7914311 Mon Sep 17 00:00:00 2001 From: J-E Castagnede Date: Mon, 30 Jan 2023 17:42:43 +0100 Subject: [PATCH 9/9] optimize CI --- .github/workflows/lint.yml | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 8913a6b387..008cbd435f 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -9,12 +9,9 @@ on: env: DEBIAN_FRONTEND: noninteractive -permissions: - contents: write - jobs: - quality: - name: Checking dependency graph and code quality + flake8: + name: Checking Flake8 rules runs-on: ${{ matrix.os }} strategy: matrix: