Skip to content

Commit

Permalink
wip: Refactor CI workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
duncaneddy committed Mar 10, 2024
1 parent eb51db9 commit 122d8e0
Show file tree
Hide file tree
Showing 7 changed files with 135 additions and 84 deletions.
60 changes: 9 additions & 51 deletions .github/workflows/commit.yml
Original file line number Diff line number Diff line change
@@ -1,55 +1,13 @@
name: Commit
name: Commit Unit Tests

on:
push:
branches:
- main
tags-ignore:
- v[0-9].[0-9]+.[0-9]+
push:
branches:
- main

jobs:
# Rust Tests
test-rust:
runs-on: ubuntu-latest
env:
CARGO_TERM_COLOR: always
steps:
- uses: actions/checkout@v4
- name: Install Rust
run: rustup update nightly
- run: rustup default nightly
- name: Install cargo-llvm-cov
uses: taiki-e/install-action@cargo-llvm-cov
- name: Generate code coverage
run: cargo llvm-cov --workspace --lcov --output-path lcov.info --features ci
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: lcov.info
fail_ci_if_error: true

# Python Binding Tests
test-python:
runs-on: ${{ matrix.os }}
needs: test-rust
strategy:
matrix:
os: [ ubuntu-latest ]
python-version: [ '3.8', '3.9', '3.10', '3.11', '3.12' ]
steps:
# TODO: Remove this when the nightly BTreeCursor is stabilized and released
- name: Install Rust
run: rustup update nightly
- run: rustup default nightly
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: python -m pip install --upgrade pip
- name: Install package
run: python -m pip install '.[dev]'
- name: Run Tests
run: pytest
test-rust:
uses: ./.github/workflows/test_rust.yml
test-python:
uses: ./.github/workflows/test_python.yml
needs: [ test-rust ]
10 changes: 10 additions & 0 deletions .github/workflows/document_update.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
name: Publish Document Update
on:
push:
branches:
- main
paths:
- docs/**
jobs:
update-docs:
uses: ./.github/workflows/update_docs.yml
43 changes: 43 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Publish Version Release

on:
push:
branches:
- main
tags:
- v[0-9].[0-9]+.[0-9]+

jobs:
test-rust:
uses: ./.github/workflows/test_rust.yml
test-python:
uses: ./.github/workflows/test_python.yml
needs: [ test-rust ]
update-docs:
uses: ./.github/workflows/update_docs.yml
needs: [ test-python ]

release-rust:
runs-on: ubuntu-latest
needs: [ update-docs ]
steps:
- uses: actions/checkout@v4
- name: Install Rust
run: rustup update nightly
- run: rustup default nightly
- name: Publish to crates.io
run: cargo publish --token ${{ secrets.CRATES_TOKEN }}

release-python:
runs-on: ${{ matrix.os }}
needs: [ update-docs ]
strategy:
matrix:
os: [ ubuntu-latest ]
python-version: [ '3.8', '3.9', '3.10', '3.11', '3.12' ]
steps:
- uses: actions/checkout@v4
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install maturin
25 changes: 25 additions & 0 deletions .github/workflows/test_python.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Test Python
on: [ workflow_call ]
jobs:
test-python:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ ubuntu-latest ]
python-version: [ '3.8', '3.9', '3.10', '3.11', '3.12' ]
steps:
# TODO: Remove this when the nightly BTreeCursor is stabilized and released
- name: Install Rust
run: rustup update nightly
- run: rustup default nightly
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: python -m pip install --upgrade pip
- name: Install package
run: python -m pip install '.[dev]'
- name: Run Tests
run: pytest
22 changes: 22 additions & 0 deletions .github/workflows/test_rust.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Test Rust
on: [ workflow_call ]
jobs:
test-rust:
runs-on: ubuntu-latest
env:
CARGO_TERM_COLOR: always
steps:
- uses: actions/checkout@v4
- name: Install Rust
run: rustup update nightly
- run: rustup default nightly
- name: Install cargo-llvm-cov
uses: taiki-e/install-action@cargo-llvm-cov
- name: Generate code coverage
run: cargo llvm-cov --workspace --lcov --output-path lcov.info --features ci
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: lcov.info
fail_ci_if_error: true
47 changes: 21 additions & 26 deletions .github/workflows/update_docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,31 +3,26 @@

name: Update Docs

on:
push:
branches:
- main
paths:
- docs/**
on: [ workflow_call ]

jobs:
publish-docs:
runs-on: ubuntu-latest
steps:
# TODO: Remove this when the nightly BTreeCursor is stabilized and released
- name: Install Rust
run: rustup update nightly
- run: rustup default nightly
- uses: actions/checkout@v4
- name: Set up Python 3.12
uses: actions/setup-python@v5
with:
python-version: 3.12
- name: Install dependencies
run: |
python -m pip install --upgrade pip
./scripts/build-docs.sh install
- name: Build docs
run: ./scripts/build-docs.sh build
- name: Deploy docs
run: ./scripts/build-docs.sh publish
publish-docs:
runs-on: ubuntu-latest
steps:
# TODO: Remove this when the nightly BTreeCursor is stabilized and released
- name: Install Rust
run: rustup update nightly
- run: rustup default nightly
- uses: actions/checkout@v4
- name: Set up Python 3.12
uses: actions/setup-python@v5
with:
python-version: 3.12
- name: Install dependencies
run: |
python -m pip install --upgrade pip
./scripts/build-docs.sh install
- name: Build docs
run: ./scripts/build-docs.sh build
- name: Deploy docs
run: ./scripts/build-docs.sh publish
12 changes: 5 additions & 7 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,19 +28,17 @@ classifiers = [
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
]
urls = [
{ name = "Documentation", url = "https://duncaneddy.github.io/brahe/" },
{ name = "Repository", url = "https://github.com/duncaneddy/brahe" },
{ name = "Issues", url = "https://github.com/duncaneddy/brahe/pulls" }
]


dependencies = [
'typer>=0.9.0,<1.0.0',
'rich>=13.0.0,<14.0.0',
'numpy>=1.24.4,<2.0.0'
]

[project.urls]
Documentation = "https://duncaneddy.github.io/brahe/"
Repository = "https://github.com/duncaneddy/brahe"
Issues = "https://github.com/duncaneddy/brahe/pulls"

# To install dev dependencies, run `pip install -e '.[dev]'`
[project.optional-dependencies]
dev = [
Expand Down

0 comments on commit 122d8e0

Please sign in to comment.