Skip to content
Merged
36 changes: 36 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: CI

on:
pull_request:
branches: [ main ]
push:
branches: [ main ]

jobs:
tests:
name: required-test-check
if: ${{ github.event_name == 'pull_request' || !contains(github.event.head_commit.message, '[skip ci]') }}
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
cache: "pip"

- name: Install Poetry
run: python -m pip install --upgrade pip poetry

- name: Install dependencies
run: poetry install --with dev

- name: Run required test suite
run: >
poetry run python -m pytest
tests/test_session_locking.py
tests/test_timeout_cap.py
tests/test_version_bump.py
68 changes: 68 additions & 0 deletions .github/workflows/version-bump.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
name: Automated Version Bump

on:
push:
branches: [ main ]
workflow_dispatch:
inputs:
part:
description: Version segment to bump
required: true
default: patch
type: choice
options:
- patch
- minor
- major

permissions:
contents: write

jobs:
bump:
if: ${{ github.actor != 'github-actions[bot]' && (github.event_name == 'workflow_dispatch' || !contains(github.event.head_commit.message, '[skip bump]')) }}
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0

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

- name: Choose bump part
id: bump_part
run: |
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
echo "value=${{ inputs.part }}" >> "$GITHUB_OUTPUT"
else
echo "value=patch" >> "$GITHUB_OUTPUT"
fi

- name: Bump version in pyproject.toml
id: bump
run: |
NEW_VERSION=$(python scripts/bump_version.py --part "${{ steps.bump_part.outputs.value }}" --file pyproject.toml)
echo "new_version=$NEW_VERSION" >> "$GITHUB_OUTPUT"

- name: Commit and tag version bump
env:
NEW_VERSION: ${{ steps.bump.outputs.new_version }}
GIT_AUTHOR_NAME: github-actions[bot]
GIT_AUTHOR_EMAIL: github-actions[bot]@users.noreply.github.com
GIT_COMMITTER_NAME: github-actions[bot]
GIT_COMMITTER_EMAIL: github-actions[bot]@users.noreply.github.com
run: |
if [ -z "$NEW_VERSION" ]; then
echo "No new version produced; exiting."
exit 1
fi
git add pyproject.toml
git commit -m "chore: bump version to $NEW_VERSION [skip ci][skip bump]" || exit 0
git tag "v$NEW_VERSION"
git push origin main
git push origin "v$NEW_VERSION"
Loading
Loading