2024-02-20 00:46:09 +03:00
|
|
|
name: Tests
|
2023-09-21 00:47:57 +03:00
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches: [ master ]
|
2023-11-12 01:34:35 +03:00
|
|
|
paths-ignore:
|
|
|
|
- '*.md' # ignore changes to readmes
|
2023-09-21 00:47:57 +03:00
|
|
|
pull_request:
|
|
|
|
branches: [ master ]
|
|
|
|
|
|
|
|
jobs:
|
2023-11-29 20:31:18 +03:00
|
|
|
lint:
|
2024-12-11 07:37:19 +03:00
|
|
|
runs-on: node22
|
2025-01-01 08:06:51 +03:00
|
|
|
if: github.actor != 'desu-bot' # do not run after release
|
2023-09-21 00:47:57 +03:00
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v4
|
2024-12-11 07:37:19 +03:00
|
|
|
- uses: ./.forgejo/actions/init
|
2025-01-01 08:06:51 +03:00
|
|
|
- uses: https://github.com/denoland/setup-deno@v1
|
|
|
|
with:
|
|
|
|
deno-version: '2.0'
|
2023-09-21 00:47:57 +03:00
|
|
|
- name: 'TypeScript'
|
2023-10-16 19:23:53 +03:00
|
|
|
run: pnpm run lint:tsc:ci
|
2023-09-21 00:47:57 +03:00
|
|
|
- name: 'ESLint'
|
2023-09-24 01:08:01 +03:00
|
|
|
run: pnpm run lint:ci
|
2023-10-09 05:59:48 +03:00
|
|
|
- name: 'Circular dependencies'
|
|
|
|
run: pnpm run lint:dpdm
|
2025-01-01 08:06:51 +03:00
|
|
|
- name: 'deno publish --dry-run'
|
|
|
|
run: pnpm exec fuman-build jsr gen-deno-workspace --with-dry-run
|
2023-11-29 20:31:18 +03:00
|
|
|
|
|
|
|
test-node:
|
|
|
|
strategy:
|
|
|
|
matrix:
|
2024-12-11 07:37:19 +03:00
|
|
|
node-version: [node18, node20, node22]
|
|
|
|
runs-on: ${{ matrix.node-version }}
|
2023-11-29 20:31:18 +03:00
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v4
|
2024-12-11 07:37:19 +03:00
|
|
|
- uses: ./.forgejo/actions/init
|
2023-11-29 20:31:18 +03:00
|
|
|
- name: 'Run tests'
|
|
|
|
run: pnpm run test:ci
|
2024-04-25 05:31:20 +03:00
|
|
|
|
2024-02-20 00:46:09 +03:00
|
|
|
test-bun:
|
2024-12-11 07:37:19 +03:00
|
|
|
runs-on: node22
|
2024-02-20 00:46:09 +03:00
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v4
|
2024-12-11 07:37:19 +03:00
|
|
|
- uses: ./.forgejo/actions/init
|
2024-04-25 05:31:20 +03:00
|
|
|
- uses: oven-sh/setup-bun@v1
|
|
|
|
with:
|
|
|
|
bun-version: '1.1.4'
|
2024-03-18 01:49:55 +03:00
|
|
|
- name: 'Build tests'
|
2024-08-12 09:19:45 +03:00
|
|
|
run: pnpm exec vite build -c .config/vite.bun.ts
|
2024-02-20 00:46:09 +03:00
|
|
|
- name: 'Run tests'
|
2024-03-18 01:49:55 +03:00
|
|
|
run: cd dist/tests && bun test
|
2023-11-29 20:31:18 +03:00
|
|
|
|
2024-04-25 05:31:20 +03:00
|
|
|
test-deno:
|
2024-12-11 07:37:19 +03:00
|
|
|
runs-on: node22
|
2024-04-25 05:31:20 +03:00
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v4
|
2024-12-11 07:37:19 +03:00
|
|
|
- uses: ./.forgejo/actions/init
|
|
|
|
- uses: https://github.com/denoland/setup-deno@v1
|
2024-04-25 05:31:20 +03:00
|
|
|
with:
|
2024-12-06 00:14:29 +03:00
|
|
|
deno-version: '2.0'
|
2024-04-25 05:31:20 +03:00
|
|
|
- name: 'Build tests'
|
2024-08-12 09:19:45 +03:00
|
|
|
run: pnpm exec vite build -c .config/vite.deno.ts
|
2024-04-25 05:31:20 +03:00
|
|
|
- name: 'Run tests'
|
2024-12-06 00:14:29 +03:00
|
|
|
run: cd dist/tests && deno test -A --unstable-ffi --node-modules-dir=false
|
2024-04-25 05:31:20 +03:00
|
|
|
|
2023-11-29 20:31:18 +03:00
|
|
|
test-web:
|
2024-12-11 07:37:19 +03:00
|
|
|
runs-on: docker
|
|
|
|
container: mcr.microsoft.com/playwright:v1.42.1
|
2023-11-29 20:31:18 +03:00
|
|
|
|
|
|
|
strategy:
|
|
|
|
matrix:
|
|
|
|
browser: [chromium, firefox]
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v4
|
2024-12-11 07:37:19 +03:00
|
|
|
- run: apt-get update && apt-get install -y make gcc g++
|
|
|
|
- uses: ./.forgejo/actions/init
|
2023-11-29 20:31:18 +03:00
|
|
|
- name: 'Run tests'
|
2023-12-02 19:24:35 +03:00
|
|
|
# i wish we didn't have to do this, but vitest in browser is very flaky
|
|
|
|
# see: https://github.com/vitest-dev/vitest/issues/4173
|
2024-12-11 07:37:19 +03:00
|
|
|
uses: https://github.com/nick-fields/retry@v2
|
2023-12-02 19:24:35 +03:00
|
|
|
with:
|
|
|
|
max_attempts: 3
|
|
|
|
timeout_minutes: 30
|
2024-12-11 07:37:19 +03:00
|
|
|
command: pnpm run test:browser --browser.name=${{ matrix.browser }}
|
|
|
|
|
2023-10-16 19:23:53 +03:00
|
|
|
e2e:
|
2024-12-11 07:37:19 +03:00
|
|
|
runs-on: node22
|
2024-04-25 06:04:00 +03:00
|
|
|
needs: [lint, test-node, test-web, test-bun, test-deno]
|
2024-04-13 06:59:12 +03:00
|
|
|
permissions:
|
|
|
|
contents: read
|
|
|
|
actions: write
|
2023-10-16 19:23:53 +03:00
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v4
|
2024-12-11 07:37:19 +03:00
|
|
|
- uses: ./.forgejo/actions/init
|
2023-10-16 19:23:53 +03:00
|
|
|
- name: Run end-to-end tests
|
|
|
|
env:
|
|
|
|
API_ID: ${{ secrets.TELEGRAM_API_ID }}
|
|
|
|
API_HASH: ${{ secrets.TELEGRAM_API_HASH }}
|
2024-12-06 00:14:29 +03:00
|
|
|
SESSION_DC1: ${{ secrets.SESSION_DC1 }}
|
|
|
|
SESSION_DC2: ${{ secrets.SESSION_DC2 }}
|
2024-04-13 07:44:59 +03:00
|
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
2024-12-06 00:14:29 +03:00
|
|
|
run: 'cd e2e && pnpm run test:all'
|
2024-12-02 08:42:18 +03:00
|
|
|
e2e-deno:
|
2024-12-11 07:37:19 +03:00
|
|
|
runs-on: node22
|
2025-01-27 18:32:35 +03:00
|
|
|
needs: [e2e]
|
2024-12-02 08:42:18 +03:00
|
|
|
permissions:
|
|
|
|
contents: read
|
|
|
|
actions: write
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v4
|
2024-12-11 07:37:19 +03:00
|
|
|
- uses: ./.forgejo/actions/init
|
|
|
|
- uses: https://github.com/denoland/setup-deno@v1
|
2024-12-06 00:14:29 +03:00
|
|
|
with:
|
|
|
|
deno-version: '2.0'
|
2024-12-02 08:42:18 +03:00
|
|
|
- name: Run end-to-end tests under Deno
|
|
|
|
env:
|
|
|
|
API_ID: ${{ secrets.TELEGRAM_API_ID }}
|
|
|
|
API_HASH: ${{ secrets.TELEGRAM_API_HASH }}
|
2024-12-06 00:14:29 +03:00
|
|
|
SESSION_DC1: ${{ secrets.SESSION_DC1 }}
|
|
|
|
SESSION_DC2: ${{ secrets.SESSION_DC2 }}
|
2024-12-02 08:42:18 +03:00
|
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
2024-12-11 07:37:19 +03:00
|
|
|
run: 'cd e2e && deno task test:all'
|