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

Fine-tune CI Workflows in PR #964

Merged
merged 10 commits into from
Aug 15, 2024
47 changes: 42 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ on:
paths-ignore:
- 'api/docs/**'
- 'build/charts/**'
- 'design/**'
- '**/*.md'
- '**/*.txt'
- '**/.gitignore'
Expand All @@ -16,11 +17,39 @@ env:
GO_VERSION: '1.21'

jobs:
ci-target-check:
runs-on: ubuntu-latest

outputs:
build: ${{ steps.ci-target-check.outputs.build }}
bench: ${{ steps.ci-target-check.outputs.bench }}
sharding-test: ${{ steps.ci-target-check.outputs.sharding-test }}

steps:
- name: CI target check by path
uses: dorny/paths-filter@v3
id: ci-target-check
with:
filters: |
build: '**'
bench:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about simplifying below packages like this?

            - 'pkg/**'
            - 'server/**'
            - 'client/**'
            - 'admin/**'
            - 'api/converter/**'

For api/types/** and /test/helper/**, we can skip it because it has low impact on the bench.
Also simplifying to pkg/** because this package is all about CRDT itself.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your quick review!

I was a bit concerned that I might have defined the bench target too narrowly,
but I think your suggestion is much better!

- 'pkg/**'
- 'server/**'
- 'client/**'
- 'admin/**'
- 'api/converter/**'

sharding-test:
- 'server/backend/database/**'

build:
name: build
runs-on: ubuntu-latest
steps:

needs: ci-target-check
if: ${{ needs.ci-target-check.outputs.build == 'true' }}

steps:
- name: Set up Go ${{ env.GO_VERSION }}
uses: actions/setup-go@v4
with:
Expand Down Expand Up @@ -58,11 +87,15 @@ jobs:
file: ./coverage.txt
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

bench:
name: bench
runs-on: ubuntu-latest
permissions: write-all

needs: ci-target-check
if: ${{ needs.ci-target-check.outputs.bench == 'true' }}

steps:

- name: Set up Go ${{ env.GO_VERSION }}
Expand Down Expand Up @@ -100,9 +133,13 @@ jobs:
github-token: ${{ secrets.GITHUB_TOKEN }}
comment-always: true

sharding_test:
name: sharding_test
sharding-test:
name: sharding-test
runs-on: ubuntu-latest

needs: ci-target-check
if: ${{ needs.ci-target-check.outputs.sharding-test == 'true' }}

steps:

- name: Set up Go ${{ env.GO_VERSION }}
Expand All @@ -127,7 +164,7 @@ jobs:

- name: Initialize the Shard 1
run: docker compose -f build/docker/sharding/docker-compose.yml exec shard1-1 mongosh test /scripts/init-shard1-1.js

- name: Initialize the Shard 2
run: docker compose -f build/docker/sharding/docker-compose.yml exec shard2-1 mongosh test /scripts/init-shard2-1.js

Expand Down
Loading