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
31 changes: 31 additions & 0 deletions .github/workflows/pytests-pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Pytests (PR)

on:
pull_request:
branches:
- "**"

jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: Install uv
run: pip install uv

- name: Install dependencies
run: uv sync

- name: Run tests with verbose output
run: uv run pytest tests/ -sv
273 changes: 148 additions & 125 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,130 +1,153 @@
name: Release

on:
push:
branches:
- main
push:
branches:
- main

jobs:
get-version:
runs-on: ubuntu-latest
outputs:
version: ${{ steps.gitversion.outputs.semVer }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Setup .NET (for GitVersion)
uses: actions/setup-dotnet@v3
with:
dotnet-version: '8.0.x'

- name: Install GitVersion
uses: gittools/actions/gitversion/setup@v0.11.0
with:
versionSpec: '5.x'

- name: Run GitVersion
id: gitversion
uses: gittools/actions/gitversion/execute@v0.11.0

- name: Output version
run: 'echo "GitVersion returned: ${{ steps.gitversion.outputs.semVer }}"'

build:
runs-on: ubuntu-latest
needs: get-version
outputs:
dist-path: dist
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'

- name: Install Poetry
run: pip install poetry poetry-dynamic-versioning

- name: Configure Poetry dynamic versioning
run: |
echo "Setting version to ${{ needs.get-version.outputs.version }}"
env:
POETRY_DYNAMIC_VERSIONING_BYPASS: ${{ needs.get-version.outputs.version }}

- name: Install dependencies
run: poetry install --no-root

- name: Build package
run: |
export POETRY_DYNAMIC_VERSIONING_BYPASS=${{ needs.get-version.outputs.version }}
poetry build

- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: dist
path: dist/

release:
runs-on: ubuntu-latest
needs: [get-version, build]
permissions:
contents: write

steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Download build artifacts
uses: actions/download-artifact@v4
with:
name: dist
path: dist/

- name: Create Git Tag
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git fetch --tags
git tag ${{ needs.get-version.outputs.version }}
git push origin ${{ needs.get-version.outputs.version }}

- name: Create GitHub Release
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ needs.get-version.outputs.version }}
name: Release ${{ needs.get-version.outputs.version }}
generate_release_notes: true
files: dist/*
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

pypi-publish:
runs-on: ubuntu-latest
needs: [get-version, build]
permissions:
id-token: write
environment:
name: pypi
url: https://pypi.org/p/yaml-reference


steps:
- name: Download build artifacts
uses: actions/download-artifact@v4
with:
name: dist
path: dist/
- name: Publish release distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
packages-dir: dist/
get-version:
runs-on: ubuntu-latest
outputs:
version: ${{ steps.gitversion.outputs.semVer }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Setup .NET (for GitVersion)
uses: actions/setup-dotnet@v3
with:
dotnet-version: "8.0.x"

- name: Install GitVersion
uses: gittools/actions/gitversion/setup@v0.11.0
with:
versionSpec: "5.x"

- name: Run GitVersion
id: gitversion
uses: gittools/actions/gitversion/execute@v0.11.0

- name: Output version
run: 'echo "GitVersion returned: ${{ steps.gitversion.outputs.semVer }}"'

pytests:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: Install uv
run: pip install uv

- name: Install dependencies
run: uv sync

- name: Run tests with verbose output
run: uv run pytest tests/ -sv

build:
runs-on: ubuntu-latest
needs: [get-version, pytests]
outputs:
dist-path: dist
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11"

- name: Install uv
run: pip install uv uv-dynamic-versioning

- name: Configure Poetry dynamic versioning
run: |
echo "Setting version to ${{ needs.get-version.outputs.version }}"
env:
UV_DYNAMIC_VERSIONING_BYPASS: ${{ needs.get-version.outputs.version }}

- name: Install dependencies
run: uv sync

- name: Build package
run: |
export UV_DYNAMIC_VERSIONING_BYPASS=${{ needs.get-version.outputs.version }}
uv build

- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: dist
path: dist/

release:
runs-on: ubuntu-latest
needs: [get-version, build]
permissions:
contents: write

steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Download build artifacts
uses: actions/download-artifact@v4
with:
name: dist
path: dist/

- name: Create Git Tag
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git fetch --tags
git tag ${{ needs.get-version.outputs.version }}
git push origin ${{ needs.get-version.outputs.version }}

- name: Create GitHub Release
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ needs.get-version.outputs.version }}
name: Release ${{ needs.get-version.outputs.version }}
generate_release_notes: true
files: dist/*
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

pypi-publish:
runs-on: ubuntu-latest
needs: [get-version, build]
permissions:
id-token: write
environment:
name: pypi
url: https://pypi.org/p/yaml-reference

steps:
- name: Download build artifacts
uses: actions/download-artifact@v4
with:
name: dist
path: dist/
- name: Publish release distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
packages-dir: dist/
43 changes: 23 additions & 20 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,28 @@
# See https://pre-commit.com/hooks.html for more hooks

default_install_hook_types:
- pre-commit
- commit-msg
- pre-commit
- commit-msg

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.2.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-added-large-files
- repo: https://github.com/psf/black
rev: 25.1.0
hooks:
- id: black
args: [--line-length=120]
- repo: https://github.com/compilerla/conventional-pre-commit
rev: v4.2.0
hooks:
- id: conventional-pre-commit
stages: [commit-msg]
args: []
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.2.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-added-large-files
- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version.
rev: v0.15.0
hooks:
# Run the linter.
- id: ruff-check
# Run the formatter.
- id: ruff-format
- repo: https://github.com/compilerla/conventional-pre-commit
rev: v4.2.0
hooks:
- id: conventional-pre-commit
stages: [commit-msg]
args: []
1 change: 1 addition & 0 deletions .python-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.13
Loading