uptime-kuma/.github/workflows/auto-test.yml

125 lines
2.7 KiB
YAML
Raw Normal View History

2021-10-05 20:32:48 +08:00
name: Auto Test
on:
push:
2023-10-09 07:23:30 +08:00
branches: [ master, 1.23.X ]
paths-ignore:
- '*.md'
2021-10-05 20:32:48 +08:00
pull_request:
2023-10-09 07:23:30 +08:00
branches: [ master, 1.23.X ]
paths-ignore:
- '*.md'
2021-10-05 20:32:48 +08:00
jobs:
2024-11-21 15:47:08 +05:00
check-linters:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Use Node.js 20
uses: actions/setup-node@v4
with:
node-version: 20
cache: 'npm'
- run: npm install
- run: npm run lint:prod
test:
needs: [ check-linters ]
runs-on: ${{ matrix.os }}
timeout-minutes: 15
2021-10-05 20:32:48 +08:00
strategy:
matrix:
2023-06-28 21:04:38 +08:00
os: [macos-latest, ubuntu-latest, windows-latest, ARM64]
node: [ 18, 20 ]
2021-10-05 20:32:48 +08:00
steps:
- uses: actions/checkout@v4
2021-10-05 20:32:48 +08:00
2022-04-26 02:03:47 +02:00
- name: Use Node.js ${{ matrix.node }}
uses: actions/setup-node@v4
2021-10-05 20:32:48 +08:00
with:
2022-04-26 02:03:47 +02:00
node-version: ${{ matrix.node }}
2024-11-21 15:47:08 +05:00
cache: 'npm'
- name: Install dependencies
run: npm install
- name: Build project
run: npm run build
- name: Run backend tests
run: npm run test-backend
2021-10-05 20:42:15 +08:00
env:
HEADLESS_TEST: 1
2021-10-05 21:15:30 +08:00
JUST_FOR_TEST: ${{ secrets.JUST_FOR_TEST }}
2024-11-21 15:47:08 +05:00
- name: Run component tests
run: npm run test-component
- name: Upload test results
if: always()
uses: actions/upload-artifact@v3
with:
name: test-results-${{ matrix.os }}-node-${{ matrix.node }}
path: |
./test-results
./coverage
retention-days: 30
2023-06-28 21:04:38 +08:00
# As a lot of dev dependencies are not supported on ARMv7, we have to test it separately and just test if `npm ci --production` works
armv7-simple-test:
needs: [ ]
2023-06-28 21:04:38 +08:00
runs-on: ${{ matrix.os }}
timeout-minutes: 15
if: ${{ github.repository == 'louislam/uptime-kuma' }}
2023-06-28 21:04:38 +08:00
strategy:
matrix:
os: [ ARMv7 ]
node: [ 18, 20 ]
2023-06-28 21:04:38 +08:00
steps:
- uses: actions/checkout@v4
2023-06-28 21:04:38 +08:00
- name: Use Node.js ${{ matrix.node }}
uses: actions/setup-node@v4
2023-06-28 21:04:38 +08:00
with:
node-version: ${{ matrix.node }}
2024-11-21 15:47:08 +05:00
cache: 'npm'
2023-06-28 21:04:38 +08:00
- run: npm ci --production
2024-11-21 15:47:08 +05:00
e2e-test:
needs: [ check-linters ]
runs-on: ARM64
timeout-minutes: 30
2022-04-26 01:57:49 +02:00
steps:
- uses: actions/checkout@v4
2022-04-26 01:57:49 +02:00
- name: Use Node.js 20
uses: actions/setup-node@v4
2022-04-26 01:57:49 +02:00
with:
node-version: 20
2024-11-21 15:47:08 +05:00
cache: 'npm'
- name: Install dependencies
run: npm install
2022-06-16 11:28:17 +02:00
- name: Install Playwright browsers
run: npx playwright install --with-deps chromium firefox
2023-01-10 08:24:15 +01:00
2024-11-21 15:47:08 +05:00
- name: Build project
run: npm run build
- name: Run E2E tests
run: npm run test-e2e
env:
HEADLESS_TEST: 1
- name: Upload Playwright report
if: always()
uses: actions/upload-artifact@v3
2023-01-10 08:24:15 +01:00
with:
2024-11-21 15:47:08 +05:00
name: playwright-report
path: ./private/playwright-report
retention-days: 30