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