Browse Source

Revert "feat(ci): Support skipping of jobs (#33541)" (#33690)

This reverts commit 12497475ef0ad0717423efce5d86f2f3292054f2.
Armen Zambrano G 2 years ago
parent
commit
6b56665137
3 changed files with 43 additions and 23 deletions
  1. 0 4
      .github/workflows/acceptance.yml
  2. 27 12
      .github/workflows/backend.yml
  3. 16 7
      .github/workflows/frontend.yml

+ 0 - 4
.github/workflows/acceptance.yml

@@ -33,7 +33,6 @@ jobs:
           filters: .github/file-filters.yml
 
   frontend:
-    if: ${{ needs.files-changed.outputs.acceptance == 'true' }}
     needs: files-changed
     name: frontend tests
     runs-on: ubuntu-20.04
@@ -113,7 +112,6 @@ jobs:
           type: frontend
 
   webpack:
-    if: ${{ needs.files-changed.outputs.acceptance == 'true' }}
     needs: files-changed
     name: create frontend bundle
     runs-on: ubuntu-20.04
@@ -172,7 +170,6 @@ jobs:
           path: dist.tar.gz
 
   acceptance:
-    if: ${{ needs.files-changed.outputs.acceptance == 'true' }}
     needs: files-changed
     name: acceptance
     runs-on: ubuntu-20.04
@@ -243,7 +240,6 @@ jobs:
         if: ${{ needs.files-changed.outputs.backend == 'true' }}
 
   chartcuterie:
-    if: ${{ needs.files-changed.outputs.acceptance == 'true' }}
     needs: files-changed
     name: chartcuterie integration
     runs-on: ubuntu-20.04

+ 27 - 12
.github/workflows/backend.yml

@@ -29,7 +29,6 @@ jobs:
           filters: .github/file-filters.yml
 
   api-docs:
-    if: needs.files-changed.outputs.api_docs == 'true'
     needs: files-changed
     name: api docs test
     runs-on: ubuntu-20.04
@@ -40,16 +39,19 @@ jobs:
       - uses: actions/checkout@v2
 
       - uses: volta-cli/action@v1
+        if: needs.files-changed.outputs.api_docs == 'true'
 
       - name: Setup sentry python env (python ${{ matrix.python-version }})
         uses: ./.github/actions/setup-sentry
         id: setup
+        if: needs.files-changed.outputs.api_docs == 'true'
         with:
           python-version: ${{ matrix.python-version }}
           pip-cache-version: ${{ secrets.PIP_CACHE_VERSION }}
           snuba: true
 
       - name: Run API docs tests
+        if: needs.files-changed.outputs.api_docs == 'true'
         # install ts-node for ts build scripts to execute properly without potentially installing
         # conflicting deps when running scripts locally
         # see: https://github.com/getsentry/sentry/pull/32328/files
@@ -57,7 +59,6 @@ jobs:
           yarn add ts-node && make test-api-docs
 
   backend-test:
-    if: needs.files-changed.outputs.backend == 'true'
     needs: files-changed
     name: backend test
     runs-on: ubuntu-20.04
@@ -86,6 +87,7 @@ jobs:
 
       - name: Setup sentry env (python ${{ matrix.python-version }})
         uses: ./.github/actions/setup-sentry
+        if: needs.files-changed.outputs.backend == 'true'
         id: setup
         with:
           python-version: ${{ matrix.python-version }}
@@ -94,6 +96,7 @@ jobs:
           pg-version: ${{ matrix.pg-version }}
 
       - name: Run backend test (${{ steps.setup.outputs.matrix-instance-number }} of ${{ steps.setup.outputs.matrix-instance-total }})
+        if: needs.files-changed.outputs.backend == 'true'
         run: |
           # Note: `USE_SNUBA` is not used for backend tests because there are a few failing tests with Snuba enabled.
           unset USE_SNUBA
@@ -103,7 +106,6 @@ jobs:
         uses: ./.github/actions/artifacts
 
   cli:
-    if: needs.files-changed.outputs.backend == 'true'
     needs: files-changed
     name: cli test
     runs-on: ubuntu-20.04
@@ -118,12 +120,14 @@ jobs:
       - name: Setup sentry env (python ${{ matrix.python-version }})
         uses: ./.github/actions/setup-sentry
         id: setup
+        if: needs.files-changed.outputs.backend == 'true'
         with:
           python-version: ${{ matrix.python-version }}
           pip-cache-version: ${{ secrets.PIP_CACHE_VERSION }}
           pg-version: ${{ matrix.pg-version }}
 
       - name: Run test
+        if: needs.files-changed.outputs.backend == 'true'
         run: |
           make test-cli
 
@@ -131,7 +135,6 @@ jobs:
         uses: ./.github/actions/artifacts
 
   lint:
-    if: needs.files-changed.outputs.backend == 'true'
     needs: files-changed
     name: backend lint
     runs-on: ubuntu-20.04
@@ -152,12 +155,14 @@ jobs:
 
       - name: Setup Python ${{ matrix.python-version }}
         uses: ./.github/actions/setup-python
+        if: needs.files-changed.outputs.backend == 'true'
         with:
           python-version: ${{ matrix.python-version }}
           # Note this uses a different cache key than other backend-based workflows because this workflows dependencies are different
           cache-files-hash: ${{ hashFiles('requirements-pre-commit.txt') }}
 
       - name: Setup pre-commit
+        if: needs.files-changed.outputs.backend == 'true'
         env:
           SENTRY_NO_VIRTUALENV_CREATION: 1
         run: |
@@ -180,6 +185,7 @@ jobs:
               - added|modified: 'requirements-base.txt'
 
       - name: Run pre-commit on changed files
+        if: needs.files-changed.outputs.backend == 'true'
         run: |
           # Run pre-commit to lint and format check files that were changed (but not deleted) compared to master.
           # XXX: there is a very small chance that it'll expand to exceed Linux's limits
@@ -188,7 +194,7 @@ jobs:
 
       # If working tree is dirty, commit and update if we have a token
       - name: Apply any pre-commit fixed files
-        if: steps.token.outcome == 'success' && github.ref != 'refs/heads/master' && always()
+        if: steps.token.outcome == 'success' && github.ref != 'refs/heads/master' && needs.files-changed.outputs.backend == 'true' && always()
         uses: getsentry/action-github-commit@main
         with:
           github-token: ${{ steps.token.outputs.token }}
@@ -197,7 +203,6 @@ jobs:
         uses: ./.github/actions/artifacts
 
   migration:
-    if: needs.files-changed.outputs.migration_lockfile == 'true'
     needs: files-changed
     name: check migration
     runs-on: ubuntu-20.04
@@ -209,9 +214,11 @@ jobs:
     steps:
       - name: Checkout sentry
         uses: actions/checkout@v2
+        if: needs.files-changed.outputs.migration_lockfile == 'true'
 
       - name: Setup sentry env (python ${{ matrix.python-version }})
         uses: ./.github/actions/setup-sentry
+        if: needs.files-changed.outputs.migration_lockfile == 'true'
         id: setup
         with:
           python-version: ${{ matrix.python-version }}
@@ -219,6 +226,7 @@ jobs:
           pg-version: ${{ matrix.pg-version }}
 
       - name: Migration & lockfile checks
+        if: needs.files-changed.outputs.migration_lockfile == 'true'
         env:
           SENTRY_LOG_LEVEL: ERROR
           PGPASSWORD: postgres
@@ -226,7 +234,6 @@ jobs:
           ./.github/workflows/scripts/migration-check.sh
 
   plugins:
-    if: needs.files-changed.outputs.plugins == 'true'
     needs: files-changed
     name: plugins test
     runs-on: ubuntu-20.04
@@ -240,17 +247,18 @@ jobs:
       - name: Setup sentry env (python ${{ matrix.python-version }})
         uses: ./.github/actions/setup-sentry
         id: setup
+        if: needs.files-changed.outputs.plugins == 'true'
         with:
           python-version: ${{ matrix.python-version }}
           pip-cache-version: ${{ secrets.PIP_CACHE_VERSION }}
           snuba: true
 
       - name: Run test
+        if: needs.files-changed.outputs.plugins == 'true'
         run: |
           make test-plugins
 
   relay:
-    if: needs.files-changed.outputs.backend == 'true'
     needs: files-changed
     name: relay test
     runs-on: ubuntu-20.04
@@ -268,6 +276,7 @@ jobs:
       - name: Setup sentry env (python ${{ matrix.python-version }})
         uses: ./.github/actions/setup-sentry
         id: setup
+        if: needs.files-changed.outputs.backend == 'true'
         with:
           python-version: ${{ matrix.python-version }}
           pip-cache-version: ${{ secrets.PIP_CACHE_VERSION }}
@@ -275,12 +284,14 @@ jobs:
           kafka: true
 
       - name: Pull relay image
+        if: needs.files-changed.outputs.backend == 'true'
         run: |
           # pull relay we'll run and kill it for each test
           docker pull us.gcr.io/sentryio/relay:nightly
           docker ps -a
 
       - name: Run test
+        if: needs.files-changed.outputs.backend == 'true'
         run: |
           make test-relay-integration
 
@@ -288,7 +299,6 @@ jobs:
         uses: ./.github/actions/artifacts
 
   snuba:
-    if: needs.files-changed.outputs.backend == 'true'
     needs: files-changed
     name: snuba test
     runs-on: ubuntu-20.04
@@ -316,6 +326,7 @@ jobs:
 
       - name: Setup sentry env (python ${{ matrix.python-version }})
         uses: ./.github/actions/setup-sentry
+        if: needs.files-changed.outputs.backend == 'true'
         id: setup
         with:
           python-version: ${{ matrix.python-version }}
@@ -324,6 +335,7 @@ jobs:
           kafka: true
 
       - name: Run snuba test (${{ steps.setup.outputs.matrix-instance-number }} of ${{ steps.setup.outputs.matrix-instance-total }})
+        if: needs.files-changed.outputs.backend == 'true'
         run: |
           make test-snuba
 
@@ -331,7 +343,6 @@ jobs:
         uses: ./.github/actions/artifacts
 
   symbolicator:
-    if: needs.files-changed.outputs.backend == 'true'
     needs: files-changed
     name: symbolicator test
     runs-on: ubuntu-20.04
@@ -349,6 +360,7 @@ jobs:
       - name: Setup sentry env (python ${{ matrix.python-version }})
         uses: ./.github/actions/setup-sentry
         id: setup
+        if: needs.files-changed.outputs.backend == 'true'
         with:
           python-version: ${{ matrix.python-version }}
           pip-cache-version: ${{ secrets.PIP_CACHE_VERSION }}
@@ -356,6 +368,7 @@ jobs:
           kafka: true
 
       - name: Start symbolicator
+        if: needs.files-changed.outputs.backend == 'true'
         run: |
           echo $PWD
           docker run \
@@ -368,6 +381,7 @@ jobs:
           docker ps -a
 
       - name: Run test
+        if: needs.files-changed.outputs.backend == 'true'
         run: |
           make test-symbolicator
 
@@ -375,7 +389,6 @@ jobs:
         uses: ./.github/actions/artifacts
 
   typing:
-    if: needs.files-changed.outputs.backend == 'true'
     needs: files-changed
     name: backend typing
     runs-on: ubuntu-20.04
@@ -388,11 +401,13 @@ jobs:
 
       - name: Setup Python ${{ matrix.python-version }}
         uses: ./.github/actions/setup-python
+        if: needs.files-changed.outputs.backend == 'true'
         with:
           python-version: ${{ matrix.python-version }}
 
       # Since we don't call the setup-sentry action we need to install libxmlsec1-dev
       - name: Setup backend typing
+        if: needs.files-changed.outputs.backend == 'true'
         env:
           SENTRY_LIGHT_BUILD: 1
         run: |
@@ -403,6 +418,7 @@ jobs:
           pip install -U -e ".[dev]"
 
       - name: Run backend typing (${{ steps.setup.outputs.matrix-instance-number }} of ${{ strategy.job-total }})
+        if: needs.files-changed.outputs.backend == 'true'
         run: |
           make backend-typing
 
@@ -423,7 +439,6 @@ jobs:
         symbolicator,
         typing,
       ]
-    if: ${{ needs.files-changed.outputs.backend == 'true' }}
     name: Backend
     runs-on: ubuntu-20.04
     steps:

+ 16 - 7
.github/workflows/frontend.yml

@@ -28,7 +28,6 @@ jobs:
           filters: .github/file-filters.yml
 
   typescript-and-lint:
-    if: needs.files-changed.outputs.frontend == 'true'
     needs: files-changed
     name: typescript and lint
     runs-on: ubuntu-20.04
@@ -52,23 +51,28 @@ jobs:
           filters: .github/file-filters.yml
 
       - uses: volta-cli/action@v1
+        if: needs.files-changed.outputs.frontend == 'true'
 
       # See https://github.com/actions/cache/blob/master/examples.md#node---yarn for example
       - name: Get yarn cache directory path
         id: yarn-cache-dir-path
+        if: needs.files-changed.outputs.frontend == 'true'
         run: echo "::set-output name=dir::$(yarn cache dir)"
 
       - uses: actions/cache@v1 # We are explicitly using v1 due to perf reasons
+        if: needs.files-changed.outputs.frontend == 'true'
         with:
           path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
           key: ${{ runner.os }}-v2-yarn-${{ hashFiles('yarn.lock', 'api-docs/yarn.lock') }}
 
       - name: Install dependencies
         id: dependencies
+        if: needs.files-changed.outputs.frontend == 'true'
         run: yarn install --frozen-lockfile
 
       # Setup custom tsc matcher, see https://github.com/actions/setup-node/issues/97
       - name: setup matchers
+        if: needs.files-changed.outputs.frontend == 'true'
         run: |
           echo "::remove-matcher owner=masters::"
           echo "::add-matcher::.github/tsc.json"
@@ -76,7 +80,7 @@ jobs:
 
       - name: eslint logic
         id: eslint
-        if: (github.ref == 'refs/heads/master' || needs.files-changed.outputs.eslint_config == 'true' || needs.files-changed.outputs.yarn_lockfile == 'true')
+        if: needs.files-changed.outputs.frontend == 'true' && (github.ref == 'refs/heads/master' || needs.files-changed.outputs.eslint_config == 'true' || needs.files-changed.outputs.yarn_lockfile == 'true')
         run: echo "::set-output name=all-files::true"
 
       # Lint entire frontend if:
@@ -95,7 +99,7 @@ jobs:
       # Otherwise... only lint modified files
       # Note `eslint --fix` will not fail when it auto fixes files
       - name: eslint (changed files only)
-        if: steps.eslint.outputs.all-files != 'true'
+        if: needs.files-changed.outputs.frontend == 'true' && steps.eslint.outputs.all-files != 'true'
         run: |
           yarn eslint --fix ${{ needs.files-changed.outputs.frontend_modified_lintable_files }}
 
@@ -108,13 +112,13 @@ jobs:
       # Reason being we need a different token to auto commit changes and
       # forks do not have access to said token
       - name: Check for dirty git working tree (forks)
-        if: steps.token.outcome != 'success' && github.ref != 'refs/heads/master'
+        if: steps.token.outcome != 'success' && github.ref != 'refs/heads/master' && needs.files-changed.outputs.frontend == 'true'
         run: |
           git diff --quiet || (echo '::error ::lint produced file changes, run linter locally and try again' && exit 1)
 
       # If working tree is dirty, commit and update if we have a token
       - name: Commit any eslint fixed files
-        if: steps.token.outcome == 'success' && github.ref != 'refs/heads/master'
+        if: steps.token.outcome == 'success' && github.ref != 'refs/heads/master' && needs.files-changed.outputs.frontend == 'true'
         uses: getsentry/action-github-commit@main
         with:
           github-token: ${{ steps.token.outputs.token }}
@@ -135,35 +139,40 @@ jobs:
         run: yarn run ts-node .github/workflows/scripts/monitor-typescript.ts
 
       - name: storybook
-        if: github.ref != 'refs/heads/master'
+        if: github.ref != 'refs/heads/master' && needs.files-changed.outputs.frontend == 'true'
         env:
           STORYBOOK_BUILD: 1
         run: |
           yarn storybook-build
 
   webpack:
-    if: github.ref == 'refs/heads/master' || needs.files-changed.outputs.frontend == 'true'
+    if: needs.files-changed.outputs.frontend != 'true'
     needs: files-changed
     runs-on: ubuntu-20.04
     steps:
       - uses: actions/checkout@v2
 
       - uses: volta-cli/action@v1
+        if: github.ref == 'refs/heads/master' || needs.files-changed.outputs.frontend == 'true'
 
       # See https://github.com/actions/cache/blob/master/examples.md#node---yarn for example
       - name: Get yarn cache directory path
         id: yarn-cache-dir-path
+        if: github.ref == 'refs/heads/master' || needs.files-changed.outputs.frontend == 'true'
         run: echo "::set-output name=dir::$(yarn cache dir)"
 
       - uses: actions/cache@v1 # We are explicitly using v1 due to perf reasons
+        if: github.ref == 'refs/heads/master' || needs.files-changed.outputs.frontend == 'true'
         with:
           path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
           key: ${{ runner.os }}-v2-yarn-${{ hashFiles('yarn.lock', 'api-docs/yarn.lock') }}
 
       - name: Install dependencies
+        if: github.ref == 'refs/heads/master' || needs.files-changed.outputs.frontend == 'true'
         run: yarn install --frozen-lockfile
 
       - uses: getsentry/size-limit-action@v4
+        if: github.ref == 'refs/heads/master' || needs.files-changed.outputs.frontend == 'true'
         env:
           SENTRY_INSTRUMENTATION: 1
           SENTRY_WEBPACK_WEBHOOK_SECRET: ${{ secrets.SENTRY_WEBPACK_WEBHOOK_SECRET }}