Continuous Integration #4527
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Continuous Integration | |
on: | |
merge_group: | |
push: | |
branches: [main] | |
pull_request: | |
branches: [main] | |
schedule: | |
# UTC | |
- cron: '48 4 * * *' | |
env: | |
CARGO_TERM_COLOR: always | |
jobs: | |
style: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
target: thumbv7em-none-eabihf | |
override: true | |
- name: cargo fmt --check | |
uses: actions-rs/cargo@v1 | |
with: | |
command: fmt | |
args: --all -- --check | |
- uses: actions-rs/clippy-check@v1 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
- name: cargo check | |
uses: actions-rs/cargo@v1 | |
with: | |
command: check | |
args: --verbose | |
- uses: actions/setup-python@v1 | |
with: | |
python-version: 3.8 | |
- name: Install Python Dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install py/ | |
pip install pylint | |
- name: Run Pylint | |
run: | | |
pylint py/stabilizer | |
compile: | |
runs-on: ubuntu-latest | |
continue-on-error: ${{ matrix.continue-on-error }} | |
strategy: | |
matrix: | |
toolchain: [stable] | |
features: [''] | |
continue-on-error: [false] | |
include: | |
- toolchain: beta | |
features: '' | |
continue-on-error: true | |
- toolchain: nightly | |
features: nightly | |
continue-on-error: true | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: ${{ matrix.toolchain }} | |
target: thumbv7em-none-eabihf | |
override: true | |
- uses: actions-rs/cargo@v1 | |
with: | |
command: build | |
args: --release --features "${{ matrix.features }}" | |
doc: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
target: thumbv7em-none-eabihf | |
override: true | |
- uses: Swatinem/rust-cache@v1 | |
- uses: peaceiris/actions-mdbook@v1 | |
with: | |
mdbook-version: '0.4.12' | |
- name: Install Deadlinks | |
uses: actions-rs/cargo@v1 | |
with: | |
command: install | |
args: | | |
cargo-deadlinks | |
- name: Install Linkcheck | |
uses: actions-rs/cargo@v1 | |
with: | |
command: install | |
args: mdbook-linkcheck | |
- name: cargo doc | |
uses: actions-rs/cargo@v1 | |
with: | |
command: doc | |
args: --no-deps -p miniconf -p idsp -p ad9959 -p stabilizer | |
- name: cargo deadlinks | |
uses: actions-rs/cargo@v1 | |
with: | |
command: deadlinks | |
# We intentionally ignore fragments, as RTIC may generate fragments for various | |
# auto-generated code. | |
args: --dir target/thumbv7em-none-eabihf/doc --ignore-fragments --check-intra-doc-links | |
- name: Test Book | |
working-directory: book | |
run: | | |
# Install depedencies at our cache location | |
mv ../target/thumbv7em-none-eabihf/doc src/firmware | |
mdbook build | |
hitl-trigger: | |
runs-on: ubuntu-latest | |
environment: hitl | |
# This crucially marks the job as "skipped" when not in the merge queue thus | |
# counting as passing the required check when adding it to the merge queue. | |
# See | |
# https://docs.github.com/en/actions/using-jobs/using-conditions-to-control-job-execution#overview | |
if: ${{ github.event_name == 'merge_group' }} | |
steps: | |
- uses: LouisBrunner/checks-action@v1.1.1 | |
id: hitl-check | |
with: | |
repo: ${{ github.repository }} | |
sha: ${{ github.event.head_commit.id }} | |
token: ${{ github.token }} | |
name: HITL Run Status | |
status: in_progress | |
details_url: "https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}" | |
output: | | |
{"summary": "Starting..."} | |
- uses: peter-evans/repository-dispatch@v1 | |
with: | |
token: ${{ secrets.DISPATCH_PAT }} | |
event-type: stabilizer | |
repository: quartiq/hitl | |
client-payload: | | |
{"github": ${{ toJson(github) }}, "check_id": ${{steps.hitl-check.outputs.check_id}}} | |
- uses: fountainhead/action-wait-for-check@v1.0.0 | |
id: status | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
checkName: HITL Run Status | |
ref: ${{ github.event.pull_request.head.sha }} | |
# The HITL can be backlogged by multiple queues, where each takes ~5 minutes to complete. | |
timeoutSeconds: 3600 | |
- name: "Check HITL Status" | |
if: steps.status.outputs.conclusion != 'success' | |
run: exit -1 |