From ed0e160ccd7ab95741ff4e215cb7111a6d8194c8 Mon Sep 17 00:00:00 2001 From: pyr0ball Date: Sun, 5 Apr 2026 17:58:08 -0700 Subject: [PATCH] =?UTF-8?q?ci:=20add=20Forgejo=20Actions=20workflows=20?= =?UTF-8?q?=E2=80=94=20CI,=20PyPI=20release,=20mirrors,=20cliff.toml=20(cl?= =?UTF-8?q?oses=20#27)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .cliff.toml | 33 ++++++++++++++++++++++++ .forgejo/workflows/ci.yml | 30 ++++++++++++++++++++++ .forgejo/workflows/mirror.yml | 29 +++++++++++++++++++++ .forgejo/workflows/release-pypi.yml | 39 +++++++++++++++++++++++++++++ pyproject.toml | 2 ++ 5 files changed, 133 insertions(+) create mode 100644 .cliff.toml create mode 100644 .forgejo/workflows/ci.yml create mode 100644 .forgejo/workflows/mirror.yml create mode 100644 .forgejo/workflows/release-pypi.yml diff --git a/.cliff.toml b/.cliff.toml new file mode 100644 index 0000000..6ba1dc6 --- /dev/null +++ b/.cliff.toml @@ -0,0 +1,33 @@ +[changelog] +header = "# Changelog\n" +body = """ +{% if version %}\ +## [{{ version | trim_start_matches(pat="v") }}] - {{ timestamp | date(format="%Y-%m-%d") }} +{% else %}\ +## [Unreleased] +{% endif %}\ +{% for group, commits in commits | group_by(attribute="group") %} +### {{ group | upper_first }} +{% for commit in commits %} +- {{ commit.message | upper_first }}\ +{% endfor %} +{% endfor %}\n +""" +footer = "" +trim = true + +[git] +conventional_commits = true +filter_unconventional = true +commit_parsers = [ + { message = "^feat", group = "Features" }, + { message = "^fix", group = "Bug Fixes" }, + { message = "^refactor", group = "Refactor" }, + { message = "^perf", group = "Performance" }, + { message = "^docs", group = "Documentation" }, + { message = "^test", group = "Testing" }, + { message = "^ci", group = "CI/CD" }, + { message = "^chore", group = "Miscellaneous" }, +] +filter_commits = false +tag_pattern = "v[0-9].*" diff --git a/.forgejo/workflows/ci.yml b/.forgejo/workflows/ci.yml new file mode 100644 index 0000000..abfc6c5 --- /dev/null +++ b/.forgejo/workflows/ci.yml @@ -0,0 +1,30 @@ +name: CI + +on: + push: + branches: [main] + pull_request: + branches: [main] + +jobs: + test: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - uses: actions/setup-python@v5 + with: + python-version: "3.11" + cache: pip + + - name: Install dependencies + run: pip install -e ".[dev]" ruff mypy + + - name: Lint (ruff) + run: ruff check circuitforge_core/ + + - name: Type check (mypy) + run: mypy circuitforge_core/ --ignore-missing-imports + + - name: Test + run: pytest tests/ -v --tb=short diff --git a/.forgejo/workflows/mirror.yml b/.forgejo/workflows/mirror.yml new file mode 100644 index 0000000..f05925c --- /dev/null +++ b/.forgejo/workflows/mirror.yml @@ -0,0 +1,29 @@ +name: Mirror + +on: + push: + branches: [main] + tags: + - "v*" + +jobs: + mirror: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Mirror to GitHub + env: + GITHUB_MIRROR_TOKEN: ${{ secrets.GITHUB_MIRROR_TOKEN }} + run: | + git remote add github "https://x-access-token:${GITHUB_MIRROR_TOKEN}@github.com/CircuitForgeLLC/circuitforge-core.git" + git push github --mirror + + - name: Mirror to Codeberg + env: + CODEBERG_MIRROR_TOKEN: ${{ secrets.CODEBERG_MIRROR_TOKEN }} + run: | + git remote add codeberg "https://CircuitForge:${CODEBERG_MIRROR_TOKEN}@codeberg.org/CircuitForge/circuitforge-core.git" + git push codeberg --mirror diff --git a/.forgejo/workflows/release-pypi.yml b/.forgejo/workflows/release-pypi.yml new file mode 100644 index 0000000..872ddd0 --- /dev/null +++ b/.forgejo/workflows/release-pypi.yml @@ -0,0 +1,39 @@ +name: Release — PyPI + +on: + push: + tags: + - "v*" + +jobs: + release: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - uses: actions/setup-python@v5 + with: + python-version: "3.11" + + - name: Build + run: | + pip install build + python -m build + + - name: Publish to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 + with: + password: ${{ secrets.PYPI_API_TOKEN }} + + - name: Create Forgejo release + env: + FORGEJO_TOKEN: ${{ secrets.FORGEJO_RELEASE_TOKEN }} + run: | + TAG="${GITHUB_REF_NAME}" + curl -s -X POST \ + -H "Authorization: token ${FORGEJO_TOKEN}" \ + -H "Content-Type: application/json" \ + "https://git.opensourcesolarpunk.com/api/v1/repos/Circuit-Forge/circuitforge-core/releases" \ + -d "{\"tag_name\":\"${TAG}\",\"name\":\"${TAG}\",\"draft\":false,\"prerelease\":false}" diff --git a/pyproject.toml b/pyproject.toml index eecccd8..dc87002 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -22,6 +22,8 @@ dev = [ "circuitforge-core[manage]", "pytest>=8.0", "pytest-asyncio>=0.23", + "ruff>=0.4", + "mypy>=1.10", ] [project.scripts]