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

Ref: Skip CI for commits without code changes #3545

Merged
merged 78 commits into from
Feb 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
78 commits
Select commit Hold shift + click to select a range
3fcadb9
skip ci for commits wihout code changes
lucas-zimerman Jan 23, 2024
16f50c0
Merge branch 'main' into ref/skip-ci
lucas-zimerman Jan 23, 2024
ecf0a1f
use yml
lucas-zimerman Jan 23, 2024
0c623ad
Merge branch 'ref/skip-ci' of https://github.com/getsentry/sentry-rea…
lucas-zimerman Jan 23, 2024
d431060
nit
lucas-zimerman Jan 23, 2024
f56ddbd
nit2
lucas-zimerman Jan 23, 2024
7d5d4a9
test
lucas-zimerman Jan 23, 2024
1229477
test
lucas-zimerman Jan 23, 2024
1278695
nit3
lucas-zimerman Jan 23, 2024
eac93d8
test
lucas-zimerman Jan 23, 2024
3cc85b6
test
lucas-zimerman Jan 23, 2024
c48b84c
test
lucas-zimerman Jan 23, 2024
f220350
fix logic
lucas-zimerman Jan 23, 2024
58f44c1
WIP
lucas-zimerman Jan 23, 2024
3a30ec8
WIP
lucas-zimerman Jan 23, 2024
d618a0f
github env shouldnt be part of the string
lucas-zimerman Jan 23, 2024
750a9f6
dont use deprecated way of sharing data accross jobs
lucas-zimerman Jan 23, 2024
0da5989
correct way of printing arrays
lucas-zimerman Jan 23, 2024
6dde26d
test
lucas-zimerman Jan 23, 2024
48983dc
test reusable workflow
lucas-zimerman Jan 23, 2024
9f9cc71
test
lucas-zimerman Jan 23, 2024
929398c
dont run skip-ci
lucas-zimerman Jan 23, 2024
456b008
dont run skip-ci
lucas-zimerman Jan 23, 2024
827723e
place skip-ci everywhere
lucas-zimerman Jan 23, 2024
05032e5
undo prettier and test ignore yml
lucas-zimerman Jan 23, 2024
1940567
ignore prettierignore
lucas-zimerman Jan 23, 2024
f7eb319
wrong array
lucas-zimerman Jan 23, 2024
732d8e2
test
lucas-zimerman Jan 23, 2024
5b7b569
test
lucas-zimerman Jan 23, 2024
d6883ad
nit
lucas-zimerman Jan 23, 2024
dfb7695
nit
lucas-zimerman Jan 23, 2024
c3e6c47
nit format
lucas-zimerman Jan 23, 2024
8e86fb8
zz
lucas-zimerman Jan 23, 2024
e4e75c4
find location of skip_ci parameter
lucas-zimerman Jan 23, 2024
1921730
test
lucas-zimerman Jan 23, 2024
56b41a4
using another style to define output
lucas-zimerman Jan 23, 2024
7cf37ec
prettier can wrongly format workflows
lucas-zimerman Jan 23, 2024
6240414
test
lucas-zimerman Jan 23, 2024
8b5b739
rollback prettier
lucas-zimerman Jan 23, 2024
553b0df
test
lucas-zimerman Jan 23, 2024
d32411b
test
lucas-zimerman Jan 23, 2024
d480551
map output
lucas-zimerman Jan 23, 2024
db8182a
TEST: alter changelog should not trigger any build
lucas-zimerman Jan 23, 2024
8904e8b
TEST: alter readme.md should not trigger the build (altered prettier …
lucas-zimerman Jan 23, 2024
7b1f5c4
TEST: alter LICENSE.md does not trigger build
lucas-zimerman Jan 23, 2024
35d59a8
TEST: alter codeowners doesnt trigger the build to run
lucas-zimerman Jan 23, 2024
5043e08
NIT: codeowners is CODEOWNSERS
lucas-zimerman Jan 23, 2024
09502eb
TEST: Alter code should trigger build and sample tests
lucas-zimerman Jan 23, 2024
472083f
Fail test: skip_ci shouldn't affect runs if fails
lucas-zimerman Jan 23, 2024
71de792
Test: failed check-ci should not block build
lucas-zimerman Jan 23, 2024
9b091e5
changelog.md is already ignored by *.md, removed .yml filter files f…
lucas-zimerman Jan 23, 2024
6733426
removed forced error on skip-ci for falidating the failure case of it
lucas-zimerman Jan 23, 2024
77b4f1c
use pathignore from github actions
lucas-zimerman Jan 31, 2024
e35b683
merge main
lucas-zimerman Jan 31, 2024
547ec76
break uses from build and target
lucas-zimerman Jan 31, 2024
1ea4a0c
test
lucas-zimerman Jan 31, 2024
3ebd843
test
lucas-zimerman Jan 31, 2024
2c3db40
test
lucas-zimerman Jan 31, 2024
de7ac62
test
lucas-zimerman Jan 31, 2024
98ed8e3
test sample
lucas-zimerman Jan 31, 2024
b5288b7
more test
lucas-zimerman Jan 31, 2024
ab3c827
fix missing paths ignore
lucas-zimerman Jan 31, 2024
5724b18
mock skip-ci
lucas-zimerman Jan 31, 2024
7ce8d04
removed skip ci
lucas-zimerman Jan 31, 2024
3fb0420
remove test for altered yml
lucas-zimerman Jan 31, 2024
92a61d1
Update .github/workflows/buildandtest.yml
krystofwoldrich Feb 1, 2024
68545d0
Merge remote-tracking branch 'origin/main' into ref/skip-ci
krystofwoldrich Feb 14, 2024
a205cc9
run required jobs
krystofwoldrich Feb 14, 2024
82ed8eb
test required jobs always run
krystofwoldrich Feb 14, 2024
f30fb05
Revert "test required jobs always run"
krystofwoldrich Feb 14, 2024
89bb880
Revert "run required jobs"
krystofwoldrich Feb 14, 2024
91efb57
Revert "Revert "test required jobs always run""
krystofwoldrich Feb 14, 2024
7eebc49
Revert "Revert "Revert "test required jobs always run"""
krystofwoldrich Feb 14, 2024
3c84224
Revert "use pathignore from github actions"
krystofwoldrich Feb 14, 2024
912e8e9
add yml to test
krystofwoldrich Feb 14, 2024
bf4a3bf
remove the sdk test comment
krystofwoldrich Feb 14, 2024
d72fb7a
add missing lint job to skip
krystofwoldrich Feb 14, 2024
39af77d
Revert "add yml to test"
krystofwoldrich Feb 14, 2024
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
22 changes: 19 additions & 3 deletions .github/workflows/buildandtest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,14 @@ on:
pull_request:

jobs:
diff_check:
uses: ./.github/workflows/skip-ci.yml

job_test:
name: Test
runs-on: ubuntu-latest
needs: [diff_check]
if: ${{ needs.diff_check.outputs.skip_ci != 'true' }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
Expand All @@ -30,6 +35,8 @@ jobs:
job_lint:
name: Lint
runs-on: ubuntu-latest
needs: [diff_check]
if: ${{ needs.diff_check.outputs.skip_ci != 'true' }}
steps:
- uses: actions/checkout@v4
- uses: actions/cache@v3
Expand All @@ -46,6 +53,8 @@ jobs:
job_lint_sample_new_arch:
name: Lint Sample
runs-on: ubuntu-latest
needs: [diff_check]
if: ${{ needs.diff_check.outputs.skip_ci != 'true' }}
steps:
- uses: actions/checkout@v4
- uses: actions/cache@v3
Expand All @@ -64,6 +73,8 @@ jobs:
job_check_integrity:
name: Check package integrity
runs-on: ubuntu-latest
needs: [diff_check]
if: ${{ needs.diff_check.outputs.skip_ci != 'true' }}
steps:
- uses: actions/checkout@v4
- uses: actions/cache@v3
Expand All @@ -82,6 +93,8 @@ jobs:
job_build:
name: Build
runs-on: ubuntu-latest
needs: [diff_check]
if: ${{ needs.diff_check.outputs.skip_ci != 'true' }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
Expand Down Expand Up @@ -124,7 +137,8 @@ jobs:
job_type_check:
name: Type Check Typescript 3.8
runs-on: ubuntu-latest
needs: [job_build]
needs: [job_build, diff_check]
if: ${{ needs.diff_check.outputs.skip_ci != 'true' }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
Expand Down Expand Up @@ -163,7 +177,8 @@ jobs:
job_circular_dep_check:
name: Circular Dependency Check
runs-on: ubuntu-latest
needs: [job_build]
needs: [job_build, diff_check]
if: ${{ needs.diff_check.outputs.skip_ci != 'true' }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
Expand Down Expand Up @@ -194,7 +209,8 @@ jobs:
job_bundle:
name: Bundle
runs-on: ubuntu-latest
needs: [job_test, job_build]
needs: [job_test, job_build, diff_check]
if: ${{ needs.diff_check.outputs.skip_ci != 'true' }}
strategy:
# we want that the matrix keeps running, default is to cancel them if it fails.
fail-fast: false
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/codegen.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,13 @@ on:
pull_request:

jobs:
diff_check:
uses: ./.github/workflows/skip-ci.yml

codegen:
runs-on: ubuntu-latest
needs: [diff_check]
if: ${{ needs.diff_check.outputs.skip_ci != 'true' }}
strategy:
matrix:
platform: ["android", "ios"]
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,14 @@ on:
- cron: '27 16 * * 5'

jobs:
diff_check:
uses: ./.github/workflows/skip-ci.yml

analyze:
name: Analyze
runs-on: ubuntu-latest
needs: [diff_check]
if: ${{ needs.diff_check.outputs.skip_ci != 'true' }}

strategy:
fail-fast: false
Expand Down
17 changes: 15 additions & 2 deletions .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,13 @@ env:
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}

jobs:
diff_check:
uses: ./.github/workflows/skip-ci.yml

cancel-previous-workflow:
runs-on: ubuntu-latest
needs: [diff_check]
if: ${{ needs.diff_check.outputs.skip_ci != 'true' }}
steps:
- name: Cancel Previous Runs
uses: styfle/cancel-workflow-action@01ce38bf961b4e243a6342cbade0dbc8ba3f0432 # pin@0.12.0
Expand All @@ -23,6 +28,8 @@ jobs:

metrics:
runs-on: ${{ matrix.runs-on }}
needs: [diff_check]
if: ${{ needs.diff_check.outputs.skip_ci != 'true' }}
strategy:
# we want that the matrix keeps running, default is to cancel them if it fails.
fail-fast: false
Expand Down Expand Up @@ -146,6 +153,8 @@ jobs:
react-native-build:
name: Build RN ${{ matrix.rn-version }} ${{ matrix.rn-architecture }} ${{ matrix.engine }} ${{ matrix.platform }} ${{ matrix.build-type }} ${{ matrix.ios-use-frameworks }}
runs-on: ${{ matrix.runs-on }}
needs: [diff_check]
if: ${{ needs.diff_check.outputs.skip_ci != 'true' }}
env:
RN_SENTRY_POD_NAME: RNSentry
RN_DIFF_REPOSITORY: https://github.com/react-native-community/rn-diff-purge.git
Expand Down Expand Up @@ -410,8 +419,12 @@ jobs:
path: test/react-native/versions/${{ matrix.rn-version }}/RnDiffApp/ios/*.log

react-native-test:
name: Test RN ${{ matrix.rn-version }} ${{ matrix.rn-architecture }} ${{ matrix.engine }} ${{ matrix.platform }} ${{ matrix.build-type }} ${{ matrix.ios-use-frameworks }}
needs: react-native-build
name:
Test RN ${{ matrix.rn-version }} ${{ matrix.rn-architecture }} ${{ matrix.engine }} ${{ matrix.platform }} ${{
matrix.build-type }} ${{ matrix.ios-use-frameworks }}
needs: [react-native-build, diff_check]
if: ${{ needs.diff_check.outputs.skip_ci != 'true' }}

runs-on: ${{ matrix.runs-on }}
strategy:
fail-fast: false # keeps matrix running if one fails
Expand Down
9 changes: 9 additions & 0 deletions .github/workflows/native-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,13 @@ on:
pull_request:

jobs:
diff_check:
uses: ./.github/workflows/skip-ci.yml

cancel-previous-workflow:
runs-on: ubuntu-latest
needs: [diff_check]
if: ${{ needs.diff_check.outputs.skip_ci != 'true' }}
steps:
- name: Cancel Previous Runs
uses: styfle/cancel-workflow-action@01ce38bf961b4e243a6342cbade0dbc8ba3f0432 # pin@0.12.0
Expand All @@ -17,6 +22,8 @@ jobs:
test-ios:
name: ios
runs-on: macos-latest
needs: [diff_check]
if: ${{ needs.diff_check.outputs.skip_ci != 'true' }}
steps:
- uses: actions/checkout@v4

Expand Down Expand Up @@ -51,6 +58,8 @@ jobs:
test-android:
name: android
runs-on: ubuntu-latest
needs: [diff_check]
if: ${{ needs.diff_check.outputs.skip_ci != 'true' }}
steps:
- uses: actions/checkout@v4

Expand Down
7 changes: 7 additions & 0 deletions .github/workflows/sample-application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,13 @@ env:
RN_SENTRY_POD_NAME: RNSentry

jobs:
diff_check:
uses: ./.github/workflows/skip-ci.yml

cancel-previous-workflow:
runs-on: ubuntu-latest
needs: [diff_check]
if: ${{ needs.diff_check.outputs.skip_ci != 'true' }}
steps:
- name: Cancel Previous Runs
uses: styfle/cancel-workflow-action@01ce38bf961b4e243a6342cbade0dbc8ba3f0432 # pin@0.12.0
Expand All @@ -25,6 +30,8 @@ jobs:
build:
name: Build ${{ matrix.rn-architecture }} ${{ matrix.platform }} ${{ matrix.build-type }}
runs-on: ${{ matrix.runs-on }}
needs: [diff_check]
if: ${{ needs.diff_check.outputs.skip_ci != 'true' }}
strategy:
# we want that the matrix keeps running, default is to cancel them if it fails.
fail-fast: false
Expand Down
36 changes: 36 additions & 0 deletions .github/workflows/skip-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Skip CI
on:
workflow_call:
outputs:
skip_ci:
description: "Value yes if the current PR only contains changes to files not related to code, otherwise, not defined."
value: ${{ jobs.diff_check.outputs.skip_ci }}

jobs:
diff_check:
runs-on: ubuntu-latest
continue-on-error: true
outputs:
skip_ci:
${{ steps.check_diff.outputs.skip_ci }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Check diff from Pull Request
id: check_diff
run: |
skipList=(".github/CODEOWNERS" ".prettierignore")
# Ignores changelog.md, readme.md,...
fileChangesArray=($(git diff --name-only origin/${{ github.base_ref }}..origin/${{ github.head_ref }} | grep -v '\.md$'))
lucas-zimerman marked this conversation as resolved.
Show resolved Hide resolved
printf '%s\n' "${fileChangesArray[@]}"
for item in "${fileChangesArray[@]}"
do
if [[ ! " ${skipList[@]} " =~ " ${item} " ]]; then
#found an item that doesn't belong to the skip list.
exit 0
fi
done
echo "skip_ci=true" >> $GITHUB_OUTPUT
echo "no source code files commited, skipping CI."
4 changes: 2 additions & 2 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
/test/react-native/versions
CHANGELOG.md

.github/workflows/*.yml
*.md
Loading