mirror of
https://github.com/luxfi/explore.git
synced 2026-07-27 05:54:15 +00:00
* first part of transition * second part of transition * remove jest * bump up node version and playwright version * update all screenshots because of the new playwright version * fix tests * one more screenshot update
315 lines
8.6 KiB
YAML
315 lines
8.6 KiB
YAML
name: Checks
|
|
on:
|
|
workflow_call:
|
|
workflow_dispatch:
|
|
pull_request:
|
|
types: [ opened, synchronize, unlabeled ]
|
|
paths-ignore:
|
|
- '.github/ISSUE_TEMPLATE/**'
|
|
- '.husky/**'
|
|
- '.vscode/**'
|
|
- 'deploy/**'
|
|
- 'docs/**'
|
|
- 'public/**'
|
|
- 'stub/**'
|
|
- 'tools/**'
|
|
|
|
# concurrency:
|
|
# group: ${{ github.workflow }}__${{ github.job }}__${{ github.ref }}
|
|
# cancel-in-progress: true
|
|
|
|
permissions:
|
|
contents: read
|
|
pull-requests: write
|
|
|
|
jobs:
|
|
code_quality:
|
|
name: Code quality
|
|
runs-on: ubuntu-latest
|
|
if: ${{ !contains(github.event.pull_request.labels.*.name, 'skip checks') && !(github.event.action == 'unlabeled' && github.event.label.name != 'skip checks') }}
|
|
steps:
|
|
- name: Checkout repo
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Setup node
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: 22.14.0
|
|
cache: 'yarn'
|
|
|
|
- name: Cache node_modules
|
|
uses: actions/cache@v4
|
|
id: cache-node-modules
|
|
with:
|
|
path: |
|
|
node_modules
|
|
key: node_modules-${{ runner.os }}-${{ hashFiles('yarn.lock') }}
|
|
|
|
- name: Install dependencies
|
|
if: steps.cache-node-modules.outputs.cache-hit != 'true'
|
|
run: yarn --frozen-lockfile
|
|
|
|
- name: Generate Chakra types
|
|
if: steps.cache-node-modules.outputs.cache-hit == 'true'
|
|
run: yarn chakra:typegen
|
|
|
|
- name: Run ESLint
|
|
run: yarn lint:eslint
|
|
|
|
- name: Compile TypeScript
|
|
run: yarn lint:tsc
|
|
|
|
toolkit_build_check:
|
|
name: Toolkit build check
|
|
needs: [ code_quality ]
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout repo
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Setup node
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: 22.14.0
|
|
cache: 'yarn'
|
|
|
|
- name: Cache node_modules
|
|
uses: actions/cache@v4
|
|
id: cache-node-modules
|
|
with:
|
|
path: |
|
|
node_modules
|
|
key: node_modules-${{ runner.os }}-${{ hashFiles('yarn.lock') }}
|
|
|
|
- name: Install project dependencies
|
|
if: steps.cache-node-modules.outputs.cache-hit != 'true'
|
|
run: yarn --frozen-lockfile
|
|
|
|
- name: Generate Chakra types
|
|
if: steps.cache-node-modules.outputs.cache-hit == 'true'
|
|
run: yarn chakra:typegen
|
|
|
|
- name: Install package dependencies
|
|
run: |
|
|
cd ./toolkit/package
|
|
yarn --frozen-lockfile
|
|
|
|
- name: Type check the package
|
|
run: |
|
|
cd ./toolkit/package
|
|
yarn typecheck
|
|
|
|
- name: Build the package
|
|
run: |
|
|
cd ./toolkit/package
|
|
yarn build
|
|
|
|
- name: Verify build output
|
|
run: |
|
|
cd ./toolkit/package
|
|
if [ ! -d "dist" ]; then
|
|
echo "Build failed: dist directory not found"
|
|
exit 1
|
|
fi
|
|
|
|
if [ ! -f "dist/index.js" ]; then
|
|
echo "Build failed: dist/index.js not found"
|
|
exit 1
|
|
fi
|
|
|
|
if [ ! -f "dist/index.d.ts" ]; then
|
|
echo "Build failed: dist/index.d.ts not found"
|
|
exit 1
|
|
fi
|
|
|
|
envs_validation:
|
|
name: ENV variables validation
|
|
runs-on: ubuntu-latest
|
|
needs: [ code_quality ]
|
|
steps:
|
|
- name: Checkout repo
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Setup node
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: 22.14.0
|
|
cache: 'yarn'
|
|
|
|
- name: Cache node_modules
|
|
uses: actions/cache@v4
|
|
id: cache-node-modules
|
|
with:
|
|
path: |
|
|
node_modules
|
|
key: node_modules-${{ runner.os }}-${{ hashFiles('yarn.lock') }}
|
|
|
|
- name: Install dependencies
|
|
if: steps.cache-node-modules.outputs.cache-hit != 'true'
|
|
run: yarn --frozen-lockfile
|
|
|
|
- name: Generate Chakra types
|
|
if: steps.cache-node-modules.outputs.cache-hit == 'true'
|
|
run: yarn chakra:typegen
|
|
|
|
- name: Install script dependencies
|
|
run: cd ./deploy/tools/envs-validator && yarn --frozen-lockfile
|
|
|
|
- name: Run validation tests
|
|
run: |
|
|
set +e
|
|
cd ./deploy/tools/envs-validator && yarn test
|
|
exitcode="$?"
|
|
echo "exitcode=$exitcode" >> $GITHUB_OUTPUT
|
|
exit "$exitcode"
|
|
|
|
vitest_tests:
|
|
name: Unit tests
|
|
needs: [ code_quality, envs_validation ]
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout repo
|
|
uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: Setup node
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: 22.14.0
|
|
cache: 'yarn'
|
|
|
|
- name: Cache node_modules
|
|
uses: actions/cache@v4
|
|
id: cache-node-modules
|
|
with:
|
|
path: |
|
|
node_modules
|
|
key: node_modules-${{ runner.os }}-${{ hashFiles('yarn.lock') }}
|
|
|
|
- name: Install dependencies
|
|
if: steps.cache-node-modules.outputs.cache-hit != 'true'
|
|
run: yarn --frozen-lockfile
|
|
|
|
- name: Generate Chakra types
|
|
if: steps.cache-node-modules.outputs.cache-hit == 'true'
|
|
run: yarn chakra:typegen
|
|
|
|
- name: Run Vitest
|
|
run: yarn test:vitest ${{ github.event_name == 'pull_request' && '--changed=origin/main' || '' }} --passWithNoTests
|
|
|
|
pw_affected_tests:
|
|
name: Resolve affected Playwright tests
|
|
runs-on: ubuntu-latest
|
|
needs: [ code_quality, envs_validation ]
|
|
if: github.event_name == 'pull_request'
|
|
steps:
|
|
- name: Checkout repo
|
|
uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: Setup node
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: 22.14.0
|
|
cache: 'yarn'
|
|
|
|
- name: Cache node_modules
|
|
uses: actions/cache@v4
|
|
id: cache-node-modules
|
|
with:
|
|
path: |
|
|
node_modules
|
|
key: node_modules-${{ runner.os }}-${{ hashFiles('yarn.lock') }}
|
|
|
|
- name: Install dependencies
|
|
if: steps.cache-node-modules.outputs.cache-hit != 'true'
|
|
run: yarn --frozen-lockfile
|
|
|
|
- name: Generate Chakra types
|
|
if: steps.cache-node-modules.outputs.cache-hit == 'true'
|
|
run: yarn chakra:typegen
|
|
|
|
- name: Install script dependencies
|
|
run: cd ./deploy/tools/affected-tests && yarn --frozen-lockfile
|
|
|
|
- name: Run script
|
|
run: yarn test:pw:detect-affected
|
|
|
|
- name: Upload result file
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: playwright-affected-tests
|
|
path: ./playwright/affected-tests.txt
|
|
retention-days: 3
|
|
|
|
pw_tests:
|
|
name: 'Playwright tests / Project: ${{ matrix.project }}'
|
|
needs: [ code_quality, envs_validation, pw_affected_tests ]
|
|
if: |
|
|
always() &&
|
|
needs.code_quality.result == 'success' &&
|
|
needs.envs_validation.result == 'success' &&
|
|
(needs.pw_affected_tests.result == 'success' || needs.pw_affected_tests.result == 'skipped')
|
|
runs-on: ubuntu-latest
|
|
container:
|
|
image: mcr.microsoft.com/playwright:v1.57.0-noble
|
|
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
project: [ default, mobile, dark-color-mode ]
|
|
|
|
steps:
|
|
- name: Install git-lfs
|
|
run: apt-get update && apt-get install git-lfs
|
|
|
|
- name: Checkout repo
|
|
uses: actions/checkout@v4
|
|
with:
|
|
lfs: 'true'
|
|
|
|
- name: Setup node
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: 22.14.0
|
|
cache: 'yarn'
|
|
|
|
- name: Cache node_modules
|
|
uses: actions/cache@v4
|
|
id: cache-node-modules
|
|
with:
|
|
path: |
|
|
node_modules
|
|
key: node_modules-${{ runner.os }}-${{ hashFiles('yarn.lock') }}
|
|
|
|
- name: Install dependencies
|
|
if: steps.cache-node-modules.outputs.cache-hit != 'true'
|
|
run: yarn --frozen-lockfile
|
|
|
|
- name: Generate Chakra types
|
|
if: steps.cache-node-modules.outputs.cache-hit == 'true'
|
|
run: yarn chakra:typegen
|
|
|
|
- name: Download affected tests list
|
|
if: ${{ needs.pw_affected_tests.result == 'success' }}
|
|
uses: actions/download-artifact@v4
|
|
continue-on-error: true
|
|
with:
|
|
name: playwright-affected-tests
|
|
path: ./playwright
|
|
|
|
- name: Run PlayWright
|
|
run: yarn test:pw:ci --affected=${{ github.event_name == 'pull_request' }} --pass-with-no-tests
|
|
env:
|
|
HOME: /root
|
|
PW_PROJECT: ${{ matrix.project }}
|
|
|
|
- name: Upload test results
|
|
if: always()
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: playwright-report-${{ matrix.project }}
|
|
path: playwright-report
|
|
retention-days: 10 |