Draft #11030
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: Run checks | |
on: | |
push: | |
branches: | |
- main | |
# Run in PRs with conflicts (https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#pull_request) | |
pull_request_target: | |
types: [opened, synchronize, reopened] | |
workflow_dispatch: | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event.pull_request.number }} | |
cancel-in-progress: true | |
permissions: | |
id-token: write | |
contents: read | |
env: | |
RUSTC_WRAPPER: sccache | |
SCCACHE_S3_USE_SSL: ${{ secrets.CACHE_SSL }} | |
GIT_LFS_SKIP_SMUDGE: 1 | |
CARGO_INCREMENTAL: 0 | |
RUST_BACKTRACE: full | |
SCCACHE_BUCKET: namada-cache | |
SCCACHE_ENDPOINT: ${{ secrets.CACHE_ENDPOINT }} | |
AWS_ACCESS_KEY_ID: ${{ secrets.CACHE_ACCESS_KEY }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.CACHE_SECRET_KEY }} | |
AWS_REGION: us-east-1 | |
jobs: | |
clippy-fmt: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-latest] | |
nightly_version: [nightly-2024-05-15] | |
make: | |
- name: Clippy | |
command: clippy | |
- name: Format | |
command: check && make fmt-check | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@v4 | |
if: ${{ github.event_name != 'pull_request_target' }} | |
- name: Checkout PR | |
uses: actions/checkout@v4 | |
if: ${{ github.event_name == 'pull_request_target' }} | |
# See comment in build-and-test.yml | |
with: | |
ref: ${{ github.event.pull_request.head.sha }} | |
- name: Remove some unused data in github runners | |
run: | | |
sudo rm -rf /usr/share/dotnet | |
sudo rm -rf /opt/ghc | |
sudo rm -rf "/usr/local/share/boost" | |
sudo rm -rf "$AGENT_TOOLSDIRECTORY" | |
- name: Install libudev | |
run: sudo apt-get update && sudo apt-get -y install libudev-dev | |
- name: Install Protoc | |
uses: heliaxdev/setup-protoc@v2 | |
with: | |
version: "25.0" | |
repo-token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Setup rust toolchain | |
uses: oxidecomputer/actions-rs_toolchain@ad3f86084a8a5acf2c09cb691421b31cf8af7a36 | |
with: | |
target: wasm32-unknown-unknown | |
profile: default | |
override: true | |
- name: Setup rust nightly | |
uses: oxidecomputer/actions-rs_toolchain@ad3f86084a8a5acf2c09cb691421b31cf8af7a36 | |
with: | |
toolchain: ${{ matrix.nightly_version }} | |
target: wasm32-unknown-unknown | |
profile: default | |
- name: Show rust toolchain info | |
run: rustup show | |
- name: Cache cargo registry | |
uses: actions/cache@v3 | |
continue-on-error: false | |
with: | |
path: | | |
~/.cargo/registry/index/ | |
~/.cargo/registry/cache/ | |
~/.cargo/git/db/ | |
target | |
key: ${{ runner.os }}-${{ github.job }}-cargo-${{ hashFiles('**/Cargo.lock') }} | |
restore-keys: ${{ runner.os }}-cargo- | |
- name: Run sccache-cache | |
uses: mozilla-actions/[email protected] | |
with: | |
version: "v0.7.7" | |
- name: Start sccache server | |
run: sccache --start-server | |
- name: ${{ matrix.make.name }} | |
run: make ${{ matrix.make.command }} | |
- name: Print sccache stats | |
if: always() | |
run: sccache --show-stats || true | |
- name: Stop sccache server | |
if: always() | |
run: sccache --stop-server || true | |
- name: Clean cargo cache | |
run: | | |
cargo install cargo-cache --no-default-features --features ci-autoclean cargo-cache | |
cargo-cache |