feat(j-s): add other traffic offense as an option #73973
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Monorepo pipeline - pull request | |
on: | |
pull_request: {} | |
workflow_dispatch: {} | |
defaults: | |
run: | |
shell: bash | |
concurrency: | |
# See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#example-using-a-fallback-value | |
group: pullrequest-${{ github.head_ref || github.run_id }} | |
cancel-in-progress: true | |
env: | |
COMPOSE_HTTP_TIMEOUT: 180 | |
SKIP_GENERATED_CACHE: ${{ contains(github.event.pull_request.labels.*.name, 'skip-generated-cache') }} | |
NX_AFFECTED_ALL: ${{ contains(github.event.pull_request.labels.*.name, 'nx-affected-all') }} | |
DISABLE_CHUNKS: 'true' | |
DISABLE_GROUPING: 'false' | |
DISABLE_PROBLEMATIC: 'false' | |
CHUNK_SIZE: '8' | |
MAX_JOBS: '3' | |
NX_PARALLEL: '2' | |
NX_MAX_PARALLEL: '4' | |
NX_TASKS_RUNNER: ci | |
NX_CLOUD_ACCESS_TOKEN: ${{ secrets.NX_CLOUD_ACCESS_TOKEN }} | |
S3_DOCKER_CACHE_BUCKET: ${{ secrets.S3_DOCKER_CACHE_BUCKET }} | |
RUNS_ON_S3_BUCKET_CACHE: ${{ secrets.S3_DOCKER_CACHE_BUCKET }} | |
AWS_REGION: eu-west-1 | |
GENERATED_FILES: ${{ github.workspace }}/${{ github.sha }}.tar.gz | |
AFFECTED_ALL: ${{ secrets.AFFECTED_ALL }} | |
SERVERSIDE_FEATURES_ON: '' | |
DOCKER_REGISTRY: 821090935708.dkr.ecr.eu-west-1.amazonaws.com | |
DOCKER_BASE_IMAGE_REGISTRY: 821090935708.dkr.ecr.eu-west-1.amazonaws.com/ecr-public | |
CI_DEBUG: ${{ contains(github.event.pull_request.labels.*.name, 'ci debug') }} | |
SKIP_TESTS: ${{ contains(github.event.pull_request.labels.*.name, 'test nothing') }} | |
DEPLOY_FEATURE: ${{ contains(github.event.pull_request.labels.*.name, 'deploy-feature') }} | |
YARN_CACHE_FOLDER: /home/runner/dependencies/.yarn/cache | |
CYPRESS_CACHE_FOLDER: /home/runner/dependencies/.cache | |
COREPACK_HOME: /home/runner/dependencies/corepack | |
NODE_PATH: /home/runner/dependencies/node_modules | |
COREPACK_ENABLE_STRICT: '0' | |
jobs: | |
prepare: | |
uses: ./.github/workflows/install.yml | |
secrets: inherit | |
tests: | |
needs: | |
- prepare | |
if: ${{ needs.prepare.outputs.TEST_CHUNKS && needs.prepare.outputs.DEPLOY_FEATURE == 'false' }} | |
runs-on: arc-runners | |
timeout-minutes: 45 | |
env: | |
AFFECTED_PROJECTS: ${{ matrix.projects }} | |
NX_BASE: ${{ needs.prepare.outputs.NX_BASE }} | |
strategy: | |
fail-fast: false | |
matrix: ${{ fromJson(needs.prepare.outputs.TEST_CHUNKS) }} | |
steps: | |
- name: checkout | |
uses: actions/checkout@v4 | |
- name: Setup yarn | |
uses: ./.github/actions/setup-yarn | |
- name: load-deps | |
uses: ./.github/actions/load-deps | |
- name: Run unit tests | |
uses: ./.github/actions/unit-test | |
with: | |
dd-api-key: '${{ secrets.DD_API_KEY }}' | |
codecov-token: ${{ secrets.CODECOV_TOKEN }} | |
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
docker-registry: 821090935708.dkr.ecr.eu-west-1.amazonaws.com/ | |
e2e: | |
needs: | |
- prepare | |
if: ${{ needs.prepare.outputs.E2E_CHUNKS && needs.prepare.outputs.DEPLOY_FEATURE == 'false' }} | |
runs-on: arc-runners | |
timeout-minutes: 45 | |
env: | |
AFFECTED_PROJECT: ${{ matrix.projects }} | |
CYPRESS_PROJECT_ID: 4q7jz8 | |
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }} | |
API_MOCKS: 'true' | |
NODE_OPTIONS: --max-old-space-size=4096 | |
E2E_BUILD_ID: '${{ needs.prepare.outputs.E2E_BUILD_ID }}-${{ github.run_attempt }}' | |
NX_BASE: ${{ needs.prepare.outputs.NX_BASE }} | |
strategy: | |
fail-fast: false | |
matrix: ${{ fromJson(needs.prepare.outputs.E2E_CHUNKS) }} | |
steps: | |
- name: checkout | |
uses: actions/checkout@v4 | |
- name: Setup yarn | |
uses: ./.github/actions/setup-yarn | |
- name: load-deps | |
uses: ./.github/actions/load-deps | |
- name: Running e2e tests | |
run: ./scripts/ci/40_e2e.sh "${AFFECTED_PROJECT}" | |
linting-workspace: | |
needs: | |
- prepare | |
runs-on: arc-runners | |
timeout-minutes: 15 | |
steps: | |
- name: checkout | |
uses: actions/checkout@v4 | |
- name: Setup yarn | |
uses: ./.github/actions/setup-yarn | |
- name: load-deps | |
uses: ./.github/actions/load-deps | |
- name: Linting workspace | |
run: ./scripts/ci/20_lint-workspace.sh | |
run-shellcheck: | |
needs: | |
- prepare | |
runs-on: ubuntu-latest | |
timeout-minutes: 5 | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: reviewdog/action-shellcheck@v1 | |
with: | |
github_token: ${{ secrets.github_token }} | |
reporter: github-pr-review | |
fail-level: info | |
exclude: >- | |
*/node_modules/* | |
formatting: | |
needs: | |
- prepare | |
runs-on: arc-runners | |
timeout-minutes: 15 | |
env: | |
NX_BASE: ${{ needs.prepare.outputs.NX_BASE }} | |
steps: | |
- uses: actions/checkout@v4 | |
if: ${{ github.event_name == 'pull_request' }} | |
with: | |
token: ${{ secrets.DIRTY_FIX_BOT_TOKEN }} | |
ref: ${{ github.event.pull_request.head.ref }} | |
- name: Setup yarn | |
uses: ./.github/actions/setup-yarn | |
- name: load-deps | |
uses: ./.github/actions/load-deps | |
- name: NX format:check | |
if: ${{ github.ref == 'ref/heads/main' }} | |
run: ./scripts/ci/20_check-formatting.sh "check" | |
# - name: NX format:write | |
# if: ${{ github.event_name == 'pull_request' }} | |
# run: | | |
# ./scripts/ci/20_check-formatting.sh "write" | |
# ./infra/scripts/ci/git-check-dirty.sh "/" "nx format:write" "dirtybot" | |
linting: | |
needs: | |
- prepare | |
runs-on: arc-runners | |
timeout-minutes: 35 | |
if: needs.prepare.outputs.LINT_CHUNKS | |
env: | |
AFFECTED_PROJECTS: ${{ matrix.projects }} | |
NODE_OPTIONS: --max-old-space-size=4096 | |
NX_BASE: ${{ needs.prepare.outputs.NX_BASE }} | |
strategy: | |
fail-fast: false | |
matrix: ${{ fromJson(needs.prepare.outputs.LINT_CHUNKS) }} | |
steps: | |
- name: checkout | |
uses: actions/checkout@v4 | |
- name: Setup yarn | |
uses: ./.github/actions/setup-yarn | |
- name: load-deps | |
uses: ./.github/actions/load-deps | |
- name: Linting | |
run: ./scripts/ci/run-in-parallel-native.sh lint | |
build: | |
needs: | |
- prepare | |
runs-on: arc-runners | |
timeout-minutes: 35 | |
env: | |
AFFECTED_PROJECTS: ${{ matrix.projects }} | |
NX_BASE: ${{ needs.prepare.outputs.NX_BASE }} | |
strategy: | |
fail-fast: false | |
matrix: ${{ fromJson(needs.prepare.outputs.BUILD_CHUNKS) }} | |
if: ${{ needs.prepare.outputs.BUILD_CHUNKS && needs.prepare.outputs.DEPLOY_FEATURE == 'false' }} | |
steps: | |
- name: checkout | |
uses: actions/checkout@v4 | |
- name: Setup yarn | |
uses: ./.github/actions/setup-yarn | |
- name: load-deps | |
uses: ./.github/actions/load-deps | |
- name: Building | |
run: ./scripts/ci/run-in-parallel-native.sh build | |
success: | |
runs-on: arc-runners | |
if: ${{ !cancelled() }} | |
needs: | |
- prepare | |
- linting-workspace | |
- tests | |
- linting | |
- run-shellcheck | |
- formatting | |
- e2e | |
- build | |
steps: | |
- name: Check prepare success | |
run: '[[ ${{ needs.prepare.result }} == "success" ]] || exit 1' | |
- name: Notify about deploy-feature label | |
if: ${{ github.event.pull_request.auto_merge && needs.prepare.outputs.DEPLOY_FEATURE == 'true' }} | |
run: | | |
echo "- 👉 Remove the \`deploy-feature\` label if you want this PR to be merged automatically" >> $GITHUB_STEP_SUMMARY | |
exit 1 | |
- name: Check tests success | |
run: '[[ ${{ needs.tests.result }} != "failure" ]] || exit 1' | |
- name: Check e2e success | |
run: '[[ ${{ needs.e2e.result }} != "failure" ]] || exit 1' | |
- name: Check linting success | |
run: '[[ ${{ needs.linting.result }} != "failure" ]] || exit 1' | |
- name: Check run-shellcheck success | |
run: '[[ ${{ needs.run-shellcheck.result }} != "failure" ]] || exit 1' | |
- name: Check formatting success | |
run: '[[ ${{ needs.formatting.result }} != "failure" ]] || exit 1' | |
- name: Check build success | |
run: '[[ ${{ needs.build.result }} != "failure" ]] || exit 1' | |
- name: Announce success | |
run: echo "Build is successful" |