137 lines
3.8 KiB
YAML
137 lines
3.8 KiB
YAML
name: CI
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- dev
|
|
- main
|
|
tags:
|
|
- '*'
|
|
pull_request:
|
|
workflow_dispatch:
|
|
|
|
defaults:
|
|
run:
|
|
shell: bash -leo pipefail {0}
|
|
|
|
permissions:
|
|
contents: 'read'
|
|
|
|
jobs:
|
|
testing:
|
|
strategy:
|
|
matrix:
|
|
os: ["ubuntu-latest", "windows-latest", "macos-latest"]
|
|
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']
|
|
runs-on: ${{ matrix.os }}
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- uses: mamba-org/setup-micromamba@v1
|
|
with:
|
|
environment-name: ci
|
|
environment-file: environment.yaml
|
|
create-args: >-
|
|
python==${{ matrix.python-version }}
|
|
init-shell: bash
|
|
cache-environment: true
|
|
post-cleanup: 'all'
|
|
- name: Install Rust toolchain
|
|
uses: dtolnay/rust-toolchain@stable
|
|
- name: Build
|
|
run: cargo build --release
|
|
- name: Rust Tests
|
|
run: RUST_BACKTRACE=1 cargo test --release
|
|
- name: Build wheels
|
|
run: maturin develop --release --manifest-path pyargus/Cargo.toml
|
|
- name: Python Tests
|
|
run: RUST_BACKTRACE=1 pytest pyargus --hypothesis-explain
|
|
|
|
linting:
|
|
strategy:
|
|
matrix:
|
|
os: ["ubuntu-latest", "windows-latest", "macos-latest"]
|
|
python-version: ['3.10']
|
|
runs-on: ${{ matrix.os }}
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- uses: mamba-org/setup-micromamba@v1
|
|
with:
|
|
environment-name: ci
|
|
environment-file: environment.yaml
|
|
create-args: >-
|
|
python==${{ matrix.python-version }}
|
|
init-shell: bash
|
|
cache-environment: true
|
|
post-cleanup: 'all'
|
|
- name: Install Rust toolchain
|
|
uses: dtolnay/rust-toolchain@stable
|
|
with:
|
|
toolchain: nightly
|
|
components: "clippy, rustfmt"
|
|
- name: Rust lints
|
|
run: |
|
|
cargo +nightly fmt --all --check
|
|
cargo +nightly check --workspace
|
|
cargo +nightly clippy --workspace
|
|
- name: Build Python package
|
|
run: maturin develop --release --manifest-path pyargus/Cargo.toml
|
|
- name: Python checks
|
|
working-directory: pyargus
|
|
run: |
|
|
black .
|
|
isort .
|
|
flake8
|
|
ruff check .
|
|
mypy .
|
|
|
|
docs:
|
|
name: Documentation
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: write
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- uses: mamba-org/setup-micromamba@v1
|
|
with:
|
|
environment-name: ci
|
|
environment-file: environment.yaml
|
|
init-shell: bash
|
|
cache-environment: true
|
|
post-cleanup: 'all'
|
|
- name: Build Python package
|
|
run: maturin develop --release --manifest-path pyargus/Cargo.toml
|
|
- name: Build HTML docs
|
|
run: sphinx-build -b html docs docs/_build/
|
|
- name: Deploy
|
|
uses: peaceiris/actions-gh-pages@v3
|
|
if: github.ref == 'refs/heads/dev' || startsWith(github.ref, 'refs/tags/')
|
|
with:
|
|
github_token: ${{ secrets.GITHUB_TOKEN }}
|
|
publish_dir: docs/_build/
|
|
destination_dir: ${{ github.ref_name }}
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
ref: 'gh-pages'
|
|
- name: Install tree
|
|
run: |
|
|
sudo apt-get update -y
|
|
sudo apt-get install -y tree
|
|
- run: |
|
|
tree -H '.' \
|
|
-L 1 \
|
|
--noreport \
|
|
--dirsfirst \
|
|
--charset utf-8 \
|
|
--ignore-case \
|
|
--timefmt '%d-%b-%Y %H:%M' \
|
|
-I "index.html" \
|
|
-T 'Argus Python Documentation versions' \
|
|
-s -D \
|
|
-o index.html
|
|
git config user.name github-actions
|
|
git config user.email actions@github.com
|
|
git add .
|
|
if [[ ! $(git diff --quiet) ]]; then
|
|
git commit -m "update index.html"
|
|
git push
|
|
fi
|