Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,6 @@ on:
push:
branches:
- master
tags-ignore:
- '*'
pull_request:
branches:
- master
workflow_dispatch:

jobs:
Expand All @@ -17,13 +12,22 @@ jobs:
runs-on: ubuntu-latest
name: "Bump version and create changelog with commitizen"
steps:
- name: Load secret
uses: 1password/load-secrets-action@v2
with:
export-env: true
env:
OP_SERVICE_ACCOUNT_TOKEN: ${{ secrets.OP_SERVICE_ACCOUNT_TOKEN }}
PERSONAL_ACCESS_TOKEN: op://shawndengdev/github_access_token/credential

- name: Check out
uses: actions/checkout@v4
with:
fetch-depth: 0
token: '${{ secrets.PERSONAL_ACCESS_TOKEN }}'
token: '${{ env.PERSONAL_ACCESS_TOKEN }}'

- name: Create bump and changelog
uses: commitizen-tools/commitizen-action@master
with:
github_token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
github_token: ${{ env.PERSONAL_ACCESS_TOKEN }}
branch: master
40 changes: 40 additions & 0 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: lint_and_unittest

on: [ push, pull_request ]

jobs:
lint_and_unittest:
runs-on: ubuntu-latest
steps:
- name: Load secret
uses: 1password/load-secrets-action@v2
with:
export-env: true
env:
OP_SERVICE_ACCOUNT_TOKEN: ${{ secrets.OP_SERVICE_ACCOUNT_TOKEN }}
PERSONAL_ACCESS_TOKEN: op://shawndengdev/github_access_token/credential

- name: Check out
uses: actions/checkout@v4
with:
fetch-depth: 0
token: '${{ env.PERSONAL_ACCESS_TOKEN }}'

- uses: actions/setup-python@v5
with:
python-version: "3.12"

- uses: abatilo/actions-poetry@v2
with:
poetry-version: "latest"

- name: install depends
run: |
pip install nox
poetry install

- name: Run lint checks
run: poetry run nox -s lint

- name: Run tests
run: poetry run nox -s test
39 changes: 0 additions & 39 deletions .github/workflows/release-build.yaml

This file was deleted.

52 changes: 52 additions & 0 deletions .github/workflows/release_build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: release-build
on:
workflow_dispatch:
push:
tags:
- '*.*.*'

jobs:
release-build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Load secret
uses: 1password/load-secrets-action@v2
with:
export-env: true
env:
OP_SERVICE_ACCOUNT_TOKEN: ${{ secrets.OP_SERVICE_ACCOUNT_TOKEN }}
PERSONAL_ACCESS_TOKEN: op://shawndengdev/github_access_token/credential
PYPI_TOKEN: op://shawndengdev/pypi_token/credential

- uses: actions/setup-python@v5
with:
python-version: "3.12"

- uses: abatilo/actions-poetry@v2
with:
poetry-version: "latest"

- name: Install nox
run: pip install nox

- name: build and publish
run: |
poetry config pypi-token.pypi ${{ env.PYPI_TOKEN }}
poetry install
poetry run nox -s lint
poetry run nox -s test
poetry run nox -s build
poetry publish

- name: Release
uses: softprops/action-gh-release@v2
with:
files: |
dist/**/*.exe
dist/*.tar.gz
dist/*.whl
generate_release_notes: true
env:
GITHUB_TOKEN: ${{ env.PERSONAL_ACCESS_TOKEN }}
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,8 @@
/.idea
# Coverage output
.coverage
/.nox/
/build/
/coverage.xml
/.zip/
/venv/
2 changes: 0 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,5 @@

### Feat

- update `project.toml` readme type
- update `project.toml` readme type
- update template config
- update github action,and update config
2 changes: 1 addition & 1 deletion cookiecutter.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"template-python": {
"path": "./template-python",
"title": "python",
"description": "A cookiecutter template for python project"
"description": "template for python project"
}
}
}
95 changes: 95 additions & 0 deletions noxfile.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
"""Nox automation file for github-action-test project.

This module contains nox sessions for automating development tasks including:
- Code linting and formatting
- Unit testing with coverage reporting
- Package building
- Executable creation

Typical usage example:
nox -s lint # Run linting
nox -s test # Run tests
nox -s build # Build package
nox -s build_exe # Build package with standalone executable
"""
import nox


@nox.session(reuse_venv=True)
def lint(session: nox.Session) -> None:
"""Run code quality checks using ruff.

Performs linting and formatting checks on the codebase using ruff.
Fixes auto-fixable issues and shows formatting differences.

Args:
session: Nox session object for running commands
"""
session.install("poetry")
session.install("ruff")
session.run("poetry", "install", "--only", "dev")
session.run(
"ruff",
"check",
".",
"--fix",
"--verbose"
)
session.run(
"ruff",
"format",
"--verbose",
"--diff"
)

@nox.session(reuse_venv=True)
def test(session: nox.Session) -> None:
"""Run the test suite with coverage reporting.

Executes pytest with coverage reporting for the github_action_test package.
Generates both terminal and XML coverage reports.

Args:
session: Nox session object for running commands
"""
session.install("poetry")
session.run("poetry", "install")
session.run(
"pytest",
"--cov=repo_scaffold",
"--cov-report=term-missing",
"--cov-report=xml",
"-v",
"tests"
)


@nox.session(reuse_venv=True)
def build(session: nox.Session) -> None:
"""Build the Python package.

Creates a distributable package using poetry build command
with verbose output and excluding dev dependencies.

Args:
session: Nox session object for running commands
"""
session.install("poetry")
session.run("poetry", "install", "--without", "dev")
session.run("poetry", "build", "-vvv")


@nox.session(reuse_venv=True)
def build_exe(session: nox.Session) -> None:
"""Build the Python package with standalone executable.

Creates an executable using poetry-pyinstaller-plugin.
Installs required plugin and builds without dev dependencies.

Args:
session: Nox session object for running commands
"""
session.install("poetry")
session.install("poetry", "self", "add", "poetry-pyinstaller-plugin")
session.run("poetry", "install", "--without", "dev")
session.run("poetry", "build", "-vvv")
Loading
Loading