mirror of
https://github.com/Ride-The-Lightning/RTL.git
synced 2026-08-13 12:33:07 +02:00
108 lines
2.7 KiB
YAML
108 lines
2.7 KiB
YAML
name: Lint & Test
|
|
|
|
on:
|
|
push:
|
|
tags: [ 'v*' ]
|
|
release:
|
|
types: [released]
|
|
# Triggers the workflow only when merging pull request to the branches.
|
|
pull_request:
|
|
types: [closed]
|
|
branches: [ master, 'Release-*' ]
|
|
# Allows you to run this workflow manually from the Actions tab
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
prepare:
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
node-version:
|
|
- '18.x'
|
|
- '20.x'
|
|
- '22.x'
|
|
- '24.x'
|
|
steps:
|
|
- name: Checkout source code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Setup Node
|
|
uses: actions/setup-node@v3
|
|
with:
|
|
node-version: ${{ matrix.node-version }}
|
|
|
|
- name: Cache node_modules
|
|
uses: actions/cache@v4
|
|
id: cache-npm-packages
|
|
with:
|
|
path: node_modules
|
|
key: ${{ runner.OS }}-${{ matrix.node-version }}-build-${{ hashFiles('**/package-lock.json') }}
|
|
|
|
- name: Install NPM dependencies
|
|
if: steps.cache-npm-packages.outputs.cache-hit != 'true'
|
|
run: npm ci --legacy-peer-deps
|
|
|
|
lint:
|
|
name: Lint
|
|
runs-on: ubuntu-latest
|
|
needs: prepare
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
node-version:
|
|
- '18.x'
|
|
- '20.x'
|
|
- '22.x'
|
|
- '24.x'
|
|
steps:
|
|
- name: Checkout source code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Setup Node
|
|
uses: actions/setup-node@v3
|
|
with:
|
|
node-version: ${{ matrix.node-version }}
|
|
|
|
- name: Cache node_modules
|
|
uses: actions/cache@v4
|
|
id: cache-npm-packages
|
|
with:
|
|
path: node_modules
|
|
key: ${{ runner.OS }}-${{ matrix.node-version }}-build-${{ hashFiles('**/package-lock.json') }}
|
|
|
|
- name: Install NPM dependencies
|
|
if: steps.cache-npm-packages.outputs.cache-hit != 'true'
|
|
run: npm ci --legacy-peer-deps
|
|
|
|
- name: Lint Src and Server
|
|
run: npm run lint
|
|
|
|
test:
|
|
name: Test
|
|
runs-on: ubuntu-latest
|
|
needs: prepare
|
|
env:
|
|
CI: true
|
|
steps:
|
|
- name: Checkout source code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Setup Node
|
|
uses: actions/setup-node@v3
|
|
with:
|
|
node-version: ${{ matrix.node-version }}
|
|
|
|
- name: Cache node_modules
|
|
uses: actions/cache@v4
|
|
id: cache-npm-packages
|
|
with:
|
|
path: node_modules
|
|
key: ${{ runner.OS }}-${{ matrix.node-version }}-build-${{ hashFiles('**/package-lock.json') }}
|
|
|
|
- name: Install NPM dependencies
|
|
if: steps.cache-npm-packages.outputs.cache-hit != 'true'
|
|
run: npm ci --legacy-peer-deps
|
|
|
|
- name: Run tests
|
|
run: npm run test
|