mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-11 23:04:52 +09:00
We now only perform one test on the oldest node version. In addition, timeout values were added and some other small tidy ups.
126 lines
3.9 KiB
YAML
126 lines
3.9 KiB
YAML
# This workflow will do a clean install of node dependencies, cache/restore them, 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: Node.js CI
|
|
|
|
on:
|
|
push:
|
|
pull_request:
|
|
|
|
env:
|
|
NODE_VERSION: 24.x
|
|
|
|
jobs:
|
|
test:
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 15
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
# Supported node versions are active lts and maintenance see https://nodejs.org/en/about/releases/
|
|
node-version: [24.x]
|
|
|
|
# Supported factorio versions are latest stable and one minor version before stable (even if from a previous major)
|
|
factorio-version: [1.1.110, 2.0.77, 2.1.8]
|
|
|
|
# Coverage is performed on the older of the supported node versions
|
|
include:
|
|
- node-version: 22.x
|
|
factorio-version: 2.1.8
|
|
coverage: true
|
|
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: pnpm/action-setup@v4
|
|
- name: Use Node.js ${{ matrix.node-version }}
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: ${{ matrix.node-version }}
|
|
- name: Prepare and install
|
|
run: pnpm i --no-frozen-lockfile
|
|
- name: Use Factorio ${{ matrix.factorio-version }}
|
|
run: wget -q -O factorio.tar.gz https://www.factorio.com/get-download/${{ matrix.factorio-version }}/headless/linux64 && tar -xf factorio.tar.gz && rm factorio.tar.gz
|
|
- name: Run tests
|
|
if: ${{ !matrix.coverage }}
|
|
run: pnpm test
|
|
- name: Run coverage
|
|
if: ${{ matrix.coverage }}
|
|
run: pnpm run ci-cover
|
|
- name: Upload coverage to Codecov
|
|
if: ${{ matrix.coverage }}
|
|
uses: codecov/codecov-action@v4
|
|
with:
|
|
files: ./coverage/lcov.info
|
|
token: ${{ secrets.CODECOV_TOKEN }}
|
|
- name: Upload test logs for debugging
|
|
if: ${{ !cancelled() }}
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: logs-${{ matrix.node-version }}-${{ matrix.factorio-version }}
|
|
path: temp/test/logs
|
|
|
|
version-compat:
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 15
|
|
env:
|
|
# npm version spec for the published side of the compatibility test.
|
|
# If each release is compatible with the one before it then testing
|
|
# against the latest release transitively covers older versions too.
|
|
PUBLISHED_VERSION: latest
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
include:
|
|
- controller: local
|
|
host: published
|
|
- controller: published
|
|
host: local
|
|
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: pnpm/action-setup@v4
|
|
- uses: actions/setup-node@v4
|
|
with:
|
|
node-version: ${{ env.NODE_VERSION }}
|
|
- name: Prepare and install
|
|
run: pnpm i --no-frozen-lockfile
|
|
- name: Build
|
|
run: pnpm run build
|
|
- name: Test ${{ matrix.controller }} controller with ${{ matrix.host }} host
|
|
run: >
|
|
node scripts/version-compat-test.js
|
|
--controller ${{ matrix.controller }}
|
|
--host ${{ matrix.host }}
|
|
--published-version $PUBLISHED_VERSION
|
|
|
|
lint:
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 5
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: pnpm/action-setup@v4
|
|
- uses: actions/setup-node@v4
|
|
with:
|
|
node-version: ${{ env.NODE_VERSION }}
|
|
- run: pnpm i --no-frozen-lockfile
|
|
- run: pnpm run lint
|
|
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 5
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: pnpm/action-setup@v4
|
|
- uses: actions/setup-node@v4
|
|
with:
|
|
node-version: ${{ env.NODE_VERSION }}
|
|
- run: pnpm i --no-frozen-lockfile
|
|
- run: pnpm run build-mod
|
|
# Upload build to artifacts
|
|
- name: Upload build to artifacts
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: clusterio_lib
|
|
path: ./dist
|
|
if-no-files-found: error
|