Skip to content

Commit

Permalink
Merge branch 'main' into m2m2-simple-dev
Browse files Browse the repository at this point in the history
  • Loading branch information
DingoOz committed Dec 22, 2024
2 parents 189f86c + 95d7c60 commit dd87745
Show file tree
Hide file tree
Showing 7 changed files with 161 additions and 151 deletions.
27 changes: 27 additions & 0 deletions .github/filters.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
common: &common
- "flake.nix"
- "flake.lock"
- ".github/**"
docs-shell:
- *common
- "docs/**/*.nix"
- "docs/pyproject/**"
docs:
- *common
- "docs/**"
# software paths should only include files which are used by Doxygen
- "software/**/*.cpp"
- "software/**/*.hpp"
- "software/**/*.c"
- "software/**/*.h"
- "software/**/*.py"
- "software/**/*.pyi"
software:
- *common
- "software/**"
# ignore script updates
- "!software/scripts/**"
- "!software/ros_ws/colcon/**"
# we don't care about package.xml updates since they don't affect the nix build,
# we only care about it when the nix files get updated
- "!software/ros_ws/**/package.xml"
110 changes: 110 additions & 0 deletions .github/workflows/all.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
name: Nix CI/CD
on: [push, pull_request, workflow_dispatch]
permissions:
contents: read
jobs:
# get the file changes to filter other jobs
changes:
name: Detect changes
runs-on: ubuntu-latest
outputs:
manual: ${{ github.event_name == 'workflow_dispatch'}}
software: ${{ steps.filter.outputs.software }}
docs: ${{ steps.filter.outputs.docs }}
docs-shell: ${{ steps.filter.outputs.docs-shell }}
steps:
- uses: actions/checkout@v4
- uses: dorny/paths-filter@v3
id: filter
with:
filters: .github/filters.yaml
format:
name: Format and lint
# jobs which push to the repo all need to be in this concurrency group
concurrency:
group: "push"
# needed to push changes if needed
permissions:
contents: write
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: nixbuild/nix-quick-install-action@v29
- uses: DeterminateSystems/magic-nix-cache-action@main
- name: Format and lint repository
run: nix fmt
- uses: stefanzweifel/git-auto-commit-action@v5
# don't want to run the commit action on pull request workflows (ie, after the merge commit), only on push
# note: this applies to all push workflows, not just this job
if: ${{ github.event_name != 'pull_request' }}
with:
commit_message: "Run format and lint"
docs-shell:
name: Build docs dev shell
runs-on: ubuntu-latest
environment: binary-deployment
if: ${{ (needs.changes.outputs.docs-shell == 'true') || (needs.changes.outputs.manual == 'true') }}
needs: [changes, format]
steps:
- uses: actions/checkout@v4
- uses: nixbuild/nix-quick-install-action@v29
- uses: DeterminateSystems/magic-nix-cache-action@main
- name: Upload docs dev shell to Cachix
run: nix run -L .#scripts.cachix.docs-shell
env:
CACHIX_AUTH_TOKEN: ${{ secrets.CACHIX_AUTH_TOKEN }}
docs:
name: Build docs
runs-on: ubuntu-latest
environment: docs-deployment
if: ${{ (needs.changes.outputs.docs == 'true') || (needs.changes.outputs.manual == 'true') }}
needs: [changes, format, docs-shell]
steps:
- uses: actions/checkout@v4
- uses: nixbuild/nix-quick-install-action@v29
- uses: DeterminateSystems/magic-nix-cache-action@main
- name: Build docs
run: nix build -L .#docs
# From here, deploying to the website repo
- name: Checkout website repo
# only run on origin main branch
if: ${{ (github.event_name != 'pull_request') && (github.repository == 'ROAR-QUTRC/perseus-v2') && (github.ref == 'refs/heads/main') }}
id: checkout-website
uses: actions/checkout@v4
with:
repository: ROAR-QUTRC/roar-qutrc.github.io
ssh-key: ${{ secrets.DOCS_DEPLOY_KEY }}
path: docs
- name: Update docs in checked out repo
if: ${{ steps.checkout-website.outcome == 'success' }}
run: |
rm -rf docs/*
cp -a result/html/. docs/
- uses: stefanzweifel/git-auto-commit-action@v5
name: Commit and push changes
if: ${{ steps.checkout-website.outcome == 'success' }}
with:
commit_message: "Update generated docs"
repository: ./docs
build:
name: Build software
runs-on: ubuntu-latest
environment: binary-deployment
if: ${{ (needs.changes.outputs.software == 'true') || (needs.changes.outputs.manual == 'true') }}
needs: [changes, format]
steps:
- uses: actions/checkout@v4
- uses: nixbuild/nix-quick-install-action@v29
- uses: DeterminateSystems/magic-nix-cache-action@main
- name: Build repository
run: nix build -L
- name: Upload build to Cachix
run: nix run -L .#scripts.cachix.build
- name: Test dev shell
run: nix develop -L -c echo 'Shell test success'
- name: Upload dev shell to Cachix
run: nix run -L .#scripts.cachix.shell
- name: Run flake checks
run: nix flake check -L
env:
CACHIX_AUTH_TOKEN: ${{ secrets.CACHIX_AUTH_TOKEN }}
41 changes: 0 additions & 41 deletions .github/workflows/build.yaml

This file was deleted.

75 changes: 0 additions & 75 deletions .github/workflows/deploy-docs.yaml

This file was deleted.

23 changes: 23 additions & 0 deletions .github/workflows/intersphinx.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
on:
schedule:
# WARNING: When @RandomSpaceship leaves the project, this will need to be updated
# see: https://docs.github.com/en/actions/writing-workflows/choosing-when-your-workflow-runs/events-that-trigger-workflows#schedule
# note: the time is semi-random
- cron: "42 0 * * 1"
jobs:
intersphinx:
if: ${{ github.ref == 'refs/heads/main' }}
concurrency:
group: "push"
permissions:
contents: write
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: nixbuild/nix-quick-install-action@v29
- uses: DeterminateSystems/magic-nix-cache-action@main
- name: Update intersphinx inventory files
run: nix run .#docs.fetch-inventories
- uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: "Update intersphinx inventory files"
32 changes: 0 additions & 32 deletions .github/workflows/lint.yaml

This file was deleted.

4 changes: 1 addition & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,4 @@ Full documentation is located [here](https://roar-qutrc.github.io/)

## CI/CD Status

[![Format and lint repository](https://github.com/ROAR-QUTRC/perseus-v2/actions/workflows/lint.yaml/badge.svg)](https://github.com/ROAR-QUTRC/perseus-v2/actions/workflows/lint.yaml)
[![Deploy documentation to GH Pages](https://github.com/ROAR-QUTRC/perseus-v2/actions/workflows/deploy-docs.yaml/badge.svg)](https://github.com/ROAR-QUTRC/perseus-v2/actions/workflows/deploy-docs.yaml)
[![Build repo and run tests](https://github.com/ROAR-QUTRC/perseus-v2/actions/workflows/build.yaml/badge.svg)](https://github.com/ROAR-QUTRC/perseus-v2/actions/workflows/build.yaml)
[![Nix CI/CD](https://github.com/ROAR-QUTRC/perseus-v2/actions/workflows/all.yaml/badge.svg)](https://github.com/ROAR-QUTRC/perseus-v2/actions/workflows/all.yaml)

0 comments on commit dd87745

Please sign in to comment.