Skip to content

Commit 0de2caa

Browse files
committed
add tests and release workflow
1 parent bde6eb0 commit 0de2caa

File tree

3 files changed

+138
-0
lines changed

3 files changed

+138
-0
lines changed
+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# SPDX-FileCopyrightText: 2024 DB Systel GmbH
2+
#
3+
# SPDX-License-Identifier: Apache-2.0
4+
5+
name: "Reusable Poetry build workflow"
6+
inputs:
7+
python:
8+
default: "3.10"
9+
description: "Value for 'python-version'"
10+
required: false
11+
type: string
12+
poetry_args:
13+
default: ""
14+
description: "Additional arguments for the poetry install step'"
15+
required: false
16+
type: string
17+
runs:
18+
using: "composite"
19+
steps:
20+
- name: Set up Python
21+
uses: actions/setup-python@v5
22+
with:
23+
python-version: ${{ inputs.python }}
24+
- name: Install dependencies
25+
run: |
26+
pip install poetry
27+
poetry install --no-interaction ${{ inputs.poetry_args }}
28+
shell: bash

.github/workflows/publish.yaml

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# SPDX-FileCopyrightText: 2024 DB Systel GmbH
2+
#
3+
# SPDX-License-Identifier: Apache-2.0
4+
5+
name: Python package
6+
on:
7+
push:
8+
tags:
9+
- "v*.*.*"
10+
jobs:
11+
build:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v4
15+
- name: Build and publish to PyPI
16+
uses: JRubics/[email protected]
17+
with:
18+
pypi_token: ${{ secrets.PYPI_TOKEN }}

.github/workflows/test.yaml

+92
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
# SPDX-FileCopyrightText: 2024 DB Systel GmbH
2+
#
3+
# SPDX-License-Identifier: Apache-2.0
4+
5+
name: Test suites
6+
7+
on:
8+
push:
9+
branches:
10+
- main
11+
pull_request:
12+
13+
jobs:
14+
# Test using the tool via poetry on different OSes and python versions
15+
test-os-python-matrix:
16+
runs-on: ${{ matrix.os }}
17+
strategy:
18+
max-parallel: 10
19+
# do not abort the whole test job if one combination in the matrix fails
20+
fail-fast: false
21+
matrix:
22+
python-version: ["3.10", "3.11", "3.12"]
23+
os: [ubuntu-22.04]
24+
include:
25+
- python-version: "3.10"
26+
os: macos-latest
27+
- python-version: "3.10"
28+
os: windows-latest
29+
30+
steps:
31+
- uses: actions/checkout@v4
32+
- uses: ./.github/actions/poetrybuild
33+
with:
34+
python: ${{ matrix.python-version }}
35+
poetry_args: --only main
36+
- name: Execute gh-org-mgr
37+
run: poetry run gh-org-mgr --help
38+
39+
# Test building the package and installing it via pip3
40+
test-build-install:
41+
runs-on: ubuntu-22.04
42+
steps:
43+
- uses: actions/checkout@v4
44+
- name: Set up Python
45+
uses: actions/setup-python@v5
46+
with:
47+
python-version: "3.10"
48+
- name: Install poetry
49+
run: pip install poetry
50+
- name: Build package
51+
run: poetry build
52+
- name: Install package
53+
run: pip3 install dist/github_org_manager-*.tar.gz
54+
- name: Run package
55+
run: |
56+
gh-org-mgr --version
57+
gh-org-mgr --help
58+
59+
# Formatting
60+
pylint:
61+
runs-on: ubuntu-22.04
62+
steps:
63+
- uses: actions/checkout@v4
64+
- uses: ./.github/actions/poetrybuild
65+
- name: Lint with pylint
66+
run: poetry run pylint gh_org_mgr/
67+
68+
formatting:
69+
runs-on: ubuntu-22.04
70+
steps:
71+
- uses: actions/checkout@v4
72+
- uses: ./.github/actions/poetrybuild
73+
- name: Test formatting with isort and black
74+
run: |
75+
poetry run isort --check gh_org_mgr/
76+
poetry run black --check .
77+
78+
mypy:
79+
runs-on: ubuntu-22.04
80+
steps:
81+
- uses: actions/checkout@v4
82+
- uses: ./.github/actions/poetrybuild
83+
- name: Test typing with mypy
84+
run: poetry run mypy
85+
86+
# REUSE
87+
reuse:
88+
runs-on: ubuntu-latest
89+
steps:
90+
- uses: actions/checkout@v4
91+
- name: Check REUSE Compliance
92+
uses: fsfe/reuse-action@v3

0 commit comments

Comments
 (0)