mirror of
https://github.com/GSManagerXZ/GameServerManager.git
synced 2026-10-24 00:02:55 +08:00
ci: add pull request validation workflow
This commit is contained in:
24
.github/workflows/build.yml
vendored
24
.github/workflows/build.yml
vendored
@@ -80,12 +80,16 @@ jobs:
|
||||
with:
|
||||
node-version: '22.16.0'
|
||||
cache: 'npm'
|
||||
cache-dependency-path: |
|
||||
package-lock.json
|
||||
client/package-lock.json
|
||||
server/package-lock.json
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
npm install
|
||||
cd client && npm install
|
||||
cd ../server && npm install
|
||||
npm ci
|
||||
npm ci --prefix client
|
||||
npm ci --prefix server
|
||||
- name: Build Linux ${{ matrix.arch }} package
|
||||
run: ${{ matrix.package_command }}
|
||||
env:
|
||||
@@ -111,15 +115,15 @@ jobs:
|
||||
with:
|
||||
node-version: '22.16.0'
|
||||
cache: 'npm'
|
||||
cache-dependency-path: |
|
||||
package-lock.json
|
||||
client/package-lock.json
|
||||
server/package-lock.json
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
npm install
|
||||
cd client
|
||||
npm install
|
||||
cd ..
|
||||
cd server
|
||||
npm install
|
||||
cd ..
|
||||
npm ci
|
||||
npm ci --prefix client
|
||||
npm ci --prefix server
|
||||
- name: Build package
|
||||
run: npm run package:windows
|
||||
env:
|
||||
|
||||
106
.github/workflows/ci.yml
vendored
Normal file
106
.github/workflows/ci.yml
vendored
Normal file
@@ -0,0 +1,106 @@
|
||||
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
|
||||
Reference in New Issue
Block a user