Skip to content

Commit

Permalink
Add CI jobs
Browse files Browse the repository at this point in the history
  • Loading branch information
stotko committed Nov 6, 2024
1 parent 8a8321e commit 15ac08a
Show file tree
Hide file tree
Showing 6 changed files with 339 additions and 0 deletions.
11 changes: 11 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
version: 2
updates:
# Maintain dependencies for GitHub Actions
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
groups:
actions:
patterns:
- "*"
55 changes: 55 additions & 0 deletions .github/release-drafter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name-template: "v$RESOLVED_VERSION"
tag-template: "v$RESOLVED_VERSION"
template: |
$CHANGES
**Full Changelog**: https://github.com/$OWNER/$REPOSITORY/compare/$PREVIOUS_TAG...v$RESOLVED_VERSION
---
### Release Guide
1. Bump version in `pyproject.toml`
2. Update `CHANGELOG.md` with notes from release draft and header with version and release date
3. Process links in `CHANGELOG.md` and check release date by calling `tools/process_changelog.py`
4. Open a PR with the above changes and merge it
5. Release the version by editing the draft
categories:
- title: Added
labels:
- added
- title: Changed
labels:
- changed
- title: Deprecated
labels:
- deprecated
- title: Removed
labels:
- removed
- title: Fixed
labels:
- fixed

change-template: "- $TITLE @$AUTHOR (#$NUMBER)"
change-title-escapes: '\<*_&' # You can add # and @ to disable mentions, and add ` to disable code blocks.

version-resolver:
major:
labels:
- major
minor:
labels:
- minor
patch:
labels:
- patch
default: patch

include-labels:
- "added"
- "changed"
- "deprecated"
- "removed"
- "fixed"
104 changes: 104 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
name: Docs

on:
push:
branches:
- main

pull_request:
types: [opened, reopened, synchronize]

release:
types:
- published

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

jobs:
build:
name: Build
runs-on: ubuntu-22.04

steps:
- uses: actions/checkout@v4

- name: Free Disk Space (Ubuntu)
uses: jlumbroso/free-disk-space@main
with:
tool-cache: false
android: true
dotnet: true
haskell: true
large-packages: false
docker-images: false
swap-storage: false

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

- name: Set up CUDA toolkit
uses: Jimver/cuda-toolkit@master
with:
cuda: "12.1.0"
method: "network"
sub-packages: '["toolkit"]'

- name: Install torch with CUDA support
run: python -m pip install torch --index-url https://download.pytorch.org/whl/cu121

- name: Install torchhull
run: python -m pip install --editable ".[dev]"

- name: Build docs
run: nox -s docs

- uses: actions/upload-artifact@v4
with:
name: Docs HTML
path: build/docs/html

publish:
name: Upload release to GitHub Pages
runs-on: ubuntu-22.04
if: github.event_name == 'release' && github.event.action == 'published'

needs:
- build

permissions:
contents: write

steps:
- uses: actions/checkout@v4

- uses: actions/download-artifact@v4
with:
name: Docs HTML
path: build/docs/html

- uses: JamesIves/github-pages-deploy-action@v4
with:
folder: build/docs/html
clean: true
single-commit: true

check_docs:
if: always()

needs:
- build
- publish

name: "Check Docs"
runs-on: ubuntu-22.04

steps:
- uses: re-actors/alls-green@release/v1
with:
allowed-skips: publish
jobs: ${{ toJSON(needs) }}
52 changes: 52 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Lint

on:
push:
branches:
- main

pull_request:
types: [opened, reopened, synchronize]

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

jobs:
lint:
strategy:
fail-fast: false
matrix:
python: ["3.9", "3.10", "3.11", "3.12"]

name: "Python ${{ matrix.python }}"
runs-on: ubuntu-22.04

steps:
- uses: actions/checkout@v4

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

- name: Install torchhull
run: python -m pip install --editable ".[dev]"

- name: Run linters
run: nox -s lint

check_lint:
if: always()

needs:
- lint

name: "Check Lint"
runs-on: ubuntu-22.04

steps:
- uses: re-actors/alls-green@release/v1
with:
jobs: ${{ toJSON(needs) }}
92 changes: 92 additions & 0 deletions .github/workflows/pypi.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
name: PyPi

on:
push:
branches:
- main

pull_request:
types: [opened, reopened, synchronize]

release:
types:
- published

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

jobs:
dist:
name: Distribution build
runs-on: ubuntu-22.04

steps:
- uses: actions/checkout@v4

- uses: hynek/build-and-inspect-python-package@v2

publish-test:
name: Upload release to TestPyPI
runs-on: ubuntu-22.04
if: github.event_name == 'release' && github.event.action == 'published'

needs:
- dist

environment:
name: testpypi
url: https://test.pypi.org/p/torchhull

permissions:
id-token: write

steps:
- uses: actions/download-artifact@v4
with:
name: Packages
path: dist

- uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://test.pypi.org/legacy/

publish:
name: Upload release to PyPI
runs-on: ubuntu-22.04
if: github.event_name == 'release' && github.event.action == 'published'

needs:
- publish-test

environment:
name: pypi
url: https://pypi.org/p/torchhull

permissions:
id-token: write

steps:
- uses: actions/download-artifact@v4
with:
name: Packages
path: dist

- uses: pypa/gh-action-pypi-publish@release/v1

check_pypi:
if: always()

needs:
- dist
- publish-test
- publish

name: "Check PyPI"
runs-on: ubuntu-22.04

steps:
- uses: re-actors/alls-green@release/v1
with:
allowed-skips: publish-test, publish
jobs: ${{ toJSON(needs) }}
25 changes: 25 additions & 0 deletions .github/workflows/release-drafter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Release Drafter

on:
push:
branches:
- main

permissions:
contents: read

jobs:
Update:
permissions:
contents: write
pull-requests: read

runs-on: ubuntu-22.04

steps:
- uses: release-drafter/release-drafter@v6
with:
config-name: release-drafter.yml
disable-autolabeler: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 comments on commit 15ac08a

Please sign in to comment.