feature: 優化遊戲房間使用者體驗與新聊天室串接 web socket #1247
Workflow file for this run
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: CI workflow | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.head_ref }} | |
cancel-in-progress: true | |
on: | |
pull_request: | |
branches: '**' | |
workflow_dispatch: | |
env: | |
APPLICATION_FOLDER: ~/game-lobby/frontend | |
NEXT_PUBLIC_MOCK: true | |
NEXT_PUBLIC_CI_MODE: true | |
jobs: | |
init: | |
name: Initial Common Steps | |
runs-on: ubuntu-latest | |
steps: | |
- name: Git checkout | |
uses: actions/checkout@v3 | |
- name: Cache dependencies | |
id: cache | |
uses: actions/cache@v3 | |
with: | |
path: | | |
node_modules | |
~/.cache/Cypress | |
key: deps-node-modules-${{ hashFiles('**/yarn.lock') }} | |
- name: Install dependencies | |
if: steps.cache.outputs.cache-hit != 'true' | |
run: yarn install --frozen-lockfile | |
build-and-lhci: | |
name: Build And LHCI | |
runs-on: ubuntu-latest | |
needs: init | |
steps: | |
- name: Git checkout | |
uses: actions/checkout@v3 | |
- name: Cache dependencies | |
id: cache | |
uses: actions/cache@v3 | |
with: | |
path: | | |
node_modules | |
~/.cache/Cypress | |
key: deps-node-modules-${{ hashFiles('**/yarn.lock') }} | |
- name: Install dependencies | |
if: steps.cache.outputs.cache-hit != 'true' | |
run: yarn install --frozen-lockfile | |
- name: Build | |
run: yarn build | |
- name: Bundle Watch | |
shell: bash | |
env: | |
CI_REPO_OWNER: Game-as-a-Service | |
CI_REPO_NAME: Game-Lobby-Web | |
CI_BRANCH: ${{ github.head_ref }} | |
CI_BRANCH_BASE: ${{ github.base_ref }} | |
CI_COMMIT_SHA: ${{ github.sha }} | |
BUNDLEWATCH_GITHUB_TOKEN: ${{ secrets.GIT_TOKEN }} | |
run: yarn run bundlewatch | |
- name: Audit URLs using Lighthouse | |
uses: treosh/lighthouse-ci-action@v10 | |
with: | |
uploadArtifacts: false | |
temporaryPublicStorage: true | |
configPath: ./lighthouserc.js | |
env: | |
LHCI_GITHUB_TOKEN: ${{ secrets.LHCI_GITHUB_APP_TOKEN }} | |
- name: lhci PR reporter | |
env: | |
GIT_TOKEN: ${{ secrets.GIT_TOKEN }} | |
run: node ./scripts/lhciScanReporter.js | |
test: | |
name: Test | |
runs-on: ubuntu-latest | |
needs: init | |
steps: | |
- name: Git checkout | |
uses: actions/checkout@v3 | |
- name: Cache dependencies | |
id: cache | |
uses: actions/cache@v3 | |
with: | |
path: | | |
node_modules | |
~/.cache/Cypress | |
key: deps-node-modules-${{ hashFiles('**/yarn.lock') }} | |
- name: Install dependencies | |
if: steps.cache.outputs.cache-hit != 'true' | |
run: yarn install --frozen-lockfile | |
- name: Test | |
run: yarn test | |
lint: | |
name: Lint | |
runs-on: ubuntu-latest | |
needs: init | |
steps: | |
- name: Git checkout | |
uses: actions/checkout@v3 | |
- name: Cache dependencies | |
id: cache | |
uses: actions/cache@v3 | |
with: | |
path: | | |
node_modules | |
~/.cache/Cypress | |
key: deps-node-modules-${{ hashFiles('**/yarn.lock') }} | |
- name: Install dependencies | |
if: steps.cache.outputs.cache-hit != 'true' | |
run: yarn install --frozen-lockfile | |
- name: lint | |
run: npx [email protected] --no-error-on-unmatched-pattern -c .eslintrc.json $(git diff --name-only --relative --diff-filter=ACMRTUXB HEAD~1 | grep -E ".(js|jsx|ts|tsx)$") | |
knip-scan: | |
name: Knip Scan | |
runs-on: ubuntu-latest | |
needs: init | |
steps: | |
- name: Git checkout | |
uses: actions/checkout@v3 | |
- name: Cache dependencies | |
id: cache | |
uses: actions/cache@v3 | |
with: | |
path: | | |
node_modules | |
~/.cache/Cypress | |
key: deps-node-modules-${{ hashFiles('**/yarn.lock') }} | |
- name: Install dependencies | |
if: steps.cache.outputs.cache-hit != 'true' | |
run: yarn install --frozen-lockfile | |
- name: knip | |
env: | |
GIT_TOKEN: ${{ secrets.GIT_TOKEN }} | |
run: | | |
yarn run knip > knipScanResult.txt 2>&1 | |
node ./scripts/knipScanReporter.js |