Skip to content

Commit 5c44627

Browse files
committed
Merge branch 'master' into compute-engine
2 parents f769f74 + 5f46279 commit 5c44627

File tree

13 files changed

+191
-17
lines changed

13 files changed

+191
-17
lines changed
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
name: Check if Tests should be Skipped
2+
description: Determines if tests can be skipped based on changed files
3+
4+
inputs:
5+
head-sha:
6+
description: 'The SHA of the head commit'
7+
required: true
8+
excluded-dirs:
9+
description: 'Comma-separated list of directories to exclude'
10+
required: false
11+
default: 'docs/**,community/**,examples/**'
12+
13+
outputs:
14+
skip_tests:
15+
description: 'Whether tests should be skipped'
16+
value: ${{ steps.check_skip_tests.outputs.skip_tests }}
17+
18+
runs:
19+
using: composite
20+
steps:
21+
- name: Checkout code
22+
uses: actions/checkout@v4
23+
with:
24+
fetch-depth: 0
25+
ref: ${{ inputs.head-sha }}
26+
27+
- name: Fetch base branch
28+
shell: bash
29+
run: |
30+
git fetch origin ${{ github.base_ref }}:$GITHUB_REF_BASE
31+
env:
32+
GITHUB_REF_BASE: refs/remotes/origin/${{ github.base_ref }}
33+
34+
- name: Set excluded dirs
35+
id: set_excluded_dirs
36+
shell: bash
37+
run: |
38+
EXCLUDED_DIRS="${{ inputs.excluded-dirs }}"
39+
IFS=',' read -r -a EXCLUDED_DIRS_ARRAY <<< "$EXCLUDED_DIRS"
40+
echo "Excluded directories: ${EXCLUDED_DIRS_ARRAY[@]}"
41+
echo "EXCLUDED_DIRS_ARRAY=${EXCLUDED_DIRS_ARRAY[@]}" >> $GITHUB_ENV
42+
43+
- name: Check for excluded directory changes
44+
id: check_skip_tests
45+
shell: bash
46+
run: |
47+
CHANGED_FILES=$(git diff --name-only $GITHUB_REF_BASE ${{ inputs.head-sha }})
48+
echo "Changed files:"
49+
echo "$CHANGED_FILES"
50+
51+
# Build a regex pattern from the excluded directories
52+
EXCLUDE_PATTERN=$(IFS='|'; echo "${EXCLUDED_DIRS_ARRAY[*]}")
53+
NON_EXCLUDED_CHANGED=$(echo "$CHANGED_FILES" | grep -Ev "^($EXCLUDE_PATTERN)" || true)
54+
55+
if [[ -z "$NON_EXCLUDED_CHANGED" ]]; then
56+
echo "skip_tests=true" >> $GITHUB_ENV
57+
echo "skip_tests=true" >> $GITHUB_OUTPUT
58+
else
59+
echo "skip_tests=false" >> $GITHUB_ENV
60+
echo "skip_tests=false" >> $GITHUB_OUTPUT
61+
fi
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
name: Check if Tests should be Skipped
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
head-sha:
7+
required: true
8+
type: string
9+
excluded-dirs:
10+
required: false
11+
type: string
12+
default: 'docs/**,community/**,examples/**'
13+
14+
jobs:
15+
check-changes:
16+
runs-on: ubuntu-latest
17+
outputs:
18+
skip_tests: ${{ steps.check_skip_tests.outputs.skip_tests }}
19+
20+
steps:
21+
- name: Checkout code
22+
uses: actions/checkout@v4
23+
with:
24+
fetch-depth: 0
25+
ref: ${{ inputs.head-sha }}
26+
27+
- name: Fetch base branch
28+
run: |
29+
git fetch origin ${{ github.base_ref }}:$GITHUB_REF_BASE
30+
env:
31+
GITHUB_REF_BASE: refs/remotes/origin/${{ github.base_ref }}
32+
33+
- name: Set excluded dirs
34+
id: set_excluded_dirs
35+
run: |
36+
EXCLUDED_DIRS="${{ inputs.excluded-dirs }}"
37+
IFS=',' read -r -a EXCLUDED_DIRS_ARRAY <<< "$EXCLUDED_DIRS"
38+
echo "Excluded directories: ${EXCLUDED_DIRS_ARRAY[@]}"
39+
echo "EXCLUDED_DIRS_ARRAY=${EXCLUDED_DIRS_ARRAY[@]}" >> $GITHUB_ENV
40+
41+
- name: Check for excluded directory changes
42+
id: check_skip_tests
43+
run: |
44+
CHANGED_FILES=$(git diff --name-only $GITHUB_REF_BASE ${{ inputs.head-sha }})
45+
echo "Changed files:"
46+
echo "$CHANGED_FILES"
47+
48+
# Build a regex pattern from the excluded directories
49+
EXCLUDE_PATTERN=$(IFS='|'; echo "${EXCLUDED_DIRS_ARRAY[*]}")
50+
NON_EXCLUDED_CHANGED=$(echo "$CHANGED_FILES" | grep -Ev "^($EXCLUDE_PATTERN)" || true)
51+
52+
if [[ -z "$NON_EXCLUDED_CHANGED" ]]; then
53+
echo "skip_tests=true" >> "$GITHUB_ENV"
54+
echo "::set-output name=skip_tests::true"
55+
else
56+
echo "skip_tests=false" >> "$GITHUB_ENV"
57+
echo "::set-output name=skip_tests::false"
58+
fi

.github/workflows/java_pr.yml

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,18 @@ permissions:
1111
pull-requests: read
1212

1313
jobs:
14+
check_skip_tests:
15+
uses: ./.github/workflows/check_skip_tests.yml
16+
with:
17+
head-sha: ${{ github.event.pull_request.head.sha }}
18+
excluded-dirs: 'docs/**,tests/**,examples/**'
19+
1420
lint-java:
1521
# when using pull_request_target, all jobs MUST have this if check for 'ok-to-test' or 'approved' for security purposes.
1622
if:
1723
((github.event.action == 'labeled' && (github.event.label.name == 'approved' || github.event.label.name == 'lgtm' || github.event.label.name == 'ok-to-test')) ||
1824
(github.event.action != 'labeled' && (contains(github.event.pull_request.labels.*.name, 'ok-to-test') || contains(github.event.pull_request.labels.*.name, 'approved') || contains(github.event.pull_request.labels.*.name, 'lgtm')))) &&
19-
github.repository == 'feast-dev/feast'
25+
github.repository == 'feast-dev/feast' && needs.check_skip_tests.outputs.skip_tests == 'false'
2026
runs-on: ubuntu-latest
2127
steps:
2228
- uses: actions/checkout@v4
@@ -35,7 +41,7 @@ jobs:
3541
if:
3642
((github.event.action == 'labeled' && (github.event.label.name == 'approved' || github.event.label.name == 'lgtm' || github.event.label.name == 'ok-to-test')) ||
3743
(github.event.action != 'labeled' && (contains(github.event.pull_request.labels.*.name, 'ok-to-test') || contains(github.event.pull_request.labels.*.name, 'approved') || contains(github.event.pull_request.labels.*.name, 'lgtm')))) &&
38-
github.repository == 'feast-dev/feast'
44+
github.repository == 'feast-dev/feast' && needs.check_skip_tests.outputs.skip_tests == 'false'
3945
runs-on: ubuntu-latest
4046
needs: lint-java
4147
steps:
@@ -113,7 +119,7 @@ jobs:
113119
if:
114120
((github.event.action == 'labeled' && (github.event.label.name == 'approved' || github.event.label.name == 'lgtm' || github.event.label.name == 'ok-to-test')) ||
115121
(github.event.action != 'labeled' && (contains(github.event.pull_request.labels.*.name, 'ok-to-test') || contains(github.event.pull_request.labels.*.name, 'approved') || contains(github.event.pull_request.labels.*.name, 'lgtm')))) &&
116-
github.repository == 'feast-dev/feast'
122+
github.repository == 'feast-dev/feast' && needs.check_skip_tests.outputs.skip_tests == 'false'
117123
runs-on: ubuntu-latest
118124
needs: unit-test-java
119125
env:

.github/workflows/operator-e2e-integration-tests.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,18 @@ on:
1414
- 'infra/**'
1515

1616
jobs:
17+
check_skip_tests:
18+
uses: ./.github/workflows/check_skip_tests.yml
19+
with:
20+
head-sha: ${{ github.event.pull_request.head.sha }}
21+
excluded-dirs: 'docs/**,tests/**,examples/**'
22+
1723
operator-e2e-tests:
1824
timeout-minutes: 40
1925
if:
2026
((github.event.action == 'labeled' && (github.event.label.name == 'approved' || github.event.label.name == 'lgtm' || github.event.label.name == 'ok-to-test')) ||
2127
(github.event.action != 'labeled' && (contains(github.event.pull_request.labels.*.name, 'ok-to-test') || contains(github.event.pull_request.labels.*.name, 'approved') || contains(github.event.pull_request.labels.*.name, 'lgtm')))) &&
22-
github.repository == 'feast-dev/feast'
28+
github.repository == 'feast-dev/feast' && needs.check_skip_tests.outputs.skip_tests == 'false'
2329
runs-on: ubuntu-latest
2430

2531
services:

.github/workflows/operator_pr.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,14 @@ name: operator-pr
22

33
on: [pull_request]
44
jobs:
5+
check_skip_tests:
6+
uses: ./.github/workflows/check_skip_tests.yml
7+
with:
8+
head-sha: ${{ github.event.pull_request.head.sha }}
9+
excluded-dirs: 'docs/**,tests/**,examples/**'
10+
511
operator-test:
6-
if: ${{ !contains(github.event.pull_request.files, 'docs/') }} # Skip if docs files changed
12+
if: ${{ needs.check_skip_tests.outputs.skip_tests == 'false' }}
713
runs-on: ubuntu-latest
814
steps:
915
- uses: actions/checkout@v4

.github/workflows/pr_integration_tests.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,18 @@ permissions:
1616
pull-requests: read
1717

1818
jobs:
19+
check_skip_tests:
20+
uses: ./.github/workflows/check_skip_tests.yml
21+
with:
22+
head-sha: ${{ github.event.pull_request.head.sha }}
23+
excluded-dirs: 'docs/**,tests/**,examples/**'
24+
1925
integration-test-python:
2026
# when using pull_request_target, all jobs MUST have this if check for 'ok-to-test' or 'approved' for security purposes.
2127
if:
2228
((github.event.action == 'labeled' && (github.event.label.name == 'approved' || github.event.label.name == 'lgtm' || github.event.label.name == 'ok-to-test')) ||
2329
(github.event.action != 'labeled' && (contains(github.event.pull_request.labels.*.name, 'ok-to-test') || contains(github.event.pull_request.labels.*.name, 'approved') || contains(github.event.pull_request.labels.*.name, 'lgtm')))) &&
24-
github.repository == 'feast-dev/feast'
30+
github.repository == 'feast-dev/feast' && needs.check_skip_tests.outputs.skip_tests == 'false'
2531
runs-on: ${{ matrix.os }}
2632
strategy:
2733
fail-fast: false

.github/workflows/pr_local_integration_tests.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,17 @@ on:
99
- labeled
1010

1111
jobs:
12+
check_skip_tests:
13+
uses: ./.github/workflows/check_skip_tests.yml
14+
with:
15+
head-sha: ${{ github.event.pull_request.head.sha }}
16+
excluded-dirs: 'docs/**,tests/**,examples/**'
17+
1218
integration-test-python-local:
1319
if:
1420
((github.event.action == 'labeled' && (github.event.label.name == 'approved' || github.event.label.name == 'lgtm' || github.event.label.name == 'ok-to-test')) ||
1521
(github.event.action != 'labeled' && (contains(github.event.pull_request.labels.*.name, 'ok-to-test') || contains(github.event.pull_request.labels.*.name, 'approved') || contains(github.event.pull_request.labels.*.name, 'lgtm')))) &&
16-
github.event.pull_request.base.repo.full_name == 'feast-dev/feast'
22+
github.event.pull_request.base.repo.full_name == 'feast-dev/feast' && needs.check_skip_tests.outputs.skip_tests == 'false'
1723
runs-on: ${{ matrix.os }}
1824
strategy:
1925
fail-fast: false

.github/workflows/pr_remote_rbac_integration_tests.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,17 @@ on:
99
- labeled
1010

1111
jobs:
12+
check_skip_tests:
13+
uses: ./.github/workflows/check_skip_tests.yml
14+
with:
15+
head-sha: ${{ github.event.pull_request.head.sha }}
16+
excluded-dirs: 'docs/**,tests/**,examples/**'
17+
1218
remote-rbac-integration-tests-python:
1319
if:
1420
((github.event.action == 'labeled' && (github.event.label.name == 'approved' || github.event.label.name == 'lgtm' || github.event.label.name == 'ok-to-test')) ||
1521
(github.event.action != 'labeled' && (contains(github.event.pull_request.labels.*.name, 'ok-to-test') || contains(github.event.pull_request.labels.*.name, 'approved') || contains(github.event.pull_request.labels.*.name, 'lgtm')))) &&
16-
github.event.pull_request.base.repo.full_name == 'feast-dev/feast'
22+
github.event.pull_request.base.repo.full_name == 'feast-dev/feast' && needs.check_skip_tests.outputs.skip_tests == 'false'
1723
runs-on: ${{ matrix.os }}
1824
strategy:
1925
fail-fast: false

.github/workflows/smoke_tests.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,14 @@ on:
44
pull_request:
55

66
jobs:
7+
check_skip_tests:
8+
uses: ./.github/workflows/check_skip_tests.yml
9+
with:
10+
head-sha: ${{ github.event.pull_request.head.sha }}
11+
excluded-dirs: 'docs/**,tests/**,examples/**'
12+
713
unit-test-python:
8-
if: ${{ !contains(github.event.pull_request.files, 'docs/') }} # Skip if docs files changed
14+
if: ${{ needs.check_skip_tests.outputs.skip_tests == 'false' }}
915
runs-on: ${{ matrix.os }}
1016
strategy:
1117
fail-fast: false

.github/workflows/unit_tests.yml

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,20 @@ on:
44
pull_request:
55

66
jobs:
7+
check_skip_tests:
8+
runs-on: ubuntu-latest
9+
outputs:
10+
skip_tests: ${{ steps.check.outputs.skip_tests }}
11+
steps:
12+
- uses: actions/checkout@v4
13+
- id: check
14+
uses: ./.github/actions/check-skip-tests
15+
with:
16+
head-sha: ${{ github.event.pull_request.head.sha || github.sha }}
17+
718
unit-test-python:
8-
if: ${{ !contains(github.event.pull_request.files, 'docs/') }} # Skip if docs files changed
19+
needs: [check_skip_tests]
20+
if: ${{ needs.check_skip_tests.outputs.skip_tests == 'false' }}
921
runs-on: ${{ matrix.os }}
1022
strategy:
1123
fail-fast: false
@@ -43,6 +55,7 @@ jobs:
4355
run: uv cache prune --ci
4456

4557
unit-test-ui:
58+
if: ${{ needs.check_skip_tests.outputs.skip_tests == 'false' }}
4659
runs-on: ubuntu-latest
4760
env:
4861
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

0 commit comments

Comments
 (0)