2023-03-07 20:23:44 +09:00
|
|
|
name: Test (frontend)
|
2021-10-28 01:16:13 +09:00
|
|
|
|
2020-03-20 02:46:13 +09:00
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- master
|
|
|
|
- develop
|
2024-01-08 23:51:31 +09:00
|
|
|
paths:
|
|
|
|
- packages/frontend/**
|
|
|
|
# for permissions
|
2024-01-10 17:30:21 +09:00
|
|
|
- packages/cherrypick-js/**
|
2024-01-08 23:51:31 +09:00
|
|
|
# for e2e
|
|
|
|
- packages/backend/**
|
|
|
|
|
2020-03-20 02:46:13 +09:00
|
|
|
pull_request:
|
2024-01-08 23:51:31 +09:00
|
|
|
paths:
|
|
|
|
- packages/frontend/**
|
|
|
|
# for permissions
|
2024-01-10 17:30:21 +09:00
|
|
|
- packages/cherrypick-js/**
|
2024-01-08 23:51:31 +09:00
|
|
|
# for e2e
|
|
|
|
- packages/backend/**
|
2020-01-09 14:35:04 +09:00
|
|
|
|
|
|
|
jobs:
|
2023-03-09 12:48:39 +09:00
|
|
|
vitest:
|
2020-01-09 14:35:04 +09:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
|
|
|
|
strategy:
|
|
|
|
matrix:
|
2023-11-24 09:20:41 +09:00
|
|
|
node-version: [20.10.0]
|
2020-03-20 02:46:13 +09:00
|
|
|
|
2020-01-09 14:35:04 +09:00
|
|
|
steps:
|
2023-10-19 19:35:13 +09:00
|
|
|
- uses: actions/checkout@v4.1.1
|
2021-09-04 17:54:24 +09:00
|
|
|
with:
|
|
|
|
submodules: true
|
2023-01-16 06:08:42 +09:00
|
|
|
- name: Install pnpm
|
|
|
|
uses: pnpm/action-setup@v2
|
|
|
|
with:
|
2023-04-27 00:17:40 +09:00
|
|
|
version: 8
|
2023-01-16 06:08:42 +09:00
|
|
|
run_install: false
|
2020-01-09 14:35:04 +09:00
|
|
|
- name: Use Node.js ${{ matrix.node-version }}
|
2023-12-21 11:37:14 +09:00
|
|
|
uses: actions/setup-node@v4.0.1
|
2020-01-09 14:35:04 +09:00
|
|
|
with:
|
|
|
|
node-version: ${{ matrix.node-version }}
|
2023-01-16 06:08:42 +09:00
|
|
|
cache: 'pnpm'
|
2022-11-24 15:39:00 +09:00
|
|
|
- run: corepack enable
|
2023-01-16 06:08:42 +09:00
|
|
|
- run: pnpm i --frozen-lockfile
|
|
|
|
- name: Check pnpm-lock.yaml
|
|
|
|
run: git diff --exit-code pnpm-lock.yaml
|
2020-03-20 02:46:13 +09:00
|
|
|
- name: Copy Configure
|
2022-09-15 20:32:25 +09:00
|
|
|
run: cp .github/cherrypick/test.yml .config
|
2020-03-20 02:46:13 +09:00
|
|
|
- name: Build
|
2023-01-16 06:08:42 +09:00
|
|
|
run: pnpm build
|
2020-03-20 02:46:13 +09:00
|
|
|
- name: Test
|
2023-03-09 12:48:39 +09:00
|
|
|
run: pnpm --filter frontend test-and-coverage
|
2022-09-18 03:27:08 +09:00
|
|
|
- name: Upload Coverage
|
|
|
|
uses: codecov/codecov-action@v3
|
|
|
|
with:
|
2022-09-20 04:56:19 +09:00
|
|
|
token: ${{ secrets.CODECOV_TOKEN }}
|
2023-03-09 12:48:39 +09:00
|
|
|
files: ./packages/frontend/coverage/coverage-final.json
|
2020-03-20 02:46:13 +09:00
|
|
|
|
2021-10-28 01:16:13 +09:00
|
|
|
e2e:
|
2020-03-20 02:46:13 +09:00
|
|
|
runs-on: ubuntu-latest
|
2021-10-28 01:16:13 +09:00
|
|
|
|
|
|
|
strategy:
|
2022-01-21 16:43:56 +09:00
|
|
|
fail-fast: false
|
2021-10-28 01:16:13 +09:00
|
|
|
matrix:
|
2023-11-24 09:20:41 +09:00
|
|
|
node-version: [20.10.0]
|
2022-01-21 16:43:56 +09:00
|
|
|
browser: [chrome]
|
2021-10-28 01:16:13 +09:00
|
|
|
|
|
|
|
services:
|
|
|
|
postgres:
|
2023-12-21 10:29:51 +09:00
|
|
|
image: postgres:15
|
2021-10-28 01:16:13 +09:00
|
|
|
ports:
|
|
|
|
- 54312:5432
|
|
|
|
env:
|
2022-08-31 22:53:59 +09:00
|
|
|
POSTGRES_DB: test-cherrypick
|
2021-10-28 01:16:13 +09:00
|
|
|
POSTGRES_HOST_AUTH_METHOD: trust
|
|
|
|
redis:
|
2023-04-06 10:30:06 +09:00
|
|
|
image: redis:7
|
2021-10-28 01:16:13 +09:00
|
|
|
ports:
|
|
|
|
- 56312:6379
|
|
|
|
|
2020-03-20 02:46:13 +09:00
|
|
|
steps:
|
2023-10-19 19:35:13 +09:00
|
|
|
- uses: actions/checkout@v4.1.1
|
2021-09-04 17:54:24 +09:00
|
|
|
with:
|
|
|
|
submodules: true
|
2022-01-21 16:43:56 +09:00
|
|
|
# https://github.com/cypress-io/cypress-docker-images/issues/150
|
|
|
|
#- name: Install mplayer for FireFox
|
|
|
|
# run: sudo apt install mplayer -y
|
|
|
|
# if: ${{ matrix.browser == 'firefox' }}
|
|
|
|
#- uses: browser-actions/setup-firefox@latest
|
|
|
|
# if: ${{ matrix.browser == 'firefox' }}
|
2023-01-16 06:08:42 +09:00
|
|
|
- name: Install pnpm
|
|
|
|
uses: pnpm/action-setup@v2
|
|
|
|
with:
|
|
|
|
version: 7
|
|
|
|
run_install: false
|
2021-10-28 01:16:13 +09:00
|
|
|
- name: Use Node.js ${{ matrix.node-version }}
|
2023-12-21 11:37:14 +09:00
|
|
|
uses: actions/setup-node@v4.0.1
|
2020-03-20 02:46:13 +09:00
|
|
|
with:
|
2021-10-28 01:16:13 +09:00
|
|
|
node-version: ${{ matrix.node-version }}
|
2023-01-16 06:08:42 +09:00
|
|
|
cache: 'pnpm'
|
2022-11-24 15:39:00 +09:00
|
|
|
- run: corepack enable
|
2023-01-16 06:08:42 +09:00
|
|
|
- run: pnpm i --frozen-lockfile
|
2021-10-28 01:16:13 +09:00
|
|
|
- name: Copy Configure
|
2022-09-15 20:32:25 +09:00
|
|
|
run: cp .github/cherrypick/test.yml .config
|
2021-10-28 01:16:13 +09:00
|
|
|
- name: Build
|
2023-01-16 06:08:42 +09:00
|
|
|
run: pnpm build
|
2022-01-21 16:43:56 +09:00
|
|
|
# https://github.com/cypress-io/cypress/issues/4351#issuecomment-559489091
|
|
|
|
- name: ALSA Env
|
|
|
|
run: echo -e 'pcm.!default {\n type hw\n card 0\n}\n\nctl.!default {\n type hw\n card 0\n}' > ~/.asoundrc
|
2023-01-26 16:07:15 +09:00
|
|
|
# XXX: This tries reinstalling Cypress if the binary is not cached
|
|
|
|
# Remove this when the cache issue is fixed
|
|
|
|
- name: Cypress install
|
|
|
|
run: pnpm exec cypress install
|
2022-01-21 16:43:56 +09:00
|
|
|
- name: Cypress run
|
2023-08-22 15:58:10 +09:00
|
|
|
uses: cypress-io/github-action@v6
|
2022-01-21 16:43:56 +09:00
|
|
|
with:
|
|
|
|
install: false
|
2023-01-16 06:08:42 +09:00
|
|
|
start: pnpm start:test
|
2022-01-21 16:43:56 +09:00
|
|
|
wait-on: 'http://localhost:61812'
|
2023-04-19 16:42:14 +09:00
|
|
|
headed: true
|
2022-01-21 16:43:56 +09:00
|
|
|
browser: ${{ matrix.browser }}
|
2023-12-16 08:58:03 +09:00
|
|
|
- uses: actions/upload-artifact@v4
|
2022-01-21 16:43:56 +09:00
|
|
|
if: failure()
|
|
|
|
with:
|
|
|
|
name: ${{ matrix.browser }}-cypress-screenshots
|
|
|
|
path: cypress/screenshots
|
2023-12-16 08:58:03 +09:00
|
|
|
- uses: actions/upload-artifact@v4
|
2022-01-21 16:43:56 +09:00
|
|
|
if: always()
|
|
|
|
with:
|
|
|
|
name: ${{ matrix.browser }}-cypress-videos
|
|
|
|
path: cypress/videos
|