Skip to content

Commit

Permalink
Change: Format workflows, update actions and support Python 3.11
Browse files Browse the repository at this point in the history
* Run autoformatter on all workflow files
* Add support for Python 3.11
* Run Python based actions on Python 3.10 by default now
* Update our actions to v2 versions
  • Loading branch information
bjoernricks committed Nov 7, 2022
1 parent c6c440f commit 376d795
Show file tree
Hide file tree
Showing 7 changed files with 88 additions and 85 deletions.
44 changes: 23 additions & 21 deletions .github/workflows/ci-python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,43 +2,45 @@ name: Build and test Python package

on:
push:
branches: [ main ]
branches: [main]
pull_request:
branches: [ main ]
branches: [main]

jobs:
linting:
name: Linting
runs-on: 'ubuntu-latest'
runs-on: "ubuntu-latest"
strategy:
matrix:
python-version:
- 3.7
- 3.8
- 3.9
- "3.10"
matrix:
python-version:
- 3.7
- 3.8
- 3.9
- "3.10"
- "3.11"
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: greenbone/actions/lint-python@v1
uses: greenbone/actions/lint-python@v2
with:
packages: autohooks tests
version: ${{ matrix.python-version }}

test:
name: Run all tests
runs-on: 'ubuntu-latest'
runs-on: "ubuntu-latest"
strategy:
matrix:
python-version:
- 3.7
- 3.8
- 3.9
- "3.10"
matrix:
python-version:
- 3.7
- 3.8
- 3.9
- "3.10"
- "3.11"
steps:
- uses: actions/checkout@v3
- name: Install poetry and dependencies
uses: greenbone/actions/poetry@v1
uses: greenbone/actions/poetry@v2
with:
version: ${{ matrix.python-version }}
- name: Run unit tests
Expand All @@ -47,10 +49,10 @@ jobs:
codecov:
name: Upload coverage to codecov.io
needs: test
runs-on: 'ubuntu-latest'
runs-on: "ubuntu-latest"
steps:
- uses: actions/checkout@v3
- name: Calculate and upload coverage to codecov.io
uses: greenbone/actions/coverage-python@v1
uses: greenbone/actions/coverage-python@v2
with:
version: 3.9
version: "3.10"
28 changes: 14 additions & 14 deletions .github/workflows/codeql-analysis-python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ name: "CodeQL"

on:
push:
branches: [ main ]
branches: [main]
pull_request:
branches: [ main ]
branches: [main]
paths-ignore:
- '**/*.md'
- '**/*.txt'
- "**/*.md"
- "**/*.txt"
schedule:
- cron: '30 5 * * 0' # 5:30h on Sundays
- cron: "30 5 * * 0" # 5:30h on Sundays

jobs:
analyze:
Expand All @@ -23,16 +23,16 @@ jobs:
strategy:
fail-fast: false
matrix:
language: [ 'python' ]
language: ["python"]

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

- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
34 changes: 17 additions & 17 deletions .github/workflows/deploy-pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,20 @@ jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.9
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install --upgrade poetry
python -m pip install --upgrade twine
- name: Build and publish
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
run: |
poetry build
twine upload dist/*
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.10"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install --upgrade poetry
python -m pip install --upgrade twine
- name: Build and publish
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
run: |
poetry build
twine upload dist/*
6 changes: 3 additions & 3 deletions .github/workflows/github-pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,16 @@ jobs:
- name: Checkout
uses: actions/checkout@v3
- name: Install poetry and dependencies
uses: greenbone/actions/poetry@v1
uses: greenbone/actions/poetry@v2
with:
version: "3.9"
version: "3.10"
- name: Build Documentation
run: |
cd docs && poetry run make html
- name: Upload artifact
uses: actions/upload-pages-artifact@v1
with:
path: 'docs/build/html'
path: "docs/build/html"
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v1
32 changes: 16 additions & 16 deletions .github/workflows/release-pontos-manually.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,25 @@ on:
workflow_dispatch:
inputs:
branch:
description: 'Branch'
description: "Branch"
required: true
default: 'main'
default: "main"

jobs:
build-and-release:
name: Build and release with pontos
runs-on: 'ubuntu-latest'
runs-on: "ubuntu-latest"
steps:
- name: Release with release action
uses: greenbone/actions/release-python@v1
with:
version: 3.9
conventional-commits: true
ref: ${{ github.event.inputs.branch }}
github-user: ${{ secrets.GREENBONE_BOT }}
github-user-mail: ${{ secrets.GREENBONE_BOT_MAIL }}
github-user-token: ${{ secrets.GREENBONE_BOT_TOKEN }}
gpg-key: ${{ secrets.GPG_KEY }}
gpg-fingerprint: ${{ secrets.GPG_FINGERPRINT }}
gpg-passphrase: ${{ secrets.GPG_PASSPHRASE }}
strategy: calendar
- name: Release with release action
uses: greenbone/actions/release-python@v2
with:
version: "3.10"
conventional-commits: true
ref: ${{ github.event.inputs.branch }}
github-user: ${{ secrets.GREENBONE_BOT }}
github-user-mail: ${{ secrets.GREENBONE_BOT_MAIL }}
github-user-token: ${{ secrets.GREENBONE_BOT_TOKEN }}
gpg-key: ${{ secrets.GPG_KEY }}
gpg-fingerprint: ${{ secrets.GPG_FINGERPRINT }}
gpg-passphrase: ${{ secrets.GPG_PASSPHRASE }}
strategy: calendar
26 changes: 13 additions & 13 deletions .github/workflows/release-pontos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,17 @@ jobs:
name: Build and release with pontos
# If the label 'make release' is set. If PR is closed because of an merge
if: contains( github.event.pull_request.labels.*.name, 'make release') && github.event.pull_request.merged == true
runs-on: 'ubuntu-latest'
runs-on: "ubuntu-latest"
steps:
- name: Release with release action
uses: greenbone/actions/release-python@v1
with:
version: 3.9
conventional-commits: true
github-user: ${{ secrets.GREENBONE_BOT }}
github-user-mail: ${{ secrets.GREENBONE_BOT_MAIL }}
github-user-token: ${{ secrets.GREENBONE_BOT_TOKEN }}
gpg-key: ${{ secrets.GPG_KEY }}
gpg-fingerprint: ${{ secrets.GPG_FINGERPRINT }}
gpg-passphrase: ${{ secrets.GPG_PASSPHRASE }}
strategy: calendar
- name: Release with release action
uses: greenbone/actions/release-python@v2
with:
version: "3.10"
conventional-commits: true
github-user: ${{ secrets.GREENBONE_BOT }}
github-user-mail: ${{ secrets.GREENBONE_BOT_MAIL }}
github-user-token: ${{ secrets.GREENBONE_BOT_TOKEN }}
gpg-key: ${{ secrets.GPG_KEY }}
gpg-fingerprint: ${{ secrets.GPG_FINGERPRINT }}
gpg-passphrase: ${{ secrets.GPG_PASSPHRASE }}
strategy: calendar
3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ classifiers=[
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Operating System :: OS Independent",
"Topic :: Software Development :: Libraries :: Python Modules",
"Topic :: Software Development :: Version Control :: Git",
Expand Down Expand Up @@ -66,7 +67,7 @@ autohooks = "autohooks.cli:main"

[tool.black]
line-length = 80
target-version = ['py37', 'py38', 'py39', 'py310']
target-version = ['py37', 'py38', 'py39', 'py310', 'py311']
exclude = '''
/(
\.git
Expand Down

0 comments on commit 376d795

Please sign in to comment.