Skip to content

Commit ebb2482

Browse files
committed
test
1 parent ae9190b commit ebb2482

File tree

2 files changed

+47
-39
lines changed

2 files changed

+47
-39
lines changed

.github/workflows/test.yaml

+5-39
Original file line numberDiff line numberDiff line change
@@ -10,52 +10,18 @@ name: test
1010

1111
on:
1212
push:
13-
workflow_call:
14-
outputs:
15-
should_run_core_integration_tests:
16-
description: 'Whether core integration tests should run'
17-
value: ${{ jobs.check_paths.outputs.should_run_query_tests }}
18-
19-
env:
20-
QUERY_SERVICE_PATHS: 'weave-js/ weave_query/'
2113

2214
jobs:
23-
check_paths:
24-
runs-on: ubuntu-latest
25-
outputs:
26-
should_run_query_tests: ${{ steps.query_service.outputs.should_run_query_tests }}
27-
steps:
28-
- uses: actions/checkout@v3
29-
with:
30-
fetch-depth: 0
31-
fetch-tags: true
32-
ref: ${{ github.head_ref }}
33-
- run: git fetch origin ${{ github.base_ref }}
34-
- id: query_service
35-
run: |
36-
if [ "${{ github.event_name }}" = "pull_request" ]; then
37-
base_sha=$(git rev-parse origin/${{ github.base_ref }})
38-
head_sha=$(git rev-parse HEAD)
39-
changed_files=$(git diff --name-only $base_sha $head_sha)
40-
else
41-
changed_files=$(git diff --name-only HEAD^)
42-
fi
43-
44-
for path in ${{ env.WATCHED_PATHS }}; do
45-
if echo "$changed_files" | grep -q "$path"; then
46-
echo "should_run_query_tests=true" >> $GITHUB_OUTPUT
47-
exit 0
48-
fi
49-
done
50-
echo "should_run_query_tests=false" >> $GITHUB_OUTPUT
15+
determine_tests:
16+
uses: ./github/workflows/which-tests-to-run.yaml
5117

5218
# ==== Query Service Jobs ====
5319
build-container-query-service:
5420
name: Build Legacy (Query Service) test container
5521
timeout-minutes: 30
5622
runs-on: [self-hosted, builder]
5723
needs: check_paths
58-
if: ${{ needs.check_paths.outputs.should_run_query_tests == 'true' }}
24+
if: ${{ needs.determine_tests.outputs.should_run_query_tests == 'true' }}
5925

6026
# runs-on: ubuntu-latest
6127
env:
@@ -134,7 +100,7 @@ jobs:
134100
needs:
135101
- test-query-service
136102
- check_paths
137-
if: ${{ needs.check_paths.outputs.should_run_query_tests == 'true' }}
103+
if: ${{ needs.determine_tests.outputs.should_run_query_tests == 'true' }}
138104

139105
runs-on: ubuntu-latest
140106

@@ -149,7 +115,7 @@ jobs:
149115
name: WeaveJS Lint and Compile
150116
runs-on: ubuntu-latest
151117
needs: check_paths
152-
if: ${{ needs.check_paths.outputs.should_run_query_tests == 'true' }}
118+
if: ${{ needs.determine_tests.outputs.should_run_query_tests == 'true' }}
153119
# runs-on: [self-hosted, gke-runner]
154120
steps:
155121
- uses: actions/checkout@v2
+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: Determine which tests to run
2+
3+
on:
4+
push:
5+
pull_request:
6+
workflow_call:
7+
outputs:
8+
should_run_query_tests:
9+
description: 'Whether query tests should run'
10+
value: ${{ jobs.check_paths.outputs.should_run_query_tests }}
11+
12+
env:
13+
QUERY_SERVICE_PATHS: 'weave-js/ weave_query/'
14+
15+
jobs:
16+
check_paths:
17+
runs-on: ubuntu-latest
18+
outputs:
19+
should_run_query_tests: ${{ steps.query_service.outputs.should_run_query_tests }}
20+
steps:
21+
- uses: actions/checkout@v3
22+
with:
23+
fetch-depth: 0
24+
fetch-tags: true
25+
ref: ${{ github.head_ref }}
26+
- run: git fetch origin ${{ github.base_ref }}
27+
- id: query_service
28+
run: |
29+
if [ "${{ github.event_name }}" = "pull_request" ]; then
30+
base_sha=$(git rev-parse origin/${{ github.base_ref }})
31+
head_sha=$(git rev-parse HEAD)
32+
changed_files=$(git diff --name-only $base_sha $head_sha)
33+
else
34+
changed_files=$(git diff --name-only HEAD^)
35+
fi
36+
for path in ${{ env.QUERY_SERVICE_PATHS }}; do
37+
if echo "$changed_files" | grep -q "$path"; then
38+
echo "should_run_query_tests=true" >> $GITHUB_OUTPUT
39+
exit 0
40+
fi
41+
done
42+
echo "should_run_query_tests=false" >> $GITHUB_OUTPUT

0 commit comments

Comments
 (0)