test: node_modules updates #2930
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: Test | |
on: | |
pull_request: | |
concurrency: | |
group: ${{ github.ref }}-test | |
cancel-in-progress: true | |
env: | |
HUSKY: 0 # disable husky | |
TURBO_TEAM: ${{ secrets.TURBO_TEAM }} # for Turborepo remote cache | |
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }} # for Turborepo remote cache | |
NEXT_TELEMETRY_DISABLED: 1 # disable NextJS telemetry | |
SENTRYCLI_SKIP_DOWNLOAD: 1 # disable Sentry.io CLI download | |
FORCE_COLOR: 0 # disable terminal color in yarn berry | |
defaults: | |
run: | |
shell: bash | |
jobs: | |
check-yarn-cache: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- run: corepack enable | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 18 | |
- run: yarn --immutable --immutable-cache --check-cache | |
changed-workspaces: | |
runs-on: ubuntu-latest | |
outputs: | |
projects: ${{ steps.dry-run.outputs.projects }} | |
projects-web: ${{ steps.dry-run.outputs.projects-web }} | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- run: corepack enable | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 18 | |
- run: yarn --immutable --immutable-cache | |
- name: Set needs.changed-workspaces.outputs.{projects,projects-web} | |
id: dry-run | |
run: | | |
echo yarn build:ci --dry='json' --filter='[${{ github.event.pull_request.base.sha }}]' | tee -a $GITHUB_STEP_SUMMARY | |
export DRY_BUILD_JSON=$( | |
yarn build:ci --dry='json' --filter='[${{ github.event.pull_request.base.sha }}]' | jq '{packages: .packages}' | |
) | |
node <<EOF | tee -a $GITHUB_OUTPUT $GITHUB_STEP_SUMMARY | |
const { packages } = JSON.parse(process.env.DRY_BUILD_JSON); | |
console.log('projects=' + JSON.stringify(packages.filter(p => /^(?:ui|web.*)$/.test(p)))); | |
EOF | |
node <<EOF | tee -a $GITHUB_OUTPUT $GITHUB_STEP_SUMMARY | |
const { packages } = JSON.parse(process.env.DRY_BUILD_JSON); | |
console.log('projects-web=' + JSON.stringify(packages.filter(p => /^web.*$/.test(p)))); | |
EOF | |
ts-lint-build: | |
if: ${{ success() && needs.changed-workspaces.outputs.projects != '[]' }} | |
needs: changed-workspaces | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
project: ${{ fromJSON(needs.changed-workspaces.outputs.projects) }} | |
steps: | |
- uses: actions/checkout@v3 | |
- run: corepack enable | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 18 | |
- run: yarn --immutable --immutable-cache | |
- name: ts-check | |
run: | | |
echo '```' >> $GITHUB_STEP_SUMMARY | |
yarn ts-check:ci --filter=${{ matrix.project }} | tee -a $GITHUB_STEP_SUMMARY | |
echo '```' >> $GITHUB_STEP_SUMMARY | |
- name: lint | |
run: | | |
echo '```' >> $GITHUB_STEP_SUMMARY | |
yarn lint:ci --filter=${{ matrix.project }} | tee -a $GITHUB_STEP_SUMMARY | |
echo '```' >> $GITHUB_STEP_SUMMARY | |
- name: build | |
if: ${{ needs.changed-workspaces.outputs.projects-web != '[]' }} | |
run: | | |
echo '```' >> $GITHUB_STEP_SUMMARY | |
yarn build:ci --filter=${{ matrix.project }} | tee -a $GITHUB_STEP_SUMMARY | |
echo '```' >> $GITHUB_STEP_SUMMARY | |
jest-test: | |
if: ${{ success() && needs.changed-workspaces.outputs.projects != '[]' }} | |
needs: changed-workspaces | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
shardIndex: [1, 2, 3, 4, 5] | |
shardTotal: [5] | |
steps: | |
- uses: actions/checkout@v3 | |
- run: corepack enable | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 18 | |
- run: yarn --immutable --immutable-cache | |
- name: test | |
run: | | |
echo '```' >> $GITHUB_STEP_SUMMARY | |
yarn test:ci --filter=${{ join(fromJSON(needs.changed-workspaces.outputs.projects), ' --filter=') }} -- --shard=${{ matrix.shardIndex }}/${{ matrix.shardTotal }} --coverage | tee -a $GITHUB_STEP_SUMMARY | |
echo '```' >> $GITHUB_STEP_SUMMARY | |
e2e-playwright: | |
if: ${{ success() && needs.changed-workspaces.outputs.projects-web != '[]' }} | |
needs: changed-workspaces | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
project: [web] | |
browser: | |
- chromium | |
# - firefox | |
# - webkit | |
# - mobile-chrome | |
- mobile-safari | |
shardIndex: [1, 2, 3, 4, 5] | |
shardTotal: [5] | |
container: | |
image: mcr.microsoft.com/playwright:v1.33.0-focal | |
steps: | |
- uses: actions/checkout@v3 | |
- run: corepack enable | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 18 | |
- run: yarn --immutable --immutable-cache | |
- name: Playwright testing | |
run: | | |
echo '```' >> $GITHUB_STEP_SUMMARY | |
yarn playwright test --project=${{ matrix.browser }} --shard=${{ matrix.shardIndex }}/${{ matrix.shardTotal }} | tee -a $GITHUB_STEP_SUMMARY | |
echo '```' >> $GITHUB_STEP_SUMMARY | |
env: | |
CI: 1 | |
DEBUG: pw:webserver | |
PROJECT_NAME: ${{ matrix.project }} | |
PLAYWRIGHT_HTML_REPORT: playwright-report/${{ matrix.browser }}/${{ matrix.shardIndex }} | |
- uses: actions/upload-artifact@v3 | |
if: ${{ failure() }} | |
with: | |
name: trace.playwright.dev | |
path: playwright-report/ | |
retention-days: 7 |