Skip to content

Commit

Permalink
Change: Format workflows, update actions and support Python 3.11 (#866)
Browse files Browse the repository at this point in the history
**What**:

* 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

**Why**:

Remove warnings in workflow runs, support latest Python release
  • Loading branch information
bjoernricks authored Nov 10, 2022
2 parents 9530127 + 7a42a81 commit ddaea35
Show file tree
Hide file tree
Showing 7 changed files with 88 additions and 86 deletions.
47 changes: 24 additions & 23 deletions .github/workflows/ci-python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,43 +2,44 @@ name: Build and test

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"
steps:
- uses: actions/checkout@v3
- name: Check with black, pylint and pontos.version
uses: greenbone/actions/lint-python@v1
uses: greenbone/actions/lint-python@v2
with:
packages: gvm tests
version: ${{ matrix.python-version }}

test:
name: Unit 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,21 +48,21 @@ 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"

build-docs:
name: Build the documentation
runs-on: 'ubuntu-latest'
runs-on: "ubuntu-latest"
steps:
- uses: actions/checkout@v3
- name: Install poetry and dependencies
uses: greenbone/actions/poetry@v1
uses: greenbone/actions/poetry@v2
with:
version: 3.9
- name: Build docs
Expand Down
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/*
4 changes: 2 additions & 2 deletions .github/workflows/github-pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ 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"
- name: Build Documentation
Expand All @@ -38,7 +38,7 @@ jobs:
- 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 @@ -22,6 +22,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",
]
Expand Down Expand Up @@ -51,7 +52,7 @@ furo = ">=2022.6.21"

[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 ddaea35

Please sign in to comment.