From 015285b7dad8a8dee2d1073e58f838e3dffeb039 Mon Sep 17 00:00:00 2001 From: Matthew Burket Date: Fri, 7 Jun 2024 11:03:08 -0500 Subject: [PATCH 1/3] Add tox to the project Makes it easier to run all the tests. --- requirements.txt | 2 ++ tox.ini | 26 ++++++++++++++++++++++++++ 2 files changed, 28 insertions(+) create mode 100644 requirements.txt diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..10001ec --- /dev/null +++ b/requirements.txt @@ -0,0 +1,2 @@ +tox>=4 +setuptools>=61.0 diff --git a/tox.ini b/tox.ini index 8cb60e1..096a4b2 100644 --- a/tox.ini +++ b/tox.ini @@ -1,2 +1,28 @@ +[tox] +requires = + tox>=4 +env_list = lint, type, py + +[testenv:lint] +description = run linters +skip_install = true +deps = + pycodestyle==2.11.1 +commands = pycodestyle {posargs:compliance_tool} + +[testenv:type] +description = run type checks +skip_install = true +deps = + mypy==1.10.0 +commands = mypy {posargs:compliance_tool} + +[testenv:docs] +basepython = python +changedir = docs +deps = -r docs/requirements.txt +allowlist_externals = sphinx-build +commands = sphinx-build -W -b html -d {envtmpdir}/doctrees . {envtmpdir}/html + [pycodestyle] max-line-length = 99 From 21be0a7a2fd54fabb7fa822d9b3573a7b64ced0e Mon Sep 17 00:00:00 2001 From: Matthew Burket Date: Thu, 6 Jun 2024 15:58:44 -0500 Subject: [PATCH 2/3] Fix return type on the main method --- compliance_tool/cli.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compliance_tool/cli.py b/compliance_tool/cli.py index 9916cc1..389dc87 100644 --- a/compliance_tool/cli.py +++ b/compliance_tool/cli.py @@ -54,7 +54,7 @@ def prepare_parsers() -> argparse.ArgumentParser: return parser -def main(): +def main() -> int: args = prepare_parsers().parse_args() args.func(args) return 0 From 13173a7de46d7664b1b1abad94c55f87c8fc4e5e Mon Sep 17 00:00:00 2001 From: Matthew Burket Date: Thu, 6 Jun 2024 15:58:54 -0500 Subject: [PATCH 3/3] Add basic CI --- .github/workflows/gate.yaml | 49 +++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 .github/workflows/gate.yaml diff --git a/.github/workflows/gate.yaml b/.github/workflows/gate.yaml new file mode 100644 index 0000000..2e7cb26 --- /dev/null +++ b/.github/workflows/gate.yaml @@ -0,0 +1,49 @@ +name: "Gating" +on: + push: + branches: [ "main", "*" ] + pull_request: + branches: [ "main" ] + +jobs: + test-fedora-latest: + runs-on: "ubuntu-latest" + container: + image: fedora:latest + steps: + - name: Install Dependencies + run: dnf install -y python3-devel python3-setuptools + - name: Checkout + uses: actions/checkout@v4 + - name: Install Python Dependencies + run: pip install -r requirements.txt + - name: Run all tests + run: tox + + test-fedora-rawhide: + runs-on: "ubuntu-latest" + container: + image: fedora:rawhide + steps: + - name: Install Dependencies + run: dnf install -y python3-devel python3-setuptools + - name: Checkout + uses: actions/checkout@v4 + - name: Install Python Dependencies + run: pip install -r requirements.txt + - name: Run all tests + run: tox + + test-c10s: + runs-on: "ubuntu-latest" + container: + image: quay.io/centos/centos:stream10-development + steps: + - name: Install Dependencies + run: dnf install -y python3-devel python3-setuptools + - name: Checkout + uses: actions/checkout@v4 + - name: Install Python Dependencies + run: pip install -r requirements.txt + - name: Run all tests + run: tox