Skip to content

Commit

Permalink
feat: enable CI.
Browse files Browse the repository at this point in the history
  • Loading branch information
paquiteau committed Oct 16, 2024
1 parent 3519974 commit a176f3b
Show file tree
Hide file tree
Showing 3 changed files with 132 additions and 0 deletions.
51 changes: 51 additions & 0 deletions .github/workflows/deploy-docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: deploy-docs

# Only run this when the master branch changes
on:
push:
branches:
- main
- master

# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write

# Allow one concurrent deployment
concurrency:
group: "pages"
cancel-in-progress: true

# This job installs dependencies, builds the book, and pushes it to `gh-pages`
jobs:
deploy-book:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

# Install dependencies
- name: Set up Python 3.10
uses: actions/setup-python@v3
with:
python-version: "3.10"

- name: Install dependencies
run: |
pip install -e .[doc]
# Build the book
- name: Build the book
run: |
cd docs
./build_docs.sh
- name: Upload artifact
uses: actions/upload-pages-artifact@v1
with:
path: 'docs/_build/html'

- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v1
49 changes: 49 additions & 0 deletions .github/workflows/tags-release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Release on PyPi

on:
push:
tags:
- 'v[0-9]+.[0-9]+.[0-9]+'
jobs:
build-n-publish:
name: Build and publish to PyPI
runs-on: ubuntu-latest
environment: pypi-release
permissions:
id-token: write
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Get history and tags for SCM versioning to work
run: |
git fetch --prune --unshallow
git fetch --depth=1 origin +refs/tags/*:refs/tags/*
- name: Set up Python 3.10
uses: actions/setup-python@v4
with:
python-version: "3.10"

- name: Install pypa/build
run: |
python -m pip install build
python -m pip install .
- name: Build a binary wheel and a source tarball
run: |
python -m build --sdist --wheel --outdir dist/ .
- name: Publish distribution 📦 to PyPI
uses: pypa/gh-action-pypi-publish@release/v1

gh-release:
name: Create release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 100
- name: Create Relase
run: gh release create "$GITHUB_REF_NAME" --generate-notes -d
32 changes: 32 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# this file is *not* meant to cover or endorse the use of GitHub Actions, but rather to
# help test this project

name: Test

on: [push, pull_request]

jobs:
test:
strategy:
matrix:
python: ['3.10']
platform: [ubuntu-latest]
runs-on: ${{ matrix.platform }}
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}
cache: 'pip'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -e .[test,dev]
- name: Linter
run: |
black --check src tests
ruff .
- name: Test
run: |
pytest

0 comments on commit a176f3b

Please sign in to comment.