2023-03-07 11:23:44 +00:00
|
|
|
name: Test (frontend)
|
2021-10-27 16:16:13 +00:00
|
|
|
|
2020-03-19 17:46:13 +00:00
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- master
|
|
|
|
- develop
|
|
|
|
pull_request:
|
2020-01-09 05:35:04 +00:00
|
|
|
|
|
|
|
jobs:
|
2023-03-09 03:48:39 +00:00
|
|
|
vitest:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
|
|
|
|
strategy:
|
|
|
|
matrix:
|
2023-07-07 04:58:43 +00:00
|
|
|
node-version: [20.x]
|
2023-03-09 03:48:39 +00:00
|
|
|
|
|
|
|
steps:
|
2023-08-12 11:17:17 +00:00
|
|
|
- uses: actions/checkout@v3.5.3
|
2023-03-09 03:48:39 +00:00
|
|
|
with:
|
|
|
|
submodules: true
|
|
|
|
- name: Install pnpm
|
|
|
|
uses: pnpm/action-setup@v2
|
|
|
|
with:
|
2023-04-26 15:17:40 +00:00
|
|
|
version: 8
|
2023-03-09 03:48:39 +00:00
|
|
|
run_install: false
|
|
|
|
- name: Use Node.js ${{ matrix.node-version }}
|
2023-08-19 09:39:39 +00:00
|
|
|
uses: actions/setup-node@v3.8.1
|
2023-03-09 03:48:39 +00:00
|
|
|
with:
|
|
|
|
node-version: ${{ matrix.node-version }}
|
|
|
|
cache: 'pnpm'
|
|
|
|
- run: corepack enable
|
|
|
|
- run: pnpm i --frozen-lockfile
|
|
|
|
- name: Check pnpm-lock.yaml
|
|
|
|
run: git diff --exit-code pnpm-lock.yaml
|
|
|
|
- name: Copy Configure
|
|
|
|
run: cp .github/misskey/test.yml .config
|
|
|
|
- name: Build
|
|
|
|
run: pnpm build
|
|
|
|
- name: Test
|
|
|
|
run: pnpm --filter frontend test-and-coverage
|
|
|
|
- name: Upload Coverage
|
|
|
|
uses: codecov/codecov-action@v3
|
|
|
|
with:
|
|
|
|
token: ${{ secrets.CODECOV_TOKEN }}
|
|
|
|
files: ./packages/frontend/coverage/coverage-final.json
|
|
|
|
|
|
|
|
e2e:
|
2020-03-19 17:46:13 +00:00
|
|
|
runs-on: ubuntu-latest
|
2021-10-27 16:16:13 +00:00
|
|
|
|
|
|
|
strategy:
|
2022-01-21 07:43:56 +00:00
|
|
|
fail-fast: false
|
2021-10-27 16:16:13 +00:00
|
|
|
matrix:
|
2023-07-07 04:58:43 +00:00
|
|
|
node-version: [20.x]
|
2022-01-21 07:43:56 +00:00
|
|
|
browser: [chrome]
|
2021-10-27 16:16:13 +00:00
|
|
|
|
|
|
|
services:
|
|
|
|
postgres:
|
2022-01-21 07:43:56 +00:00
|
|
|
image: postgres:13
|
2021-10-27 16:16:13 +00:00
|
|
|
ports:
|
|
|
|
- 54312:5432
|
|
|
|
env:
|
|
|
|
POSTGRES_DB: test-misskey
|
|
|
|
POSTGRES_HOST_AUTH_METHOD: trust
|
|
|
|
redis:
|
2023-04-06 01:30:06 +00:00
|
|
|
image: redis:7
|
2021-10-27 16:16:13 +00:00
|
|
|
ports:
|
|
|
|
- 56312:6379
|
|
|
|
|
2020-03-19 17:46:13 +00:00
|
|
|
steps:
|
2023-08-12 11:17:17 +00:00
|
|
|
- uses: actions/checkout@v3.5.3
|
2021-09-04 08:54:24 +00:00
|
|
|
with:
|
|
|
|
submodules: true
|
2022-01-21 07:43:56 +00: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-15 21:08:42 +00:00
|
|
|
- name: Install pnpm
|
|
|
|
uses: pnpm/action-setup@v2
|
|
|
|
with:
|
|
|
|
version: 7
|
|
|
|
run_install: false
|
2021-10-27 16:16:13 +00:00
|
|
|
- name: Use Node.js ${{ matrix.node-version }}
|
2023-08-19 09:39:39 +00:00
|
|
|
uses: actions/setup-node@v3.8.1
|
2020-03-19 17:46:13 +00:00
|
|
|
with:
|
2021-10-27 16:16:13 +00:00
|
|
|
node-version: ${{ matrix.node-version }}
|
2023-01-15 21:08:42 +00:00
|
|
|
cache: 'pnpm'
|
2022-11-24 06:39:00 +00:00
|
|
|
- run: corepack enable
|
2023-01-15 21:08:42 +00:00
|
|
|
- run: pnpm i --frozen-lockfile
|
2021-10-27 16:16:13 +00:00
|
|
|
- name: Copy Configure
|
2021-11-12 03:43:55 +00:00
|
|
|
run: cp .github/misskey/test.yml .config
|
2021-10-27 16:16:13 +00:00
|
|
|
- name: Build
|
2023-01-15 21:08:42 +00:00
|
|
|
run: pnpm build
|
2022-01-21 07:43:56 +00: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 07:07:15 +00: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 07:43:56 +00:00
|
|
|
- name: Cypress run
|
2023-01-26 07:07:15 +00:00
|
|
|
uses: cypress-io/github-action@v5
|
2022-01-21 07:43:56 +00:00
|
|
|
with:
|
|
|
|
install: false
|
2023-01-15 21:08:42 +00:00
|
|
|
start: pnpm start:test
|
2022-01-21 07:43:56 +00:00
|
|
|
wait-on: 'http://localhost:61812'
|
2023-04-19 07:42:14 +00:00
|
|
|
headed: true
|
2022-01-21 07:43:56 +00:00
|
|
|
browser: ${{ matrix.browser }}
|
|
|
|
- uses: actions/upload-artifact@v2
|
|
|
|
if: failure()
|
|
|
|
with:
|
|
|
|
name: ${{ matrix.browser }}-cypress-screenshots
|
|
|
|
path: cypress/screenshots
|
|
|
|
- uses: actions/upload-artifact@v2
|
|
|
|
if: always()
|
|
|
|
with:
|
|
|
|
name: ${{ matrix.browser }}-cypress-videos
|
|
|
|
path: cypress/videos
|