Skip to content

Commit

Permalink
Update pre-commit hooks
Browse files Browse the repository at this point in the history
  • Loading branch information
dolfinus committed Apr 8, 2024
1 parent fdd6abc commit 163ef53
Show file tree
Hide file tree
Showing 8 changed files with 337 additions and 324 deletions.
12 changes: 6 additions & 6 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

version: 2
updates:
- package-ecosystem: github-actions
directory: /
schedule:
interval: daily
labels:
- ci
- package-ecosystem: github-actions
directory: /
schedule:
interval: daily
labels:
- ci
14 changes: 7 additions & 7 deletions .github/workflows/automerge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ jobs:
if: github.event.pull_request.user.login == 'pre-commit-ci[bot]' || github.event.pull_request.user.login == 'dependabot[bot]'

steps:
- uses: alexwilson/[email protected]
with:
github-token: ${{ secrets.PERSONAL_TOKEN }}
merge-method: REBASE
- uses: alexwilson/[email protected]
with:
github-token: ${{ secrets.PERSONAL_TOKEN }}
merge-method: REBASE

autoapprove:
name: Automatically approve pull request
Expand All @@ -22,6 +22,6 @@ jobs:
if: github.event.pull_request.user.login == 'pre-commit-ci[bot]' || github.event.pull_request.user.login == 'dependabot[bot]'

steps:
- uses: hmarr/auto-approve-action@v4
with:
github-token: ${{ secrets.PERSONAL_TOKEN }}
- uses: hmarr/auto-approve-action@v4
with:
github-token: ${{ secrets.PERSONAL_TOKEN }}
74 changes: 37 additions & 37 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ name: CodeQL
on:
push:
branches:
- '**'
- '**'
pull_request:
branches:
- master
- master
schedule:
- cron: 45 13 * * 6
- cron: 45 13 * * 6

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
Expand All @@ -27,51 +27,51 @@ jobs:
security-events: write

steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Checkout repository
uses: actions/checkout@v4

- name: Set up Python ${{ env.DEFAULT_PYTHON }}
uses: actions/setup-python@v5
with:
python-version: ${{ env.DEFAULT_PYTHON }}
- name: Set up Python ${{ env.DEFAULT_PYTHON }}
uses: actions/setup-python@v5
with:
python-version: ${{ env.DEFAULT_PYTHON }}

- name: Cache pip
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-python-${{ env.DEFAULT_PYTHON }}-codeql-${{ hashFiles('requirements*.txt') }}
restore-keys: |
${{ runner.os }}-python-${{ env.DEFAULT_PYTHON }}-codeql-${{ hashFiles('requirements*.txt') }}
${{ runner.os }}-python-${{ env.DEFAULT_PYTHON }}-codeql-
${{ runner.os }}-python
${{ runner.os }}-
- name: Cache pip
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-python-${{ env.DEFAULT_PYTHON }}-codeql-${{ hashFiles('requirements*.txt') }}
restore-keys: |
${{ runner.os }}-python-${{ env.DEFAULT_PYTHON }}-codeql-${{ hashFiles('requirements*.txt') }}
${{ runner.os }}-python-${{ env.DEFAULT_PYTHON }}-codeql-
${{ runner.os }}-python
${{ runner.os }}-
- name: Upgrade pip
run: python -m pip install --upgrade pip setuptools wheel
- name: Upgrade pip
run: python -m pip install --upgrade pip setuptools wheel

- name: Install dependencies
run: |
pip install -I -r requirements.txt -r requirements-dev.txt
# Set the `CODEQL-PYTHON` environment variable to the Python executable
# that includes the dependencies
echo "CODEQL_PYTHON=$(which python)" >> $GITHUB_ENV
- name: Install dependencies
run: |
pip install -I -r requirements.txt -r requirements-dev.txt
# Set the `CODEQL-PYTHON` environment variable to the Python executable
# that includes the dependencies
echo "CODEQL_PYTHON=$(which python)" >> $GITHUB_ENV
- name: Run flake8
run: flake8 --count --max-line-length=120 .
- name: Run flake8
run: flake8 --count --max-line-length=120 .

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v3
with:
languages: python
- name: Initialize CodeQL
uses: github/codeql-action/init@v3
with:
languages: python
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.

# Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
# queries: security-extended,security-and-quality

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
with:
category: /language:python
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
with:
category: /language:python
72 changes: 36 additions & 36 deletions .github/workflows/dev-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ name: Dev release
on:
push:
branches-ignore:
- dependabot/**
- pre-commit-ci-update-config
- dependabot/**
- pre-commit-ci-update-config
workflow_dispatch:

env:
Expand All @@ -27,45 +27,45 @@ jobs:
id-token: write # to auth in Test PyPI

steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up Python ${{ env.DEFAULT_PYTHON }}
id: python
uses: actions/setup-python@v5
with:
python-version: ${{ env.DEFAULT_PYTHON }}
- name: Set up Python ${{ env.DEFAULT_PYTHON }}
id: python
uses: actions/setup-python@v5
with:
python-version: ${{ env.DEFAULT_PYTHON }}

- name: Cache pip
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-python-${{ env.DEFAULT_PYTHON }}-release-${{ hashFiles('requirements*.txt') }}
restore-keys: |
${{ runner.os }}-python-${{ env.DEFAULT_PYTHON }}-release-${{ hashFiles('requirements*.txt') }}
${{ runner.os }}-python-${{ env.DEFAULT_PYTHON }}-release-
${{ runner.os }}-python
${{ runner.os }}-
- name: Cache pip
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-python-${{ env.DEFAULT_PYTHON }}-release-${{ hashFiles('requirements*.txt') }}
restore-keys: |
${{ runner.os }}-python-${{ env.DEFAULT_PYTHON }}-release-${{ hashFiles('requirements*.txt') }}
${{ runner.os }}-python-${{ env.DEFAULT_PYTHON }}-release-
${{ runner.os }}-python
${{ runner.os }}-
- name: Upgrade pip
run: python -m pip install --upgrade pip setuptools wheel
- name: Upgrade pip
run: python -m pip install --upgrade pip setuptools wheel

- name: Install dependencies
run: pip install -r requirements.txt
- name: Install dependencies
run: pip install -r requirements.txt

- name: Patch setup.py with explicit version number
- name: Patch setup.py with explicit version number
# Fix for https://github.com/dolfinus/setuptools-git-versioning/issues/72#issuecomment-1312589464
run: |
version=$(python setup.py --version)
sed -i -E "/from setuptools_git_versioning.*/d" setup.py
sed -i -E "s/version=.*/version='${version}',/" setup.py
run: |
version=$(python setup.py --version)
sed -i -E "/from setuptools_git_versioning.*/d" setup.py
sed -i -E "s/version=.*/version='${version}',/" setup.py
- name: Build package
run: python setup.py sdist bdist_wheel
- name: Build package
run: python setup.py sdist bdist_wheel

- name: Publish package
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository_url: https://test.pypi.org/legacy/
- name: Publish package
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository_url: https://test.pypi.org/legacy/
108 changes: 54 additions & 54 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Release
on:
push:
tags:
- v*
- v*

env:
DEFAULT_PYTHON: '3.12'
Expand All @@ -22,67 +22,67 @@ jobs:
contents: write # to create Github release

steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up Python ${{ env.DEFAULT_PYTHON }}
uses: actions/setup-python@v5
with:
python-version: ${{ env.DEFAULT_PYTHON }}
- name: Set up Python ${{ env.DEFAULT_PYTHON }}
uses: actions/setup-python@v5
with:
python-version: ${{ env.DEFAULT_PYTHON }}

- name: Cache pip
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-python-${{ env.DEFAULT_PYTHON }}-release-${{ hashFiles('requirements*.txt') }}
restore-keys: |
${{ runner.os }}-python-${{ env.DEFAULT_PYTHON }}-release-${{ hashFiles('requirements*.txt') }}
${{ runner.os }}-python-${{ env.DEFAULT_PYTHON }}-release-
${{ runner.os }}-python
${{ runner.os }}-
- name: Cache pip
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-python-${{ env.DEFAULT_PYTHON }}-release-${{ hashFiles('requirements*.txt') }}
restore-keys: |
${{ runner.os }}-python-${{ env.DEFAULT_PYTHON }}-release-${{ hashFiles('requirements*.txt') }}
${{ runner.os }}-python-${{ env.DEFAULT_PYTHON }}-release-
${{ runner.os }}-python
${{ runner.os }}-
- name: Upgrade pip
run: python -m pip install --upgrade pip setuptools wheel
- name: Upgrade pip
run: python -m pip install --upgrade pip setuptools wheel

- name: Install dependencies
run: pip install -r requirements.txt -r requirements-doc.txt
- name: Install dependencies
run: pip install -r requirements.txt -r requirements-doc.txt

- name: Inject slug/short variables
uses: rlespinasse/[email protected]
- name: Inject slug/short variables
uses: rlespinasse/[email protected]

- name: Patch setup.py with explicit version number
- name: Patch setup.py with explicit version number
# Fix for https://github.com/dolfinus/setuptools-git-versioning/issues/72#issuecomment-1312589464
run: |
version=$(echo $GITHUB_REF_SLUG | sed -E "s/v(.*)/\1/")
sed -i -E "/from setuptools_git_versioning.*/d" setup.py
sed -i -E "s/version=.*/version='${version}',/" setup.py
run: |
version=$(echo $GITHUB_REF_SLUG | sed -E "s/v(.*)/\1/")
sed -i -E "/from setuptools_git_versioning.*/d" setup.py
sed -i -E "s/version=.*/version='${version}',/" setup.py
- name: Build package
run: python setup.py sdist bdist_wheel
- name: Build package
run: python setup.py sdist bdist_wheel

- name: Build release notes
run: |
mkdir reports/
pip install -e .
version=$(echo $GITHUB_REF_SLUG | sed -E "s/v(.*)/\1/")
# lines 1 and 3 are empty, line 2 contains version number, line 4 contains release date
changelog generate-md -c ./docs/conf.py CHANGELOG.rst -v $version | sed "1,4d" > reports/release.md
sed -i -E 's/:github-user:`(.*)`/@\1/g' reports/release.md
sed -i -E 's/:issue:`(.*)`/#\1/g' reports/release.md
sed -i -E 's/:pr:`(.*)`/#\1/g' reports/release.md
- name: Build release notes
run: |
mkdir reports/
pip install -e .
version=$(echo $GITHUB_REF_SLUG | sed -E "s/v(.*)/\1/")
# lines 1 and 3 are empty, line 2 contains version number, line 4 contains release date
changelog generate-md -c ./docs/conf.py CHANGELOG.rst -v $version | sed "1,4d" > reports/release.md
sed -i -E 's/:github-user:`(.*)`/@\1/g' reports/release.md
sed -i -E 's/:issue:`(.*)`/#\1/g' reports/release.md
sed -i -E 's/:pr:`(.*)`/#\1/g' reports/release.md
- name: Publish package
uses: pypa/gh-action-pypi-publish@release/v1
- name: Publish package
uses: pypa/gh-action-pypi-publish@release/v1

- name: Create Github release
id: create_release
uses: softprops/action-gh-release@v2
with:
token: ${{ secrets.GITHUB_TOKEN }}
draft: false
prerelease: false
body_path: reports/release.md
files: |
dist/*
- name: Create Github release
id: create_release
uses: softprops/action-gh-release@v2
with:
token: ${{ secrets.GITHUB_TOKEN }}
draft: false
prerelease: false
body_path: reports/release.md
files: |
dist/*
Loading

0 comments on commit 163ef53

Please sign in to comment.