131 lines
4.2 KiB
YAML
131 lines
4.2 KiB
YAML
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
|
|
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
|
|
|
|
name: Auto Test
|
|
|
|
on:
|
|
push:
|
|
branches: [ master, 1.23.X ]
|
|
paths-ignore:
|
|
- '*.md'
|
|
pull_request:
|
|
branches: [ master, 1.23.X ]
|
|
paths-ignore:
|
|
- '*.md'
|
|
|
|
jobs:
|
|
auto-test:
|
|
needs: [ e2e-test ]
|
|
runs-on: ${{ matrix.os }}
|
|
timeout-minutes: 15
|
|
|
|
strategy:
|
|
matrix:
|
|
os: [macos-latest, ubuntu-22.04, windows-latest, ARM64]
|
|
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
|
|
node: [ 20, 24 ]
|
|
# Also test non-LTS, but only on Ubuntu.
|
|
include:
|
|
- os: ubuntu-22.04
|
|
node: 25
|
|
|
|
steps:
|
|
- run: git config --global core.autocrlf false # Mainly for Windows
|
|
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
|
|
|
|
- name: Cache/Restore node_modules
|
|
uses: actions/cache@9255dc7a253b0ccc959486e2bca901246202afeb # v5.0.1
|
|
id: node-modules-cache
|
|
with:
|
|
path: node_modules
|
|
key: node-modules-${{ runner.os }}-${{ hashFiles('**/package-lock.json') }}
|
|
|
|
- name: Use Node.js ${{ matrix.node }}
|
|
uses: actions/setup-node@395ad3262231945c25e8478fd5baf05154b1d79f # v6.1.0
|
|
with:
|
|
node-version: ${{ matrix.node }}
|
|
- run: npm install
|
|
- run: npm run build
|
|
- run: npm run test-backend
|
|
env:
|
|
HEADLESS_TEST: 1
|
|
JUST_FOR_TEST: ${{ secrets.JUST_FOR_TEST }}
|
|
|
|
# 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: [ e2e-test ]
|
|
runs-on: ${{ matrix.os }}
|
|
timeout-minutes: 15
|
|
if: ${{ github.repository == 'louislam/uptime-kuma' }}
|
|
strategy:
|
|
matrix:
|
|
os: [ ARMv7 ]
|
|
node: [ 20, 22 ]
|
|
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
|
|
|
|
steps:
|
|
- run: git config --global core.autocrlf false # Mainly for Windows
|
|
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
|
|
|
|
- name: Cache/Restore node_modules
|
|
uses: actions/cache@9255dc7a253b0ccc959486e2bca901246202afeb # v5.0.1
|
|
id: node-modules-cache
|
|
with:
|
|
path: node_modules
|
|
key: node-modules-${{ runner.os }}-${{ hashFiles('**/package-lock.json') }}
|
|
|
|
- name: Use Node.js ${{ matrix.node }}
|
|
uses: actions/setup-node@395ad3262231945c25e8478fd5baf05154b1d79f # v6.1.0
|
|
with:
|
|
node-version: ${{ matrix.node }}
|
|
- run: npm install --production
|
|
|
|
check-linters:
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- run: git config --global core.autocrlf false # Mainly for Windows
|
|
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
|
|
|
|
- name: Cache/Restore node_modules
|
|
uses: actions/cache@9255dc7a253b0ccc959486e2bca901246202afeb # v5.0.1
|
|
id: node-modules-cache
|
|
with:
|
|
path: node_modules
|
|
key: node-modules-${{ runner.os }}-${{ hashFiles('**/package-lock.json') }}
|
|
|
|
- name: Use Node.js 20
|
|
uses: actions/setup-node@395ad3262231945c25e8478fd5baf05154b1d79f # v6.1.0
|
|
with:
|
|
node-version: 20
|
|
- run: npm install
|
|
- run: npm run lint:prod
|
|
|
|
e2e-test:
|
|
needs: [ check-linters ]
|
|
runs-on: ARM64
|
|
env:
|
|
PLAYWRIGHT_VERSION: ~1.39.0
|
|
steps:
|
|
- run: git config --global core.autocrlf false # Mainly for Windows
|
|
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
|
|
|
|
- name: Cache/Restore node_modules
|
|
uses: actions/cache@9255dc7a253b0ccc959486e2bca901246202afeb # v5.0.1
|
|
id: node-modules-cache
|
|
with:
|
|
path: node_modules
|
|
key: node-modules-${{ runner.os }}-${{ hashFiles('**/package-lock.json') }}
|
|
|
|
- name: Setup Node.js
|
|
uses: actions/setup-node@395ad3262231945c25e8478fd5baf05154b1d79f # v6.1.0
|
|
with:
|
|
node-version: 22
|
|
- run: npm install
|
|
|
|
- name: Install Playwright ${{ env.PLAYWRIGHT_VERSION }}
|
|
run: npx playwright@${{ env.PLAYWRIGHT_VERSION }} install
|
|
|
|
- run: npm run build
|
|
- run: npm run test-e2e
|