-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add paths filter for conditional CI on detected changes
- Loading branch information
1 parent
4e02f4c
commit ae3fb95
Showing
6 changed files
with
193 additions
and
45 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
# This is used by the action https://github.com/dorny/paths-filter | ||
|
||
# Changes to actions/workflows that can affect any of our project components. | ||
action_changes: &action_changes | ||
- '.github/actions/**/action.yaml' | ||
- '.github/workflows/ci.yaml' | ||
- '.github/file-filters.yaml' | ||
|
||
# Frontend | ||
frontend_dependencies: &frontend_dependencies | ||
- 'frontend/{package,now,vercel}.json' | ||
- 'frontend/package-lock.json' | ||
|
||
eslint_config: &eslint_config | ||
- 'frontend/.eslint*' | ||
|
||
frontend_workflow: &frontend_workflow | ||
- '.github/workflows/frontend.yaml' | ||
|
||
frontend: &frontend | ||
- *action_changes | ||
- *frontend_dependencies | ||
- *frontend_workflow | ||
- *eslint_config | ||
- 'frontend/**/*.[tj]{s,sx}' | ||
- 'frontend/**/tsconfig*.json' | ||
|
||
proto: &proto | ||
- 'proto/*.proto' | ||
|
||
# Agency | ||
agency_dependencies: &agency_dependencies | ||
- 'agency/pyproject.toml' | ||
- 'agency/poetry.lock' | ||
- 'agency/.python-version' | ||
|
||
agency_workflow: &agency_workflow | ||
- '.github/workflows/agency.yaml' | ||
|
||
agency: &agency | ||
- *action_changes | ||
- *agency_dependencies | ||
- *agency_workflow | ||
- *proto | ||
- 'agency/app/**/*.py' | ||
|
||
# Server | ||
server_dependencies: &server_dependencies | ||
- 'Cargo.toml' | ||
- 'Cargo.lock' | ||
- 'rust-toolchain.toml' | ||
|
||
server_workflow: &server_workflow | ||
- '.github/workflows/server.yaml' | ||
|
||
server_migrations: &server_migrations | ||
- 'server/migrations/**.sql' | ||
|
||
sqlx_query_cache: &sqlx_query_cache | ||
- 'server/.sqlx/**.json' | ||
|
||
server_config: &server_config | ||
- 'server/config/**.toml' | ||
|
||
server: &server | ||
- *action_changes | ||
- *server_dependencies | ||
- *server_workflow | ||
- *server_migrations | ||
- *sqlx_query_cache | ||
- *proto | ||
- 'server/src/**/*.rs' |
5 changes: 2 additions & 3 deletions
5
.github/workflows/python.yaml → .github/workflows/agency.yaml
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,6 @@ | ||
name: Python CI | ||
|
||
name: Agency CI | ||
on: | ||
push: | ||
workflow_call: | ||
|
||
defaults: | ||
run: | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
name: CI | ||
|
||
on: push | ||
|
||
env: | ||
CARGO_TERM_COLOR: always | ||
CARGO_INCREMENTAL: 0 | ||
CARGO_NET_RETRY: 10 | ||
RUST_BACKTRACE: short | ||
RUSTFLAGS: "-D warnings" | ||
RUSTUP_MAX_RETRIES: 10 | ||
|
||
jobs: | ||
detect-changes: | ||
name: Detect which files have changed | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 3 | ||
# Map a step output to a job output | ||
outputs: | ||
agency: ${{ steps.changes.outputs.agency }} | ||
frontend: ${{ steps.changes.outputs.frontend }} | ||
llmlingua_service: ${{ steps.changes.outputs.llmlingua_service }} | ||
proto: ${{ steps.changes.outputs.proto }} | ||
server: ${{ steps.changes.outputs.server }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Find changes | ||
uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 | ||
id: changes | ||
with: | ||
token: ${{ github.token }} | ||
filters: .github/file-filters.yaml | ||
|
||
agency: | ||
if: needs.detect-changes.outputs.agency == 'true' | ||
needs: detect-changes | ||
uses: ./.github/workflows/agency.yaml | ||
|
||
server: | ||
if: needs.detect-changes.outputs.server == 'true' | ||
needs: detect-changes | ||
uses: ./.github/workflows/server.yaml |
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
name: Rust Server CI | ||
on: | ||
workflow_call: | ||
|
||
defaults: | ||
run: | ||
working-directory: server | ||
|
||
env: | ||
CARGO_TERM_COLOR: always | ||
CARGO_INCREMENTAL: 0 | ||
CARGO_NET_RETRY: 10 | ||
RUST_BACKTRACE: short | ||
RUSTFLAGS: "-D warnings" | ||
RUSTUP_MAX_RETRIES: 10 | ||
|
||
jobs: | ||
detect-changes: | ||
name: Detect which files have changed | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 3 | ||
# Map a step output to a job output | ||
outputs: | ||
agency: ${{ steps.changes.outputs.agency }} | ||
frontend: ${{ steps.changes.outputs.frontend }} | ||
llmlingua_service: ${{ steps.changes.outputs.llmlingua_service }} | ||
proto: ${{ steps.changes.outputs.proto }} | ||
server: ${{ steps.changes.outputs.server }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Find changes | ||
uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v2 | ||
id: changes | ||
with: | ||
token: ${{ github.token }} | ||
filters: .github/file-filters.yml | ||
|
||
coverage-and-linting: | ||
name: Test coverage & linting | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- uses: dorny/paths-filter@v3 | ||
id: changes | ||
with: | ||
filters: | | ||
src: | ||
- 'src/**' | ||
# run only if some file in 'src' folder was changed | ||
- if: steps.changes.outputs.src == 'true' | ||
run: ... | ||
|
||
- name: Install Protoc | ||
uses: arduino/setup-protoc@v3 | ||
with: | ||
repo-token: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Setup Rust Toolchain | ||
uses: ./.github/actions/toolchain-cargo-cached | ||
with: | ||
components: llvm-tools-preview, rustfmt, clippy | ||
crates: cargo-llvm-cov | ||
|
||
- name: Tests & coverage | ||
run: cargo llvm-cov test --no-fail-fast --workspace | ||
|
||
- name: Linting rustfmt | ||
run: cargo fmt --all -- --check | ||
|
||
- name: Linting clippy | ||
run: cargo clippy -- |