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
42 changes: 42 additions & 0 deletions .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Pull Request Events

on:
pull_request:

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
cancel-in-progress: true

permissions: {}

jobs:
test-unit:
name: Unit tests
runs-on: ubuntu-latest

steps:
- name: ⬇️ Set up code
uses: actions/checkout@v4
with:
show-progress: false

- name: 🐍 Set up Python
uses: actions/setup-python@v5
with:
cache: pip
cache-dependency-path: setup.py

- name: 🏗 Install module
run: pip install .[tests]

- name: 🧶 Lint
run: ruff check --output-format=github .

- name: 🧪 Run tests
run: pytest

- name: ⬆️ Upload coverage to Codecov
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./cov.xml
35 changes: 0 additions & 35 deletions .github/workflows/push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ on:
push:
branches:
- main
- dev

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
Expand All @@ -17,49 +16,15 @@ jobs:
permissions:
contents: write
pull-requests: write
outputs:
release_created: ${{ steps.release-please.outputs.release_created }}

steps:
- name: 🚀 Create Release
id: release-please
uses: agrc/release-composite-action@v1
with:
release-type: python
prerelease: ${{ github.ref_name == 'dev' }}
repo-token: ${{ secrets.GITHUB_TOKEN }}
github-app-id: ${{ secrets.UGRC_RELEASE_BOT_APP_ID }}
github-app-key: ${{ secrets.UGRC_RELEASE_BOT_APP_KEY }}
github-app-name: ${{ secrets.UGRC_RELEASE_BOT_NAME }}
github-app-email: ${{ secrets.UGRC_RELEASE_BOT_EMAIL }}

deploy-prod:
runs-on: ubuntu-latest
needs: release-please
if: github.ref == 'refs/heads/main' && needs.release-please.outputs.release_created
environment:
name: prod
url: https://pypi.org/project/ugrc-swapper/
permissions:
id-token: write

steps:
- name: ⬇️ Set up code
uses: actions/checkout@v4
with:
show-progress: false

- name: 🐍 Set up Python
uses: actions/setup-python@v5
with:
cache: pip
cache-dependency-path: setup.py

- name: 🛞 Install wheel
run: pip install wheel

- name: 📦 Build package
run: python setup.py sdist bdist_wheel

- name: 🚀 Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
68 changes: 68 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
name: Release Events
on:
release:
types: [published]

env:
GH_TOKEN: ${{ github.token }}

jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: ⬇️ Set up code
uses: actions/checkout@v4
with:
show-progress: false

- name: 🐍 Set up Python
uses: actions/setup-python@v5
with:
python-version-file: .python-version
cache: pip
cache-dependency-path: setup.py

- name: 📦 Build package
run: pipx run build

- name: ⬆️ Upload artifacts
uses: actions/upload-artifact@v4
with:
name: build-artifacts
path: dist
retention-days: 1

publish:
name: Publish
runs-on: ubuntu-latest
needs: build
environment:
name: prod
url: https://pypi.org/project/ugrc-swapper
permissions:
id-token: write

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

- name: 🚀 Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1

notify:
name: Notifications
runs-on: ubuntu-latest
needs: publish
permissions:
contents: read
pull-requests: write
issues: write
steps:
- name: Release Notifier
uses: agrc/release-issue-notifications-action@v1
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
3 changes: 3 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
[build-system]
requires = ["setuptools >= 70.2"]

[tool.ruff]
line-length = 120
ignore = ["E501"]
Expand Down