2023-03-07 12:23:44 +01:00
|
|
|
name: Test (frontend)
|
2021-10-27 18:16:13 +02:00
|
|
|
|
2020-03-19 18:46:13 +01:00
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- master
|
|
|
|
- develop
|
2024-01-08 15:51:31 +01:00
|
|
|
paths:
|
|
|
|
- packages/frontend/**
|
|
|
|
# for permissions
|
|
|
|
- packages/misskey-js/**
|
|
|
|
# for e2e
|
|
|
|
- packages/backend/**
|
2024-07-14 10:27:27 +02:00
|
|
|
- .github/workflows/test-frontend.yml
|
2020-03-19 18:46:13 +01:00
|
|
|
pull_request:
|
2024-01-08 15:51:31 +01:00
|
|
|
paths:
|
|
|
|
- packages/frontend/**
|
|
|
|
# for permissions
|
|
|
|
- packages/misskey-js/**
|
|
|
|
# for e2e
|
|
|
|
- packages/backend/**
|
2024-07-14 10:27:27 +02:00
|
|
|
- .github/workflows/test-frontend.yml
|
2020-01-09 06:35:04 +01:00
|
|
|
jobs:
|
2023-03-09 04:48:39 +01:00
|
|
|
vitest:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
|
|
|
|
strategy:
|
|
|
|
matrix:
|
2024-11-13 11:43:36 +01:00
|
|
|
node-version: [22.11.0]
|
2023-03-09 04:48:39 +01:00
|
|
|
|
|
|
|
steps:
|
2023-10-19 12:35:13 +02:00
|
|
|
- uses: actions/checkout@v4.1.1
|
2023-03-09 04:48:39 +01:00
|
|
|
with:
|
|
|
|
submodules: true
|
|
|
|
- name: Install pnpm
|
2024-05-20 11:55:42 +02:00
|
|
|
uses: pnpm/action-setup@v4
|
2023-03-09 04:48:39 +01:00
|
|
|
- name: Use Node.js ${{ matrix.node-version }}
|
2024-09-20 14:05:35 +02:00
|
|
|
uses: actions/setup-node@v4.0.4
|
2023-03-09 04:48:39 +01: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
|
2024-11-15 09:32:28 +01:00
|
|
|
uses: codecov/codecov-action@v5
|
2023-03-09 04:48:39 +01:00
|
|
|
with:
|
|
|
|
token: ${{ secrets.CODECOV_TOKEN }}
|
|
|
|
files: ./packages/frontend/coverage/coverage-final.json
|
|
|
|
|
|
|
|
e2e:
|
2020-03-19 18:46:13 +01:00
|
|
|
runs-on: ubuntu-latest
|
2021-10-27 18:16:13 +02:00
|
|
|
|
|
|
|
strategy:
|
2022-01-21 08:43:56 +01:00
|
|
|
fail-fast: false
|
2021-10-27 18:16:13 +02:00
|
|
|
matrix:
|
2024-11-13 11:43:36 +01:00
|
|
|
node-version: [22.11.0]
|
2022-01-21 08:43:56 +01:00
|
|
|
browser: [chrome]
|
2021-10-27 18:16:13 +02:00
|
|
|
|
|
|
|
services:
|
|
|
|
postgres:
|
2023-12-21 02:29:51 +01:00
|
|
|
image: postgres:15
|
2021-10-27 18:16:13 +02:00
|
|
|
ports:
|
|
|
|
- 54312:5432
|
|
|
|
env:
|
|
|
|
POSTGRES_DB: test-misskey
|
|
|
|
POSTGRES_HOST_AUTH_METHOD: trust
|
|
|
|
redis:
|
2023-04-06 03:30:06 +02:00
|
|
|
image: redis:7
|
2021-10-27 18:16:13 +02:00
|
|
|
ports:
|
|
|
|
- 56312:6379
|
|
|
|
|
2020-03-19 18:46:13 +01:00
|
|
|
steps:
|
2023-10-19 12:35:13 +02:00
|
|
|
- uses: actions/checkout@v4.1.1
|
2021-09-04 10:54:24 +02:00
|
|
|
with:
|
|
|
|
submodules: true
|
2022-01-21 08:43:56 +01: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 22:08:42 +01:00
|
|
|
- name: Install pnpm
|
2024-05-20 11:55:42 +02:00
|
|
|
uses: pnpm/action-setup@v4
|
2021-10-27 18:16:13 +02:00
|
|
|
- name: Use Node.js ${{ matrix.node-version }}
|
2024-09-20 14:05:35 +02:00
|
|
|
uses: actions/setup-node@v4.0.4
|
2020-03-19 18:46:13 +01:00
|
|
|
with:
|
2021-10-27 18:16:13 +02:00
|
|
|
node-version: ${{ matrix.node-version }}
|
2023-01-15 22:08:42 +01:00
|
|
|
cache: 'pnpm'
|
2022-11-24 07:39:00 +01:00
|
|
|
- run: corepack enable
|
2023-01-15 22:08:42 +01:00
|
|
|
- run: pnpm i --frozen-lockfile
|
2021-10-27 18:16:13 +02:00
|
|
|
- name: Copy Configure
|
2021-11-12 04:43:55 +01:00
|
|
|
run: cp .github/misskey/test.yml .config
|
2021-10-27 18:16:13 +02:00
|
|
|
- name: Build
|
2023-01-15 22:08:42 +01:00
|
|
|
run: pnpm build
|
2022-01-21 08:43:56 +01: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 08:07:15 +01: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 08:43:56 +01:00
|
|
|
- name: Cypress run
|
2023-08-22 08:58:10 +02:00
|
|
|
uses: cypress-io/github-action@v6
|
2024-02-12 16:28:59 +01:00
|
|
|
timeout-minutes: 15
|
2022-01-21 08:43:56 +01:00
|
|
|
with:
|
|
|
|
install: false
|
2023-01-15 22:08:42 +01:00
|
|
|
start: pnpm start:test
|
2022-01-21 08:43:56 +01:00
|
|
|
wait-on: 'http://localhost:61812'
|
2023-04-19 09:42:14 +02:00
|
|
|
headed: true
|
2022-01-21 08:43:56 +01:00
|
|
|
browser: ${{ matrix.browser }}
|
2023-12-16 00:58:03 +01:00
|
|
|
- uses: actions/upload-artifact@v4
|
2022-01-21 08:43:56 +01:00
|
|
|
if: failure()
|
|
|
|
with:
|
|
|
|
name: ${{ matrix.browser }}-cypress-screenshots
|
|
|
|
path: cypress/screenshots
|
2023-12-16 00:58:03 +01:00
|
|
|
- uses: actions/upload-artifact@v4
|
2022-01-21 08:43:56 +01:00
|
|
|
if: always()
|
|
|
|
with:
|
|
|
|
name: ${{ matrix.browser }}-cypress-videos
|
|
|
|
path: cypress/videos
|