mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-11 15:04:52 +09:00
Add a minimal AGENTS.md, update documentation and optimize the CI runs to not run actions for which there are no changes present
131 lines
4.1 KiB
YAML
131 lines
4.1 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:
|
|
changes:
|
|
uses: ./.github/workflows/ci-changes.yml
|
|
|
|
test:
|
|
needs: changes
|
|
if: ${{ !cancelled() && needs.changes.outputs.build_and_test != 'false' }}
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 15
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
# Test Node.js 24 and 26 across the Factorio matrix; Node.js 22 runs coverage below.
|
|
# Node.js release schedule: https://nodejs.org/en/about/releases/
|
|
node-version: [24.x, 26.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.17]
|
|
|
|
# Coverage is performed on the older of the supported node versions
|
|
include:
|
|
- node-version: 22.x
|
|
factorio-version: 2.1.17
|
|
coverage: true
|
|
|
|
steps:
|
|
- uses: actions/checkout@v7
|
|
- name: Prepare and install
|
|
uses: ./.github/actions/pnpm-install
|
|
with:
|
|
node-version: ${{ matrix.node-version }}
|
|
- 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@v7
|
|
with:
|
|
files: ./coverage/lcov.info
|
|
token: ${{ secrets.CODECOV_TOKEN }}
|
|
- name: Upload test logs for debugging
|
|
if: ${{ !cancelled() }}
|
|
uses: actions/upload-artifact@v7
|
|
with:
|
|
name: logs-${{ matrix.node-version }}-${{ matrix.factorio-version }}
|
|
path: temp/test/logs
|
|
|
|
version-compat:
|
|
needs: changes
|
|
if: ${{ !cancelled() && needs.changes.outputs.build_and_test != 'false' }}
|
|
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@v7
|
|
- name: Prepare and install
|
|
uses: ./.github/actions/pnpm-install
|
|
with:
|
|
node-version: ${{ env.NODE_VERSION }}
|
|
- 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:
|
|
needs: changes
|
|
if: ${{ !cancelled() && needs.changes.outputs.js_lint != 'false' }}
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 5
|
|
steps:
|
|
- uses: actions/checkout@v7
|
|
- uses: ./.github/actions/pnpm-install
|
|
with:
|
|
node-version: ${{ env.NODE_VERSION }}
|
|
ignore-scripts: true
|
|
- run: pnpm run lint
|
|
|
|
build:
|
|
needs: changes
|
|
if: ${{ !cancelled() && needs.changes.outputs.build_and_test != 'false' }}
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 5
|
|
steps:
|
|
- uses: actions/checkout@v7
|
|
- uses: ./.github/actions/pnpm-install
|
|
with:
|
|
node-version: ${{ env.NODE_VERSION }}
|
|
ignore-scripts: true
|
|
- run: pnpm run build-mod
|
|
# Upload build to artifacts
|
|
- name: Upload build to artifacts
|
|
uses: actions/upload-artifact@v7
|
|
with:
|
|
name: clusterio_lib
|
|
path: ./dist
|
|
if-no-files-found: error
|