这是indexloc提供的服务,不要输入任何密码
Skip to content

ci: conditional checks depending on source code changes #9731

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

Merged
merged 14 commits into from
Jan 23, 2025
Merged
Show file tree
Hide file tree
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
31 changes: 0 additions & 31 deletions .github/workflows/examples-test-basic.yml

This file was deleted.

31 changes: 0 additions & 31 deletions .github/workflows/examples-test-kitchen-sink.yml

This file was deleted.

31 changes: 0 additions & 31 deletions .github/workflows/examples-test-non-monorepo.yml

This file was deleted.

31 changes: 0 additions & 31 deletions .github/workflows/examples-test-with-svelte.yml

This file was deleted.

31 changes: 0 additions & 31 deletions .github/workflows/examples-test-with-tailwind.yml

This file was deleted.

149 changes: 148 additions & 1 deletion .github/workflows/turborepo-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,53 @@ permissions:
pull-requests: read

jobs:
find-changes:
name: Find path changes
runs-on: ubuntu-latest
outputs:
docs: ${{ steps.filter.outputs.docs }}
examples-utils: ${{ steps.filter.outputs.examples-utils }}
basic-example: ${{ steps.filter.outputs.basic-example }}
kitchen-sink-example: ${{ steps.filter.outputs.kitchen-sink-example }}
non-monorepo-example: ${{ steps.filter.outputs.non-monorepo-example }}
with-svelte-example: ${{ steps.filter.outputs.with-svelte-example }}
with-tailwind-example: ${{ steps.filter.outputs.with-tailwind-example }}
rest: ${{ steps.filter.outputs.rest }}
steps:
- uses: dorny/paths-filter@v3
id: filter
with:
filters: |
docs:
- "docs/**"
examples-utils:
- "turborepo-tests/helpers/**"
basic-example:
- examples/basic/**
- turborepo-tests/example-basic-*/**
kitchen-sink-example:
- examples/kitchen-sink/**
- turborepo-tests/example-kitchen-sink-*/**
non-monorepo-example:
- examples/non-monorepo/**
- turborepo-tests/example-non-monorepo-*/**
with-svelte-example:
- examples/with-svelte/**
- turborepo-tests/example-with-svelte-*/**
with-tailwind-example:
- examples/with-tailwind/**
- turborepo-tests/example-with-svelte-*/**
rest:
- "!examples/**"
- "!docs/**"

integration:
name: Turborepo Integration
needs:
- find-changes
runs-on: ${{ matrix.os.runner }}
timeout-minutes: 45
if: needs.find-changes.outputs.rest == 'true'
strategy:
fail-fast: false
matrix:
Expand Down Expand Up @@ -82,6 +125,9 @@ jobs:

rust_lint:
name: Rust lints
needs:
- find-changes
if: needs.find-changes.outputs.rest == 'true'
runs-on:
- "self-hosted"
- "linux"
Expand Down Expand Up @@ -115,6 +161,9 @@ jobs:
rust_check:
# We test dependency changes only on main
name: Turborepo rust check
needs:
- find-changes
if: needs.find-changes.outputs.rest == 'true'
runs-on:
- "self-hosted"
- "linux"
Expand Down Expand Up @@ -153,6 +202,9 @@ jobs:
runner: windows-latest
nextest: windows-tar
runs-on: ${{ matrix.os.runner }}
needs:
- find-changes
if: needs.find-changes.outputs.rest == 'true'
name: Turborepo Rust testing on ${{ matrix.os.name }}
steps:
- name: Set git to use LF line endings
Expand Down Expand Up @@ -195,6 +247,91 @@ jobs:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}

basic-example:
name: "`basic` example"
timeout-minutes: 40
if: needs.find-changes.outputs.basic-example == 'true'
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: "Run `basic` example tests"
uses: ./.github/actions/examples-tests
with:
github-token: "${{ secrets.GITHUB_TOKEN }}"
turbo-token: "${{ secrets.TURBO_TOKEN }}"
turbo-team: "${{ vars.TURBO_TEAM }}"
test-filter: "@turborepo-examples-tests/kitchen-sink-*"

kitchen-sink-example:
name: "`kitchen-sink` example"
timeout-minutes: 40
if: needs.find-changes.outputs.kitchen-sink-example == 'true'
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: "Run `kitchen-sink` example tests"
uses: ./.github/actions/examples-tests
with:
github-token: "${{ secrets.GITHUB_TOKEN }}"
turbo-token: "${{ secrets.TURBO_TOKEN }}"
turbo-team: "${{ vars.TURBO_TEAM }}"
test-filter: "@turborepo-examples-tests/kitchen-sink-*"

non-monorepo-example:
name: "`non-monorepo` example"
timeout-minutes: 40
if: needs.find-changes.outputs.non-monorepo-example == 'true'
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: "Run `non-monorepo` example tests"
uses: ./.github/actions/examples-tests
with:
github-token: "${{ secrets.GITHUB_TOKEN }}"
turbo-token: "${{ secrets.TURBO_TOKEN }}"
turbo-team: "${{ vars.TURBO_TEAM }}"
test-filter: "@turborepo-examples-tests/non-monorepo-*"

with-svelte-example:
name: "`with-svelte` example"
timeout-minutes: 40
if: needs.find-changes.outputs.with-svelte-example == 'true'
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: "Run `with-svelte` example tests"
uses: ./.github/actions/examples-tests
with:
github-token: "${{ secrets.GITHUB_TOKEN }}"
turbo-token: "${{ secrets.TURBO_TOKEN }}"
turbo-team: "${{ vars.TURBO_TEAM }}"
test-filter: "@turborepo-examples-tests/with-svelte-*"

with-tailwind-example:
name: "`with-tailwind` example"
timeout-minutes: 40
if: needs.find-changes.outputs.with-tailwind-example == 'true'
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: "Run `with-tailwind` example tests"
uses: ./.github/actions/examples-tests
with:
github-token: "${{ secrets.GITHUB_TOKEN }}"
turbo-token: "${{ secrets.TURBO_TOKEN }}"
turbo-team: "${{ vars.TURBO_TEAM }}"
test-filter: "@turborepo-examples-tests/with-tailwind-*"

summary:
name: Turborepo Test Summary
runs-on: ubuntu-latest
Expand All @@ -204,6 +341,11 @@ jobs:
- rust_lint
- rust_check
- rust_test
- basic-example
- kitchen-sink-example
- non-monorepo-example
- with-svelte-example
- with-tailwind-example
steps:
- name: Compute info
id: info
Expand All @@ -225,9 +367,14 @@ jobs:
subjob ${{needs.rust_lint.result}}
subjob ${{needs.rust_check.result}}
subjob ${{needs.rust_test.result}}
subjob ${{needs.basic-example.result}}
subjob ${{needs.kitchen-sink-example.result}}
subjob ${{needs.non-monorepo-example.result}}
subjob ${{needs.with-svelte-example.result}}
subjob ${{needs.with-tailwind-example.result}}

if [ "$cancelled" = "true" ]; then
echo "cancelled=true" >> $GITHUB_OUTPUT
echo "cancelled=true" >> $GITHUB_OUTPUT
elif [ "$failure" = "true" ]; then
echo "failure=true" >> $GITHUB_OUTPUT
else
Expand Down
Loading