Files
GameServerManager/.github/workflows/ci.yml
2026-10-02 19:03:32 +08:00

107 lines
2.3 KiB
YAML

name: CI
on:
pull_request:
branches:
- main
types:
- opened
- synchronize
- reopened
- ready_for_review
push:
branches:
- main
workflow_dispatch:
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
env:
CI: true
NODE_VERSION: '22.16.0'
jobs:
server:
name: Server test and build
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: npm
cache-dependency-path: server/package-lock.json
- name: Install server dependencies
run: npm ci
working-directory: server
- name: Run server tests
run: npm test
working-directory: server
- name: Build server
run: npm run build
working-directory: server
client:
name: Client test and build
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: npm
cache-dependency-path: client/package-lock.json
- name: Install client dependencies
run: npm ci
working-directory: client
- name: Run client tests
run: npm test
working-directory: client
- name: Build client
run: npm run build
working-directory: client
project-scripts:
name: Project scripts
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: npm
cache-dependency-path: package-lock.json
- name: Install root dependencies
run: npm ci
- name: Check packaging scripts syntax
run: |
node --check scripts/package.js
node --check scripts/resolve-build-version.js
- name: Resolve build version
run: node scripts/resolve-build-version.js