153 lines
4.1 KiB
YAML
153 lines
4.1 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:
|
|
fail-fast: false
|
|
matrix:
|
|
os: ["ubuntu-latest", "windows-latest", "macos-latest"]
|
|
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: >-
|
|
mamba
|
|
init-shell: bash
|
|
cache-environment: true
|
|
post-cleanup: 'all'
|
|
- name: Install Rust toolchain
|
|
uses: dtolnay/rust-toolchain@stable
|
|
- name: Generate lockfile
|
|
run: cargo generate-lockfile
|
|
- name: Set up project cache
|
|
uses: actions/cache@v3
|
|
continue-on-error: false
|
|
with:
|
|
path: |
|
|
~/.cargo/bin/
|
|
~/.cargo/registry/index/
|
|
~/.cargo/registry/cache/
|
|
~/.cargo/git/db/
|
|
target/
|
|
.nox/
|
|
.hypothesis/
|
|
key: ${{ runner.os }}-argus-${{ hashFiles('**/Cargo.toml', 'noxfile.py') }}
|
|
restore-keys: ${{ runner.os }}-argus-
|
|
- name: Run tests
|
|
run: nox -s tests
|
|
|
|
linting:
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
os: ["ubuntu-latest", "windows-latest", "macos-latest"]
|
|
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: >-
|
|
mamba
|
|
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: Generate lockfile
|
|
run: cargo generate-lockfile
|
|
- name: Set up project cache
|
|
uses: actions/cache@v3
|
|
continue-on-error: false
|
|
with:
|
|
path: |
|
|
~/.cargo/bin/
|
|
~/.cargo/registry/index/
|
|
~/.cargo/registry/cache/
|
|
~/.cargo/git/db/
|
|
target/
|
|
.nox/
|
|
.hypothesis/
|
|
key: ${{ runner.os }}-argus-${{ hashFiles('**/Cargo.toml', 'noxfile.py') }}
|
|
restore-keys: ${{ runner.os }}-argus-
|
|
- name: Run lints
|
|
run: nox -t lint
|
|
|
|
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
|
|
create-args: >-
|
|
mamba
|
|
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: nox -s docs
|
|
- 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: _site/
|
|
keep_files: true
|
|
|
|
coverage:
|
|
strategy:
|
|
matrix:
|
|
os: ["ubuntu-latest"]
|
|
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: >-
|
|
mamba
|
|
init-shell: bash
|
|
cache-environment: true
|
|
post-cleanup: 'all'
|
|
- name: Install Rust toolchain
|
|
uses: dtolnay/rust-toolchain@nightly
|
|
- name: Generate Coverage Reports
|
|
run: nox -s coverage
|
|
- name: Upload coverage reports to Codecov
|
|
uses: codecov/codecov-action@v3
|
|
with:
|
|
files: rust.lcov,python.lcov
|
|
env:
|
|
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
|