Skip to content

Commit

Permalink
use pathignore from github actions
Browse files Browse the repository at this point in the history
  • Loading branch information
lucas-zimerman committed Jan 31, 2024
1 parent 6733426 commit 77b4f1c
Show file tree
Hide file tree
Showing 8 changed files with 24 additions and 77 deletions.
20 changes: 3 additions & 17 deletions .github/workflows/buildandtest.yml
Expand Up @@ -5,17 +5,14 @@ on:
branches:
- main
- release/**
uses: ./.github/workflows/skip-ci.yml
pull_request:

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

jobs:
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 Down Expand Up @@ -53,8 +50,6 @@ 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 @@ -73,8 +68,6 @@ 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 @@ -93,8 +86,6 @@ 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 @@ -137,8 +128,6 @@ jobs:
job_type_check:
name: Type Check Typescript 3.8
runs-on: ubuntu-latest
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 @@ -177,8 +166,6 @@ jobs:
job_circular_dep_check:
name: Circular Dependency Check
runs-on: ubuntu-latest
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 @@ -209,8 +196,7 @@ jobs:
job_bundle:
name: Bundle
runs-on: ubuntu-latest
needs: [job_test, job_build, diff_check]
if: ${{ needs.diff_check.outputs.skip_ci != 'true' }}
needs: [job_test, job_build]
strategy:
# we want that the matrix keeps running, default is to cancel them if it fails.
fail-fast: false
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/codegen.yml
Expand Up @@ -5,16 +5,16 @@ on:
branches:
- main
- release/**
uses: ./.github/workflows/skip-ci.yml
pull_request:
uses: ./.github/workflows/skip-ci.yml

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

codegen:
runs-on: ubuntu-latest
needs: [check-ci]
if: ${{ needs.check-ci.outputs.skip_ci != 'true' }}
strategy:
matrix:
platform: ['android', 'ios']
Expand Down
8 changes: 2 additions & 6 deletions .github/workflows/codeql-analysis.yml
Expand Up @@ -14,22 +14,18 @@ name: 'CodeQL'
on:
push:
branches: [main]
uses: ./.github/workflows/skip-ci.yml
pull_request:
# The branches below must be a subset of the branches above
branches: [main]
uses: ./.github/workflows/skip-ci.yml
schedule:
- cron: '27 16 * * 5'

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

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

strategy:
fail-fast: false
matrix:
Expand Down
11 changes: 3 additions & 8 deletions .github/workflows/e2e.yml
Expand Up @@ -3,7 +3,9 @@ name: End-to-End Tests
on:
push:
branches: [main]
uses: ./.github/workflows/skip-ci.yml
pull_request:
uses: ./.github/workflows/skip-ci.yml

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
Expand All @@ -18,8 +20,6 @@ jobs:

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

metrics:
runs-on: ${{ matrix.runs-on }}
needs: [check-ci]
if: ${{ needs.check-ci.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 @@ -158,8 +156,6 @@ jobs:
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: [check-ci]
if: ${{ needs.check-ci.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 @@ -423,8 +419,7 @@ jobs:
name:
Test RN ${{ matrix.rn-version }} ${{ matrix.rn-architecture }} ${{ matrix.engine }} ${{ matrix.platform }} ${{
matrix.build-type }} ${{ matrix.ios-use-frameworks }}
needs: [react-native-build, check-ci]
if: ${{ needs.check-ci.outputs.skip_ci != 'true' }}
needs: [react-native-build]

runs-on: ${{ matrix.runs-on }}
strategy:
Expand Down
8 changes: 2 additions & 6 deletions .github/workflows/native-tests.yml
Expand Up @@ -3,16 +3,16 @@ name: Native Tests
on:
push:
branches: [main]
uses: ./.github/workflows/skip-ci.yml
pull_request:
uses: ./.github/workflows/skip-ci.yml

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

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

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

Expand Down
6 changes: 2 additions & 4 deletions .github/workflows/sample-application.yml
Expand Up @@ -3,7 +3,9 @@ name: Sample Application
on:
push:
branches: [main]
uses: ./.github/workflows/skip-ci.yml
pull_request:
uses: ./.github/workflows/skip-ci.yml

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
Expand All @@ -19,8 +21,6 @@ jobs:

cancel-previous-workflow:
runs-on: ubuntu-latest
needs: [check-ci]
if: ${{ needs.check-ci.outputs.skip_ci != 'true' }}
steps:
- name: Cancel Previous Runs
uses: styfle/cancel-workflow-action@01ce38bf961b4e243a6342cbade0dbc8ba3f0432 # pin@0.12.0
Expand All @@ -30,8 +30,6 @@ jobs:
build:
name: Build ${{ matrix.rn-architecture }} ${{ matrix.platform }} ${{ matrix.build-type }}
runs-on: ${{ matrix.runs-on }}
needs: [check-ci]
if: ${{ needs.check-ci.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
43 changes: 10 additions & 33 deletions .github/workflows/skip-ci.yml
@@ -1,36 +1,13 @@
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.check-ci.outputs.skip_ci }}
push:
paths-ignore:
- '.prettierignore'
- 'CHANGELOG.md'
- 'README.md'
- '.github/CODEOWNERS'
- '.github/pull_request_template.md'
- '.github/ISSUE_TEMPLATE/BUG_REPORT.md'
- '.github/ISSUE_TEMPLATE/FEATURE_REQUEST.md'
- '.github/workflows/*.yml' #for testing

jobs:
check-ci:
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$'))
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."
1 change: 0 additions & 1 deletion src/js/sdk.tsx
@@ -1,4 +1,3 @@
// TEST
/* eslint-disable complexity */
import type { Scope } from '@sentry/core';
import { getIntegrationsToSetup, Hub, initAndBind, makeMain, setExtra } from '@sentry/core';
Expand Down

0 comments on commit 77b4f1c

Please sign in to comment.