Merge pull request #325 from quartiq/feature/enforce-hitl #1298
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, staging, trying] | |
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 | |
- uses: Swatinem/rust-cache@v1 | |
- 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 }} | |
compile: | |
runs-on: ubuntu-latest | |
continue-on-error: ${{ matrix.toolchain == 'nightly' }} | |
strategy: | |
max-parallel: 2 | |
matrix: | |
toolchain: | |
- stable | |
- '1.65.0' | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Install Rust ${{ matrix.toolchain }} | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: ${{ matrix.toolchain }} | |
target: thumbv7em-none-eabihf | |
override: true | |
components: llvm-tools-preview | |
- uses: Swatinem/rust-cache@v1 | |
if: ${{ matrix.toolchain != 'nightly' }} | |
- name: Install Binutils | |
uses: actions-rs/cargo@v1 | |
with: | |
command: install | |
args: cargo-binutils | |
- name: Build [Debug] | |
uses: actions-rs/cargo@v1 | |
with: | |
command: build | |
- name: Build [Release] | |
uses: actions-rs/cargo@v1 | |
with: | |
command: build | |
args: --release | |
- name: Extract Binary | |
uses: actions-rs/cargo@v1 | |
with: | |
command: objcopy | |
args: --release --verbose -- -O binary booster-release.bin | |
- name: Upload Artifacts | |
uses: actions/upload-artifact@v2 | |
if: ${{ matrix.toolchain == 'stable' | |
&& (github.ref == 'refs/heads/master' | |
|| github.ref == 'refs/heads/develop') }} | |
with: | |
name: Firmware Images | |
path: | | |
target/*/release/booster | |
booster-release.bin | |
hitl-trigger: | |
runs-on: ubuntu-latest | |
if: ${{ github.event_name == 'merge_group' }} | |
environment: hitl | |
steps: | |
- uses: LouisBrunner/[email protected] | |
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: booster | |
repository: quartiq/hitl | |
client-payload: | | |
{"github": ${{ toJson(github) }}, "check_id": ${{steps.hitl-check.outputs.check_id}}} | |
- uses: fountainhead/[email protected] | |
id: status | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
checkName: HITL Run Status | |
ref: ${{ github.event.pull_request.head.sha }} | |
- name: "Check HITL Status" | |
if: steps.status.outputs.conclusion != 'success' | |
run: exit -1 |