mtcute/.github/workflows/test.yaml

72 lines
1.8 KiB
YAML
Raw Normal View History

2023-09-21 00:47:57 +03:00
name: Node.js CI
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:
2023-09-21 00:47:57 +03:00
runs-on: ubuntu-latest
2023-11-12 01:34:35 +03:00
if: github.actor != 'mtcute-bot' # do not run after release
2023-09-21 00:47:57 +03:00
steps:
- uses: actions/checkout@v4
2023-11-29 20:31:18 +03:00
- uses: ./.github/actions/init
2023-09-21 00:47:57 +03:00
- name: 'TypeScript'
run: pnpm run lint:tsc:ci
2023-09-21 00:47:57 +03:00
- name: 'ESLint'
run: pnpm run lint:ci
- name: 'Circular dependencies'
run: pnpm run lint:dpdm
2023-11-29 20:31:18 +03:00
test-node:
runs-on: ubuntu-latest
needs: lint
strategy:
matrix:
node-version: [18.x, 20.x]
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/init
with:
node-version: ${{ matrix.node-version }}
- name: 'Run tests'
run: pnpm run test:ci
2023-11-12 01:34:35 +03:00
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3
if: ${{ matrix.node-version == '18.x' }} # to avoid uploading twice
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
with:
files: ./coverage/coverage-final.json
2023-11-29 20:31:18 +03:00
test-web:
runs-on: ubuntu-latest
needs: lint
strategy:
matrix:
browser: [chromium, firefox]
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/init
- name: 'Initialize browser'
run: pnpm exec playwright install --with-deps ${{ matrix.browser }}
- name: 'Run tests'
run: pnpm run test:browser --browser.name=${{ matrix.browser }}
e2e:
runs-on: ubuntu-latest
2023-11-29 20:31:18 +03:00
needs: [test-node, test-web]
steps:
- uses: actions/checkout@v4
- name: Run end-to-end tests
env:
API_ID: ${{ secrets.TELEGRAM_API_ID }}
API_HASH: ${{ secrets.TELEGRAM_API_HASH }}
run: cd e2e && ./cli.sh ci