Skip to content

Commit 96ceaea

Browse files
colyerdengShawnDen-coder
authored andcommitted
feat: update projetc
1 parent a0e5ec0 commit 96ceaea

File tree

20 files changed

+633
-447
lines changed

20 files changed

+633
-447
lines changed

.github/workflows/bumpversion.yaml renamed to .github/workflows/bump_version.yaml

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,6 @@ on:
44
push:
55
branches:
66
- master
7-
tags-ignore:
8-
- '*'
9-
pull_request:
10-
branches:
11-
- master
127
workflow_dispatch:
138

149
jobs:
@@ -17,13 +12,22 @@ jobs:
1712
runs-on: ubuntu-latest
1813
name: "Bump version and create changelog with commitizen"
1914
steps:
15+
- name: Load secret
16+
uses: 1password/load-secrets-action@v2
17+
with:
18+
export-env: true
19+
env:
20+
OP_SERVICE_ACCOUNT_TOKEN: ${{ secrets.OP_SERVICE_ACCOUNT_TOKEN }}
21+
PERSONAL_ACCESS_TOKEN: op://shawndengdev/github_access_token/credential
22+
2023
- name: Check out
2124
uses: actions/checkout@v4
2225
with:
2326
fetch-depth: 0
24-
token: '${{ secrets.PERSONAL_ACCESS_TOKEN }}'
27+
token: '${{ env.PERSONAL_ACCESS_TOKEN }}'
28+
2529
- name: Create bump and changelog
2630
uses: commitizen-tools/commitizen-action@master
2731
with:
28-
github_token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
32+
github_token: ${{ env.PERSONAL_ACCESS_TOKEN }}
2933
branch: master

.github/workflows/lint.yaml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: lint_and_unittest
2+
3+
on: [ push, pull_request ]
4+
5+
jobs:
6+
lint_and_unittest:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- name: Load secret
10+
uses: 1password/load-secrets-action@v2
11+
with:
12+
export-env: true
13+
env:
14+
OP_SERVICE_ACCOUNT_TOKEN: ${{ secrets.OP_SERVICE_ACCOUNT_TOKEN }}
15+
PERSONAL_ACCESS_TOKEN: op://shawndengdev/github_access_token/credential
16+
17+
- name: Check out
18+
uses: actions/checkout@v4
19+
with:
20+
fetch-depth: 0
21+
token: '${{ env.PERSONAL_ACCESS_TOKEN }}'
22+
23+
- uses: actions/setup-python@v5
24+
with:
25+
python-version: "3.12"
26+
27+
- uses: abatilo/actions-poetry@v2
28+
with:
29+
poetry-version: "latest"
30+
31+
- name: install depends
32+
run: |
33+
pip install nox
34+
poetry install
35+
36+
- name: Run lint checks
37+
run: poetry run nox -s lint
38+
39+
- name: Run tests
40+
run: poetry run nox -s test

.github/workflows/release-build.yaml

Lines changed: 0 additions & 39 deletions
This file was deleted.

.github/workflows/release_build.yaml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: release-build
2+
on:
3+
workflow_dispatch:
4+
push:
5+
tags:
6+
- '*.*.*'
7+
8+
jobs:
9+
release-build:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v4
13+
14+
- name: Load secret
15+
uses: 1password/load-secrets-action@v2
16+
with:
17+
export-env: true
18+
env:
19+
OP_SERVICE_ACCOUNT_TOKEN: ${{ secrets.OP_SERVICE_ACCOUNT_TOKEN }}
20+
PERSONAL_ACCESS_TOKEN: op://shawndengdev/github_access_token/credential
21+
PYPI_TOKEN: op://shawndengdev/pypi_token/credential
22+
23+
- uses: actions/setup-python@v5
24+
with:
25+
python-version: "3.12"
26+
27+
- uses: abatilo/actions-poetry@v2
28+
with:
29+
poetry-version: "latest"
30+
31+
- name: Install nox
32+
run: pip install nox
33+
34+
- name: build and publish
35+
run: |
36+
poetry config pypi-token.pypi ${{ env.PYPI_TOKEN }}
37+
poetry install
38+
poetry run nox -s lint
39+
poetry run nox -s test
40+
poetry run nox -s build
41+
poetry publish
42+
43+
- name: Release
44+
uses: softprops/action-gh-release@v2
45+
with:
46+
files: |
47+
dist/**/*.exe
48+
dist/*.tar.gz
49+
dist/*.whl
50+
generate_release_notes: true
51+
env:
52+
GITHUB_TOKEN: ${{ env.PERSONAL_ACCESS_TOKEN }}

.gitignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,8 @@
11
/.idea
2+
# Coverage output
3+
.coverage
4+
/.nox/
5+
/build/
6+
/coverage.xml
7+
/.zip/
8+
/venv/

noxfile.py

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
"""Nox automation file for github-action-test project.
2+
3+
This module contains nox sessions for automating development tasks including:
4+
- Code linting and formatting
5+
- Unit testing with coverage reporting
6+
- Package building
7+
- Executable creation
8+
9+
Typical usage example:
10+
nox -s lint # Run linting
11+
nox -s test # Run tests
12+
nox -s build # Build package
13+
nox -s build_exe # Build package with standalone executable
14+
"""
15+
import nox
16+
17+
18+
@nox.session(reuse_venv=True)
19+
def lint(session: nox.Session) -> None:
20+
"""Run code quality checks using ruff.
21+
22+
Performs linting and formatting checks on the codebase using ruff.
23+
Fixes auto-fixable issues and shows formatting differences.
24+
25+
Args:
26+
session: Nox session object for running commands
27+
"""
28+
session.install("poetry")
29+
session.install("ruff")
30+
session.run("poetry", "install", "--only", "dev")
31+
session.run(
32+
"ruff",
33+
"check",
34+
".",
35+
"--fix",
36+
"--verbose"
37+
)
38+
session.run(
39+
"ruff",
40+
"format",
41+
"--verbose",
42+
"--diff"
43+
)
44+
45+
@nox.session(reuse_venv=True)
46+
def test(session: nox.Session) -> None:
47+
"""Run the test suite with coverage reporting.
48+
49+
Executes pytest with coverage reporting for the github_action_test package.
50+
Generates both terminal and XML coverage reports.
51+
52+
Args:
53+
session: Nox session object for running commands
54+
"""
55+
session.install("poetry")
56+
session.run("poetry", "install")
57+
session.run(
58+
"pytest",
59+
"--cov=repo_scaffold",
60+
"--cov-report=term-missing",
61+
"--cov-report=xml",
62+
"-v",
63+
"tests"
64+
)
65+
66+
67+
@nox.session(reuse_venv=True)
68+
def build(session: nox.Session) -> None:
69+
"""Build the Python package.
70+
71+
Creates a distributable package using poetry build command
72+
with verbose output and excluding dev dependencies.
73+
74+
Args:
75+
session: Nox session object for running commands
76+
"""
77+
session.install("poetry")
78+
session.run("poetry", "install", "--without", "dev")
79+
session.run("poetry", "build", "-vvv")
80+
81+
82+
@nox.session(reuse_venv=True)
83+
def build_exe(session: nox.Session) -> None:
84+
"""Build the Python package with standalone executable.
85+
86+
Creates an executable using poetry-pyinstaller-plugin.
87+
Installs required plugin and builds without dev dependencies.
88+
89+
Args:
90+
session: Nox session object for running commands
91+
"""
92+
session.install("poetry")
93+
session.install("poetry", "self", "add", "poetry-pyinstaller-plugin")
94+
session.run("poetry", "install", "--without", "dev")
95+
session.run("poetry", "build", "-vvv")

0 commit comments

Comments
 (0)