Skip to content

Commit

Permalink
ci: Exchange poetry with rye (#81)
Browse files Browse the repository at this point in the history
  • Loading branch information
eifinger committed Jun 30, 2024
1 parent 6a958e8 commit 6a19320
Show file tree
Hide file tree
Showing 13 changed files with 384 additions and 265 deletions.
6 changes: 0 additions & 6 deletions .codecov.yml

This file was deleted.

49 changes: 49 additions & 0 deletions .github/release-drafter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
---
name-template: "v$RESOLVED_VERSION 🌈"
tag-template: "v$RESOLVED_VERSION"
categories:
- title: "🚨 Breaking changes"
labels:
- "breaking-change"
- title: "✨ New features"
labels:
- "new-feature"
- title: "🐛 Bug fixes"
labels:
- "bugfix"
- title: "🚀 Enhancements"
labels:
- "enhancement"
- "refactor"
- "performance"
- title: "🧰 Maintenance"
labels:
- "maintenance"
- "ci"
- title: "📚 Documentation"
labels:
- "documentation"
- title: "⬆️ Dependency updates"
labels:
- "dependencies"
change-template: "- $TITLE @$AUTHOR (#$NUMBER)"
change-title-escapes: '\<*_&'
version-resolver:
major:
labels:
- "major"
- "breaking-change"
minor:
labels:
- "minor"
- "new-feature"
- "enhancement"
patch:
labels:
- "patch"
- "bugfix"
default: patch
template: |
## Changes
$CHANGES
86 changes: 19 additions & 67 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
---
name: CI

# yamllint disable-line rule:truthy
on:
"on":
push:
branches:
- main
Expand All @@ -17,73 +16,26 @@ jobs:
matrix:
python-version: ["3.10", "3.11", "3.12"]
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
- uses: actions/checkout@v4
- uses: eifinger/setup-rye@v3
id: setup-rye
with:
python-version: ${{ matrix.python-version }}
- name: Install Poetry
uses: snok/install-poetry@v1
enable-cache: true
cache-prefix: ${{ matrix.python-version }}
- name: Pin python-version ${{ matrix.python-version }}
if: steps.setup-rye.outputs.cache-hit != 'true'
run: rye pin ${{ matrix.python-version }}
- name: Install dependencies
if: steps.setup-rye.outputs.cache-hit != 'true'
run: |
poetry install
rye sync
- name: Cache pre-commit
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
with:
path: ~/.cache/pre-commit
key: pre-commit-|${{ matrix.python-version }}|${{ hashFiles('.pre-commit-config.yaml') }}
- name: Lint
run: |
SKIP=no-commit-to-branch poetry run pre-commit run --all-files
- name: Test coverage
run: |
poetry run pytest
- uses: codecov/codecov-action@v3.1.1
with:
token: ${{secrets.CODECOV}}
file: ./coverage.xml
flags: unittests
name: codecov-umbrella
security:
name: CodeQL
runs-on: ubuntu-latest
permissions:
security-events: write
steps:
- uses: actions/checkout@v3
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: python
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
noop-release:
name: Semantic Release Noop
runs-on: ubuntu-latest
needs:
- build
- security
if: github.ref != 'refs/heads/main'
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Python Semantic Release Noop
uses: relekang/python-semantic-release@v7.33.2
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
repository_username: __token__
repository_password: ${{ secrets.PYPI_TOKEN }}
additional_options: "--noop"
release:
name: Semantic Release
runs-on: ubuntu-latest
needs:
- build
- security
if: github.ref == 'refs/heads/main'
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Python Semantic Release
uses: relekang/python-semantic-release@v7.33.2
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
repository_username: __token__
repository_password: ${{ secrets.PYPI_TOKEN }}
rye run pre-commit run --all-files
- name: Lint GitHub Actions
uses: eifinger/actionlint-action@v1
33 changes: 33 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
---
name: Release

"on":
release:
types:
- published

jobs:
release_to_pypi:
name: Release to PyPI
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/here_routing/
permissions:
id-token: write
steps:
- uses: actions/checkout@v4
- name: Search and replace version
run: |
VERSION="${TAG_NAME//v/}"
sed -i "s/1\.0+versionplaceholder\.1/$VERSION/" pyproject.toml
env:
TAG_NAME: ${{ github.event.release.tag_name }}
- uses: eifinger/setup-rye@v3
with:
enable-cache: true
- name: Build
run: |
rye build
- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@ec4db0b4ddc65acdf4bff5fa45ac92d78b56bdf0
18 changes: 18 additions & 0 deletions .github/workflows/release_drafter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
name: Release Drafter

"on":
push:
branches:
- main
workflow_dispatch:

jobs:
update_release_draft:
name: ✏️ Draft release
runs-on: ubuntu-latest
steps:
- name: 🚀 Run Release Drafter
uses: release-drafter/release-drafter@v6.0.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Loading

0 comments on commit 6a19320

Please sign in to comment.