Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into sshin/2289
Browse files Browse the repository at this point in the history
  • Loading branch information
suejung-sentry committed Sep 30, 2024
2 parents 7e96e3a + a8ca026 commit d9d8c06
Show file tree
Hide file tree
Showing 464 changed files with 9,228 additions and 6,817 deletions.
6 changes: 5 additions & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@
"plugin:storybook/recommended",
"plugin:tailwindcss/recommended"
],
"plugins": ["@vitest"],
"globals": {
"vi": true
},
"ignorePatterns": [
"!src/**/*.{js,jsx,ts,tsx}",
"src/old_ui/Icon/svg/*.jsx",
Expand All @@ -25,7 +29,7 @@
"testing-library/prefer-find-by": "warn",
"testing-library/await-fire-event": "warn",
"testing-library/no-global-regexp-flag-in-query": "warn",
"testing-library/no-manual-cleanup": "warn",
"testing-library/no-manual-cleanup": "off",
"testing-library/prefer-user-event": "warn",
"testing-library/prefer-wait-for": "warn",
"testing-library/prefer-explicit-assert": "warn",
Expand Down
159 changes: 139 additions & 20 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ jobs:
if: ${{ steps.cache-node-modules.outputs.cache-hit != 'true' }}
run: |
yarn install
lint:
name: Run Lint
runs-on: ubuntu-latest
Expand Down Expand Up @@ -132,15 +133,15 @@ jobs:
run: |
yarn format-check
codecovstartup:
codecov-startup:
name: Codecov Startup
needs: install
uses: codecov/gha-workflows/.github/workflows/codecov-startup.yml@v1.2.14
secrets: inherit

runner-indexes:
runner-indexes-craco:
runs-on: ubuntu-latest
name: Generate runner indexes
name: Generate runner indexes CRACO
needs: install
env:
TEST_SPLIT_NUMBER: 80
Expand All @@ -154,7 +155,7 @@ jobs:
id: generate-index-list
run: |
shopt -s globstar
TEST_LIST=$(ls src/**/*.spec.js src/**/*.test.js src/**/*.spec.jsx src/**/*.spec.ts src/**/*.spec.tsx | jq -R -s -c 'split("\n")[:-1]')
TEST_LIST=$(ls src/**/*.spec.js src/**/*.spec.jsx src/**/*.spec.ts src/**/*.spec.tsx | jq -R -s -c 'split("\n")[:-1]')
TEST_LENGTH=$(echo $TEST_LIST | jq length)
MAX_INDEX=$((($TEST_LENGTH/${{ env.TEST_SPLIT_NUMBER }})))
MAX_INDEX=$(($MAX_INDEX < 0 ? 0 : $TEST_LENGTH % ${{ env.TEST_SPLIT_NUMBER }} == 0 ? $MAX_INDEX - 1 : $MAX_INDEX))
Expand All @@ -163,13 +164,13 @@ jobs:
echo json=${INDEX_JSON} >> $GITHUB_OUTPUT
echo test_list_array=$(echo ${TEST_LIST} | jq -c '[_nwise(${{ env.TEST_SPLIT_NUMBER }})]') >> $GITHUB_OUTPUT
test:
name: 'Test Runner #${{ matrix.runner-index }}'
needs: [install, codecovstartup, runner-indexes]
test-craco:
name: 'Test Runner #${{ matrix.runner-index }} - CRACO'
needs: [install, codecov-startup, runner-indexes-craco]
runs-on: ubuntu-latest
strategy:
matrix:
runner-index: ${{ fromjson(needs.runner-indexes.outputs.json) }}
runner-index: ${{ fromjson(needs.runner-indexes-craco.outputs.json) }}
steps:
- name: Checkout
uses: actions/checkout@v4
Expand All @@ -195,34 +196,152 @@ jobs:
- name: Run tests
run: |
yarn generate-icons:webpack
TESTS=$(echo $TEST_LIST | jq -cr 'join(" ")')
yarn test:ci --maxWorkers=2 $TESTS
env:
JEST_JUNIT_OUTPUT_DIR: ./reports/junit/
TEST_LIST: ${{ tojson(fromjson(needs.runner-indexes.outputs.test_list_array)[matrix.runner-index]) }}
TEST_LIST: ${{ tojson(fromjson(needs.runner-indexes-craco.outputs.test_list_array)[matrix.runner-index]) }}

- name: Upload test results to Codecov
uses: codecov/test-results-action@v1
if: ${{ !cancelled() && !github.event.pull_request.head.repo.fork && github.repository_owner == 'codecov'}}
with:
token: ${{ secrets.CODECOV_ORG_TOKEN }}
url: ${{ secrets.CODECOV_URL }}

- name: Upload test results to Codecov staging
uses: codecov/test-results-action@v1
if: ${{ !cancelled() && !github.event.pull_request.head.repo.fork && github.repository_owner == 'codecov'}}
with:
token: ${{ secrets.CODECOV_ORG_TOKEN_STAGING }}
url: ${{ secrets.CODECOV_STAGING_URL }}

- name: Upload test results to Codecov QA
uses: codecov/test-results-action@v1
if: ${{ !cancelled() && !github.event.pull_request.head.repo.fork && github.repository_owner == 'codecov'}}
with:
token: ${{ secrets.CODECOV_QA_TOKEN }}
url: ${{ secrets.CODECOV_QA_URL }}

- name: Upload test results to Codecov public QA
uses: codecov/test-results-action@v1
if: ${{ !cancelled() && !github.event.pull_request.head.repo.fork && github.repository_owner == 'codecov'}}
with:
token: ${{ secrets.CODECOV_PUBLIC_QA_TOKEN }}
url: ${{ secrets.CODECOV_PUBLIC_QA_URL }}

- name: Install CLI
if: ${{ !github.event.pull_request.head.repo.fork && github.repository_owner == 'codecov' }}
run: |
make test_env.install_cli
## Don't upload on forks for now.
- name: Upload coverage to Production
if: ${{ !github.event.pull_request.head.repo.fork && github.repository_owner == 'codecov' }}
run: |
codecovcli -u ${{ secrets.CODECOV_URL }} do-upload -t ${{ secrets.CODECOV_ORG_TOKEN }} --fail-on-error --name "CRACO-${{ matrix.runner-index }}"
- name: Upload coverage to Staging
if: ${{ !github.event.pull_request.head.repo.fork && github.repository_owner == 'codecov' }}
run: |
codecovcli -u ${{ secrets.CODECOV_STAGING_URL }} do-upload -t ${{ secrets.CODECOV_ORG_TOKEN_STAGING }} --fail-on-error
- name: Upload coverage to QA
if: ${{ !github.event.pull_request.head.repo.fork && github.repository_owner == 'codecov' }}
run: |
codecovcli -u ${{ secrets.CODECOV_QA_URL }} do-upload -t ${{ secrets.CODECOV_QA_TOKEN }} --fail-on-error
- name: Upload coverage to Public QA
if: ${{ !github.event.pull_request.head.repo.fork && github.repository_owner == 'codecov' }}
run: |
codecovcli -u ${{ secrets.CODECOV_PUBLIC_QA_URL }} do-upload -t ${{ secrets.CODECOV_PUBLIC_QA_TOKEN }} --fail-on-error
runner-indexes-vitest:
runs-on: ubuntu-latest
name: Generate runner indexes Vitest
needs: install
env:
TEST_SPLIT_NUMBER: 80
outputs:
json: ${{ steps.generate-index-list.outputs.json }}
test_list_array: ${{ steps.generate-index-list.outputs.test_list_array }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Generate test index list
id: generate-index-list
run: |
shopt -s globstar
TEST_LIST=$(ls src/**/*.test.js src/**/*.test.jsx src/**/*.test.ts src/**/*.test.tsx | jq -R -s -c 'split("\n")[:-1]')
TEST_LENGTH=$(echo $TEST_LIST | jq length)
MAX_INDEX=$((($TEST_LENGTH/${{ env.TEST_SPLIT_NUMBER }})))
MAX_INDEX=$(($MAX_INDEX < 0 ? 0 : $TEST_LENGTH % ${{ env.TEST_SPLIT_NUMBER }} == 0 ? $MAX_INDEX - 1 : $MAX_INDEX))
INDEX_LIST=$(seq 0 ${MAX_INDEX})
INDEX_JSON=$(jq --null-input --compact-output '. |= [inputs]' <<< ${INDEX_LIST})
echo json=${INDEX_JSON} >> $GITHUB_OUTPUT
echo test_list_array=$(echo ${TEST_LIST} | jq -c '[_nwise(${{ env.TEST_SPLIT_NUMBER }})]') >> $GITHUB_OUTPUT
test-vitest:
name: 'Test Runner #${{ matrix.runner-index }} - Vitest'
needs: [install, codecov-startup, runner-indexes-vitest]
runs-on: ubuntu-latest
strategy:
matrix:
runner-index: ${{ fromjson(needs.runner-indexes-vitest.outputs.json) }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 2

- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 20

- name: Cache node_modules
id: cache-node-modules
uses: actions/cache@v4
env:
cache-name: cache-gazebo-node-modules
with:
path: |
node_modules
key: ${{ runner.os }}-${{ env.cache-name }}-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-${{ env.cache-name }}-
- name: Run tests
run: |
TESTS=$(echo $TEST_LIST | jq -cr 'join(" ")')
yarn test:ci:vite --minWorkers=1 --maxWorkers=2 $TESTS
env:
ENABLE_TEST_REPORTER: true
TEST_LIST: ${{ tojson(fromjson(needs.runner-indexes-vitest.outputs.test_list_array)[matrix.runner-index]) }}

- name: Upload test results to codecov
- name: Upload test results to Codecov
uses: codecov/test-results-action@v1
if: ${{ !cancelled() && !github.event.pull_request.head.repo.fork && github.repository_owner == 'codecov'}}
with:
token: ${{ secrets.CODECOV_ORG_TOKEN }}
url: ${{ secrets.CODECOV_URL }}

- name: Upload test results to codecov
- name: Upload test results to Codecov staging
uses: codecov/test-results-action@v1
if: ${{ !cancelled() && !github.event.pull_request.head.repo.fork && github.repository_owner == 'codecov'}}
with:
token: ${{ secrets.CODECOV_ORG_TOKEN_STAGING }}
url: ${{ secrets.CODECOV_STAGING_URL }}

- name: Upload test results to codecov
- name: Upload test results to Codecov QA
uses: codecov/test-results-action@v1
if: ${{ !cancelled() && !github.event.pull_request.head.repo.fork && github.repository_owner == 'codecov'}}
with:
token: ${{ secrets.CODECOV_QA_TOKEN }}
url: ${{ secrets.CODECOV_QA_URL }}

- name: Upload test results to codecov
- name: Upload test results to Codecov public QA
uses: codecov/test-results-action@v1
if: ${{ !cancelled() && !github.event.pull_request.head.repo.fork && github.repository_owner == 'codecov'}}
with:
Expand All @@ -235,22 +354,22 @@ jobs:
make test_env.install_cli
## Don't upload on forks for now.
- name: Upload to Production
- name: Upload coverage to Production
if: ${{ !github.event.pull_request.head.repo.fork && github.repository_owner == 'codecov' }}
run: |
codecovcli -u ${{ secrets.CODECOV_URL }} do-upload -t ${{ secrets.CODECOV_ORG_TOKEN }} --fail-on-error
codecovcli -u ${{ secrets.CODECOV_URL }} do-upload -t ${{ secrets.CODECOV_ORG_TOKEN }} --fail-on-error --name "VITEST-${{ matrix.runner-index }}"
- name: Upload to Staging
- name: Upload coverage to Staging
if: ${{ !github.event.pull_request.head.repo.fork && github.repository_owner == 'codecov' }}
run: |
codecovcli -u ${{ secrets.CODECOV_STAGING_URL }} do-upload -t ${{ secrets.CODECOV_ORG_TOKEN_STAGING }} --fail-on-error
- name: Upload to QA
- name: Upload coverage to QA
if: ${{ !github.event.pull_request.head.repo.fork && github.repository_owner == 'codecov' }}
run: |
codecovcli -u ${{ secrets.CODECOV_QA_URL }} do-upload -t ${{ secrets.CODECOV_QA_TOKEN }} --fail-on-error
- name: Upload to Public QA
- name: Upload coverage to Public QA
if: ${{ !github.event.pull_request.head.repo.fork && github.repository_owner == 'codecov' }}
run: |
codecovcli -u ${{ secrets.CODECOV_PUBLIC_QA_URL }} do-upload -t ${{ secrets.CODECOV_PUBLIC_QA_TOKEN }} --fail-on-error
Expand Down Expand Up @@ -383,7 +502,7 @@ jobs:
build:
name: Build App
runs-on: ubuntu-latest
needs: [install, test]
needs: [install, test-craco]
steps:
- name: Checkout
uses: actions/checkout@v4
Expand Down Expand Up @@ -420,7 +539,7 @@ jobs:

self-hosted:
name: Push Self Hosted Image
needs: [build-self-hosted, test]
needs: [build-self-hosted, test-craco]
secrets: inherit
if: ${{ github.event_name == 'push' && github.event.ref == 'refs/heads/main' && github.repository_owner == 'codecov' }}
uses: codecov/gha-workflows/.github/workflows/self-hosted.yml@v1.2.14
Expand Down
324 changes: 162 additions & 162 deletions .yarn/releases/yarn-4.4.1.cjs → .yarn/releases/yarn-4.5.0.cjs

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion .yarnrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ enableImmutableInstalls: false

nodeLinker: node-modules

yarnPath: .yarn/releases/yarn-4.4.1.cjs
yarnPath: .yarn/releases/yarn-4.5.0.cjs
19 changes: 13 additions & 6 deletions codecov.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
codecov:
require_ci_to_pass: yes
require_ci_to_pass: true

ai_pr_review:
enabled: false
Expand All @@ -11,18 +11,18 @@ coverage:

status:
project: yes
patch: yes
changes: no
patch: true
changes: false

github_checks:
annotations: false

comment:
layout: 'reach, diff, flags, files, components, footer'
behavior: default
require_changes: no
require_base: no
require_head: yes
require_changes: false
require_base: false
require_head: true
after_n_builds: 9 # ceil(number of test files / 80). See ci.yml for more details.

ignore:
Expand All @@ -32,6 +32,10 @@ ignore:
- ./src/**/*.stories.tsx
- ./src/setupTests.js
- ./src/setupProxy.js
- ./src/ts-override.d.ts
- ./src/types.ts
- ./src/vite-env.d.ts
- ./src/vitest.setup.ts
- ./src/reportWebVitals.js
- ./scripts/*
- ./src/index.ts
Expand All @@ -42,6 +46,9 @@ ignore:
- ./src/pages/RepoPage/repo-jest-setup.js
- ./src/ui/SunburstChart/*.jsx
- ./src/ui/SunburstChart/*.js
- './src/**/*.svg'
- './src/**/*.png'
- './src/**/*.jpg'

component_management:
default_rules:
Expand Down
1 change: 1 addition & 0 deletions craco.config.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ module.exports = {
},
jest: {
configure: {
modulePathIgnorePatterns: ['.*.test.*'],
moduleNameMapper: {
'^layouts/(.*)$': '<rootDir>/src/layouts/$1',
'^ui/(.*)$': '<rootDir>/src/ui/$1',
Expand Down
Loading

0 comments on commit d9d8c06

Please sign in to comment.