Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Skip CI jobs when no file change #1450

Merged
merged 3 commits into from
Sep 26, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 46 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,36 @@ concurrency:
permissions: read-all

jobs:
paths-filter:
runs-on: ubuntu-latest
outputs:
src: ${{ steps.filter.outputs.src }}
kakarot_scripts: ${{ steps.filter.outputs.kakarot_scripts }}
solidity: ${{ steps.filter.outputs.solidity }}
tests: ${{ steps.filter.outputs.tests }}
steps:
- uses: actions/checkout@v4
- uses: dorny/paths-filter@v3
id: filter
with:
filters: |
src:
- 'src/**'
kakarot_scripts:
- 'kakarot_scripts/**'
solidity:
- 'solidity_contracts/**'
tests:
- 'tests/**'

build:
runs-on: ubuntu-latest
env:
CI_COMMIT_MESSAGE: CI Formatting Auto Commit
CI_COMMIT_AUTHOR: ${{ github.event.repository.name }} CI
needs: paths-filter
if:
needs.paths-filter.outputs.src == 'true' ||
needs.paths-filter.outputs.kakarot_scripts == 'true'
steps:
- uses: actions/checkout@v4
# Python setup
- name: Set up Python 3.10.14
uses: actions/setup-python@v5
with:
Expand Down Expand Up @@ -73,6 +95,10 @@ jobs:
runs-on: ubuntu-latest-16-cores
env:
PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION: python
needs: paths-filter
if:
needs.paths-filter.outputs.src == 'true' ||
needs.paths-filter.outputs.tests == 'true'
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.10.14
Expand Down Expand Up @@ -126,6 +152,12 @@ jobs:
env:
STARKNET_NETWORK: katana
PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION: python
needs: paths-filter
if:
needs.paths-filter.outputs.src == 'true' ||
needs.paths-filter.outputs.kakarot_scripts == 'true' ||
needs.paths-filter.outputs.solidity == 'true' ||
needs.paths-filter.outputs.tests == 'true'
steps:
- uses: actions/checkout@v4
- name: Extract Katana Version
Expand Down Expand Up @@ -186,6 +218,8 @@ jobs:

forge-test:
runs-on: ubuntu-latest
needs: paths-filter
if: needs.paths-filter.outputs.solidity == 'true'
steps:
- uses: actions/checkout@v4
- name: Install Foundry
Expand All @@ -199,7 +233,10 @@ jobs:

ef-tests:
runs-on: ubuntu-latest-32-cores
needs: build
needs:
- build
- paths-filter
if: needs.paths-filter.outputs.src == 'true'
steps:
- name: Checkout ef-tests
uses: actions/checkout@v4
Expand Down Expand Up @@ -251,7 +288,10 @@ jobs:

resources:
runs-on: ubuntu-latest
needs: ef-tests
needs:
- ef-tests
- paths-filter
if: needs.paths-filter.outputs.src == 'true'
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.10.14
Expand Down
Loading