Skip to content

Commit 0592dd4

Browse files
committed
Change: Use generic reusable workflows
Use our new generic reusable workflows where possible.
1 parent 7a91599 commit 0592dd4

File tree

4 files changed

+30
-86
lines changed

4 files changed

+30
-86
lines changed

.github/workflows/ci-python.yml

Lines changed: 23 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -1,75 +1,43 @@
1-
name: Build and test Python package
1+
name: Check and test Python project
22

33
on:
44
push:
5-
branches: [ main ]
5+
branches:
6+
- main
67
pull_request:
7-
branches: [ main ]
88

99
jobs:
10-
linting:
11-
name: Linting
12-
runs-on: 'ubuntu-latest'
10+
lint-and-test:
1311
strategy:
14-
matrix:
15-
python-version:
12+
matrix:
13+
python-version:
1614
- "3.7"
1715
- "3.8"
1816
- "3.9"
1917
- "3.10"
2018
- "3.11"
21-
steps:
22-
- uses: actions/checkout@v3
23-
- name: Set up Python ${{ matrix.python-version }}
24-
uses: greenbone/actions/lint-python@v2
25-
with:
26-
packages: autohooks tests
27-
python-version: ${{ matrix.python-version }}
28-
type-checking:
29-
name: Type-checker
30-
runs-on: 'ubuntu-latest'
31-
strategy:
32-
matrix:
33-
python-version:
34-
- "3.7"
35-
- "3.8"
36-
- "3.9"
37-
- "3.10"
38-
- "3.11"
39-
steps:
40-
- uses: actions/checkout@v3
41-
- name: Set up Python ${{ matrix.python-version }}
42-
uses: greenbone/actions/mypy-python@v2
43-
with:
44-
packages: autohooks
45-
python-version: ${{ matrix.python-version }}
46-
test:
47-
name: Run all tests
48-
runs-on: 'ubuntu-latest'
49-
strategy:
50-
matrix:
51-
python-version:
52-
- "3.7"
53-
- "3.8"
54-
- "3.9"
55-
- "3.10"
56-
- "3.11"
57-
steps:
58-
- uses: actions/checkout@v3
59-
- name: Install poetry and dependencies
60-
uses: greenbone/actions/poetry@v2
61-
with:
62-
python-version: ${{ matrix.python-version }}
63-
- name: Run unit tests
64-
run: poetry run python -m unittest
19+
20+
name: Check and test
21+
uses: greenbone/workflows/.github/workflows/ci-python.yml@main
22+
with:
23+
lint-packages: autohooks tests
24+
python-version: ${{ matrix.python-version }}
25+
6526

6627
codecov:
6728
name: Upload coverage to codecov.io
68-
needs: test
69-
runs-on: 'ubuntu-latest'
29+
# run action directly because GitHub has an internal error when using our
30+
# generic reusable workflow
31+
runs-on: "ubuntu-latest"
7032
steps:
7133
- uses: actions/checkout@v3
72-
- name: Calculate and upload coverage to codecov.io
34+
- name: Install and calculate and upload coverage to codecov.io
7335
uses: greenbone/actions/coverage-python@v2
7436
with:
7537
python-version: "3.10"
38+
cache: "true"
39+
token: ${{ secrets.CODECOV_TOKEN }}
40+
41+
versioning:
42+
name: Check versioning
43+
uses: greenbone/workflows/.github/workflows/check-version.yml@main

.github/workflows/deploy-pypi.yml

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,5 @@ on:
66

77
jobs:
88
deploy:
9-
runs-on: ubuntu-latest
10-
steps:
11-
- name: Build and publish to PyPI
12-
uses: greenbone/actions/pypi-upload@v2
13-
with:
14-
pypi-token: ${{ secrets.PYPI_TOKEN }}
9+
uses: greenbone/workflows/.github/workflows/deploy-pypi.yml@main
10+
secrets: inherit

.github/workflows/release-pontos.yml

Lines changed: 4 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Release Python package with pontos
1+
name: Release Python package
22

33
on:
44
pull_request:
@@ -7,27 +7,6 @@ on:
77

88
jobs:
99
build-and-release:
10-
name: Create a new release with pontos
11-
# If the event is a workflow_dispatch or the label 'make release' is set and PR is closed because of a merge
12-
if: (github.event_name == 'workflow_dispatch') || (contains( github.event.pull_request.labels.*.name, 'make release') && github.event.pull_request.merged == true)
13-
runs-on: "ubuntu-latest"
14-
steps:
15-
- name: Setting the Reference
16-
run: |
17-
if [[ "${{ github.event_name }}" = "workflow_dispatch" ]]; then
18-
echo "RELEASE_REF=${{ github.ref_name }}" >> $GITHUB_ENV
19-
else
20-
echo "RELEASE_REF=${{ github.base_ref }}" >> $GITHUB_ENV
21-
fi
22-
- name: Release with release action
23-
uses: greenbone/actions/release@v2
24-
with:
25-
conventional-commits: true
26-
github-user: ${{ secrets.GREENBONE_BOT }}
27-
github-user-mail: ${{ secrets.GREENBONE_BOT_MAIL }}
28-
github-user-token: ${{ secrets.GREENBONE_BOT_TOKEN }}
29-
gpg-key: ${{ secrets.GPG_KEY }}
30-
gpg-fingerprint: ${{ secrets.GPG_FINGERPRINT }}
31-
gpg-passphrase: ${{ secrets.GPG_PASSPHRASE }}
32-
strategy: calendar
33-
ref: ${{ env.RELEASE_REF }}
10+
name: Create a new release
11+
uses: greenbone/workflows/.github/workflows/release-python.yml@main
12+
secrets: inherit

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,4 +81,5 @@ pre-commit = ['autohooks.plugins.black', 'autohooks.plugins.isort', 'autohooks.p
8181
version-module-file = "autohooks/plugins/pylint/__version__.py"
8282

8383
[tool.mypy]
84+
files = "autohooks"
8485
ignore_missing_imports = true

0 commit comments

Comments
 (0)