Skip to content

Commit

Permalink
chore(ci): Only run workflows pertaining to the part of the codebase …
Browse files Browse the repository at this point in the history
…that changed (#789)
  • Loading branch information
romac authored Jan 21, 2025
1 parent f044fe2 commit 4b64acc
Show file tree
Hide file tree
Showing 5 changed files with 114 additions and 37 deletions.
28 changes: 23 additions & 5 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,6 @@ on:
push:
branches: main
pull_request:
paths:
- code/**
- specs/quint/**
- .github/workflows/coverage.yml

env:
CARGO_TERM_COLOR: always
Expand All @@ -19,8 +15,28 @@ env:
RUSTUP_MAX_RETRIES: 10

jobs:
changes:
name: Detect changes
runs-on: ubuntu-latest
permissions:
pull-requests: read
outputs:
code: ${{ steps.filter.outputs.code }}
specs: ${{ steps.filter.outputs.specs }}
steps:
- uses: dorny/paths-filter@v3
id: filter
with:
filters: |
code:
- 'code/**'
specs:
- 'specs/**'
integration:
name: Integration
needs: changes
if: ${{ needs.changes.outputs.code == 'true' }}
runs-on: ubuntu-latest
defaults:
run:
Expand All @@ -31,7 +47,7 @@ jobs:
- name: Checkout
uses: actions/checkout@v4
- name: Install Protoc
uses: arduino/setup-protoc@v3
uses: arduino/setup-protoc@v
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Setup Node
Expand Down Expand Up @@ -75,6 +91,8 @@ jobs:

mbt:
name: MBT
needs: changes
if: ${{ needs.changes.outputs.code == 'true' || needs.changes.outputs.specs == 'true' }}
runs-on: ubuntu-latest
defaults:
run:
Expand Down
27 changes: 20 additions & 7 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,7 @@ name: Docs

on:
push:
branches:
- main
paths:
- code/**
- .github/workflows/todo-tracking.yml
branches: main

permissions:
contents: read
Expand All @@ -18,8 +14,25 @@ concurrency:
cancel-in-progress: false

jobs:
changes:
name: Detect changes
runs-on: ubuntu-latest
permissions:
pull-requests: read
outputs:
code: ${{ steps.filter.outputs.code }}
steps:
- uses: dorny/paths-filter@v3
id: filter
with:
filters: |
code:
- 'code/**'
build:
name: Build
needs: changes
if: ${{ needs.changes.outputs.code == 'true' }}
runs-on: ubuntu-latest
defaults:
run:
Expand Down Expand Up @@ -53,11 +66,11 @@ jobs:

deploy:
name: Deploy
runs-on: ubuntu-latest
needs: build
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: build
steps:
- name: Deploy to GitHub Pages
id: deployment
Expand Down
31 changes: 21 additions & 10 deletions .github/workflows/mbt.yml
Original file line number Diff line number Diff line change
@@ -1,21 +1,32 @@
name: MBT
on:
push:
branches:
- main
paths:
- specs/quint/**
- code/**
- .github/workflows/mbt.yml
branches: main
pull_request:
paths:
- specs/quint/**
- code/**
- .github/workflows/mbt.yml

jobs:
changes:
name: Detect changes
runs-on: ubuntu-latest
permissions:
pull-requests: read
outputs:
code: ${{ steps.filter.outputs.code }}
specs: ${{ steps.filter.outputs.specs }}
steps:
- uses: dorny/paths-filter@v3
id: filter
with:
filters: |
code:
- 'code/**'
specs:
- 'specs/**'
mbt-tests:
name: Run MBT Tests
needs: changes
if: ${{ needs.changes.outputs.code == 'true' || needs.changes.outputs.specs == 'true' }}
runs-on: ubuntu-latest
env:
CARGO_INCREMENTAL: 0
Expand Down
26 changes: 20 additions & 6 deletions .github/workflows/quint.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,31 @@
on:
workflow_dispatch:
push:
branches:
- main
paths:
- specs/**/*.qnt
branches: main
pull_request:
paths:
- specs/**/*.qnt

name: Quint

jobs:
changes:
name: Detect changes
runs-on: ubuntu-latest
permissions:
pull-requests: read
outputs:
specs: ${{ steps.filter.outputs.specs }}
steps:
- uses: dorny/paths-filter@v3
id: filter
with:
filters: |
specs:
- 'specs/**'
quint-typecheck:
name: Typecheck
needs: changes
if: ${{ needs.changes.outputs.specs == 'true' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand All @@ -25,6 +37,8 @@ jobs:

quint-test:
name: Test
needs: changes
if: ${{ needs.changes.outputs.specs == 'true' }}
runs-on: ubuntu-latest
env:
MAX_SAMPLES: 100
Expand Down
39 changes: 30 additions & 9 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,7 @@ name: Rust
on:
push:
branches: main
paths:
- code/**
- specs/quint/**
- .github/workflows/rust.yml
pull_request:
paths:
- code/**
- specs/quint/**
- .github/workflows/rust.yml

env:
CARGO_INCREMENTAL: 0
Expand All @@ -23,8 +15,25 @@ env:
RUSTUP_MAX_RETRIES: 10

jobs:
changes:
name: Detect changes
runs-on: ubuntu-latest
permissions:
pull-requests: read
outputs:
code: ${{ steps.filter.outputs.code }}
steps:
- uses: dorny/paths-filter@v3
id: filter
with:
filters: |
code:
- 'code/**'
test:
name: Unit Tests
needs: changes
if: ${{ needs.changes.outputs.code == 'true' }}
runs-on: ubuntu-latest
defaults:
run:
Expand Down Expand Up @@ -60,6 +69,8 @@ jobs:
integration:
name: Integration Tests
needs: changes
if: ${{ needs.changes.outputs.code == 'true' }}
runs-on: ubuntu-latest
defaults:
run:
Expand Down Expand Up @@ -95,6 +106,8 @@ jobs:
no_std:
name: no_std compatibility
needs: changes
if: ${{ needs.changes.outputs.code == 'true' }}
runs-on: ubuntu-latest
defaults:
run:
Expand All @@ -108,14 +121,16 @@ jobs:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Setup Rust toolchain
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
with:
cache-workspaces: "code"
target: thumbv7m-none-eabi
- name: Check no_std compatibility
run: cargo build --target thumbv7m-none-eabi -p informalsystems-malachitebft-peer

clippy:
name: Clippy
needs: changes
if: ${{ needs.changes.outputs.code == 'true' }}
runs-on: ubuntu-latest
steps:
- name: Checkout
Expand All @@ -137,6 +152,8 @@ jobs:

fmt:
name: Formatting
needs: changes
if: ${{ needs.changes.outputs.code == 'true' }}
runs-on: ubuntu-latest
steps:
- name: Checkout
Expand All @@ -153,6 +170,8 @@ jobs:

msrv:
name: MSRV
needs: changes
if: ${{ needs.changes.outputs.code == 'true' }}
runs-on: ubuntu-latest
defaults:
run:
Expand All @@ -176,6 +195,8 @@ jobs:

standalone:
name: Standalone
needs: changes
if: ${{ needs.changes.outputs.code == 'true' }}
runs-on: ubuntu-latest
defaults:
run:
Expand Down

0 comments on commit 4b64acc

Please sign in to comment.