blob: 5ec70bffd60d0b6d1569ec858b1165ed9faf90d6 [file]
# Licensed under the Apache-2.0 license
name: CI
on:
push:
branches: [ main, develop ]
pull_request:
branches: [ main, earlgrey-hwe ]
permissions:
contents: read
env:
CARGO_TERM_COLOR: always
RUST_BACKTRACE: 1
jobs:
presubmit:
name: Presubmit Checks
runs-on: openprot-ci-runner
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
- name: Setup Bazel
uses: bazel-contrib/setup-bazel@f34d6a05eae3c24acab7fa54587492daeaeffdab # 0.19.2
with:
bazelisk-cache: false
disk-cache: false
repository-cache: false
- name: Presubmit Checks
# The presubmit workflow performs formatting checks, a MODULE.bazel.lock
# up-to-date check, license checks, C/C++ include checks and clippy lints.
# See workflows.json for the `presubmit` definition.
run: ./pw presubmit
test:
name: Test
needs: presubmit
runs-on: openprot-ci-runner
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
- name: Setup Bazel
uses: bazel-contrib/setup-bazel@f34d6a05eae3c24acab7fa54587492daeaeffdab # 0.19.2
with:
bazelisk-cache: false
disk-cache: false
repository-cache: false
- name: Run tests
# See workflows.json for the `ci` definition.
run: ./pw ci
build:
name: Build Targets
needs: test
runs-on: openprot-ci-runner
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
- name: Setup Bazel
uses: bazel-contrib/setup-bazel@f34d6a05eae3c24acab7fa54587492daeaeffdab # 0.19.2
with:
bazelisk-cache: false
disk-cache: false
repository-cache: false
- name: Build
# See workflows.json for the `default` definition.
run: ./pw default
security-audit:
name: Security Audit
needs: presubmit
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@b725eda525362e7cf34af9a7243cac1e3f01a7ec # stable
with:
components: clippy
- name: Cache cargo registry
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Install cargo-audit
run: cargo install cargo-audit --version 0.22.2 --locked
- name: Install cargo-deny
run: cargo install cargo-deny --version 0.19.0 --locked
- name: Run security audit
run: cd third_party/crates_io; cargo audit
- name: Run cargo deny checks
run: cd third_party/crates_io; cargo deny check
- name: Run semgrep security scan
uses: returntocorp/semgrep-action@713efdd345f3035192eaa63f56867b88e63e4e5d # v1
with:
config: p/rust