Skip to content

fix: content layout shift fix, form label common component, and other changes #2935

fix: content layout shift fix, form label common component, and other changes

fix: content layout shift fix, form label common component, and other changes #2935

Workflow file for this run

name: Gazebo CI
on:
push:
branches:
- main
- staging
pull_request:
merge_group:
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
install:
name: Install deps
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- 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('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-${{ env.cache-name }}-
# - name: Setup Bun
# uses: oven-sh/setup-bun@v1
# if: ${{ steps.cache-node-modules.outputs.cache-hit != 'true' }}
- name: Install packages
if: ${{ steps.cache-node-modules.outputs.cache-hit != 'true' }}
run: |
npm install
lint:
name: Run Lint
runs-on: ubuntu-latest
needs: install
steps:
- name: Checkout
uses: actions/checkout@v4
- 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('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-${{ env.cache-name }}-
- name: Run linter
run: |
npm run lint
type-check:
name: Run Type Checker
runs-on: ubuntu-latest
needs: install
steps:
- name: Checkout
uses: actions/checkout@v4
- 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('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-${{ env.cache-name }}-
- name: Run TSC
run: |
npm run type-check
codecovstartup:
name: Codecov Startup
needs: install
uses: codecov/gha-workflows/.github/workflows/[email protected]
secrets: inherit
runner-indexes:
runs-on: ubuntu-latest
name: Generate runner indexes
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/**/*.spec.js src/**/*.test.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))
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:
name: 'Test Runner #${{ matrix.runner-index }}'
needs: [install, codecovstartup, runner-indexes]
runs-on: ubuntu-latest
strategy:
matrix:
runner-index: ${{ fromjson(needs.runner-indexes.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('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-${{ env.cache-name }}-
- name: Run tests
run: |
TESTS=$(echo $TEST_LIST | jq -cr 'join(" ")')
npm run 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]) }}
- 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
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
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
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 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: Upload 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
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
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
upload-bundle-stats-to-prod:
name: Upload Bundle Stats - Production
runs-on: ubuntu-latest
needs: install
if: ${{ !github.event.pull_request.head.repo.fork && github.repository_owner == 'codecov' }}
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('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-${{ env.cache-name }}-
- name: Build and upload stats
run: |
npm run build:stats
env:
CODECOV_API_URL: ${{ secrets.CODECOV_API_URL }}
CODECOV_ORG_TOKEN: ${{ secrets.CODECOV_ORG_TOKEN }}
CODECOV_BUNDLE_NAME: 'gazebo-production'
upload-bundle-stats-to-staging:
name: Upload Bundle Stats - Staging
runs-on: ubuntu-latest
needs: install
if: ${{ !github.event.pull_request.head.repo.fork && github.repository_owner == 'codecov' }}
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('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-${{ env.cache-name }}-
- name: Build and upload stats
run: |
npm run build:stats
env:
CODECOV_API_URL: ${{ secrets.CODECOV_STAGING_API_URL }}
CODECOV_ORG_TOKEN: ${{ secrets.CODECOV_ORG_TOKEN_STAGING }}
CODECOV_BUNDLE_NAME: 'gazebo-staging'
storybook:
name: Run storybook
runs-on: ubuntu-latest
needs: install
if: ${{ !github.event.pull_request.head.repo.fork && !startsWith(github.ref, 'refs/heads/dependabot') && github.repository_owner == 'codecov' }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- 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('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-${{ env.cache-name }}-
- name: Deploy to Chromatic
run: |
npm run chromatic
env:
CHROMATIC_PROJECT_TOKEN: ${{ secrets.CHROMATIC_PROJECT_TOKEN }}
fossa:
name: Run Fossa
runs-on: ubuntu-latest
needs: install
if: ${{ !github.event.pull_request.head.repo.fork && github.repository_owner == 'codecov' }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 20
- name: Run Fossa
uses: fossas/[email protected]
with:
api-key: ${{secrets.FOSSA_API_KEY}}
build:
name: Build App
runs-on: ubuntu-latest
needs: [install, test]
steps:
- name: Checkout
uses: actions/checkout@v4
- 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('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-${{ env.cache-name }}-
- name: Build React App
run: |
npm run build
build-self-hosted:
name: Build Self Hosted Image
secrets: inherit
if: ${{ !github.event.pull_request.head.repo.fork && github.repository_owner == 'codecov' }}
uses: codecov/gha-workflows/.github/workflows/[email protected]
with:
repo: ${{ vars.CODECOV_IMAGE_V2 || 'codecov/self-hosted-frontend' }}
cache_requirements: false
self-hosted:
name: Push Self Hosted Image
needs: [build-self-hosted, test]
secrets: inherit
if: ${{ github.event_name == 'push' && github.event.ref == 'refs/heads/main' && github.repository_owner == 'codecov' }}
uses: codecov/gha-workflows/.github/workflows/[email protected]
with:
push_rolling: true
repo: ${{ vars.CODECOV_IMAGE_V2 || 'codecov/self-hosted-frontend' }}
cache_requirements: false