# 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: jobs: test: runs-on: ubuntu-latest strategy: matrix: # Supported versions are active lts and maintenance see https://nodejs.org/en/about/releases/ node-version: [20.x, 22.x] # Supported versions are latest stable and one minor version before stable (even if from a previous major) factorio-version: [1.1.110, 2.0.47] 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.node-version != '20.x' || matrix.factorio-version != '1.1.110' }} run: pnpm test - name: Run coverage if: ${{ matrix.node-version == '20.x' && matrix.factorio-version == '1.1.110' }} run: pnpm run ci-cover - name : Upload coverage to Codecov if: ${{ matrix.node-version == '20.x' && matrix.factorio-version == '1.1.110' }} 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 lint: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: pnpm/action-setup@v4 - uses: actions/setup-node@v4 with: node-version: 20.x - run: pnpm i --no-frozen-lockfile - run: pnpm run lint build: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: pnpm/action-setup@v4 - uses: actions/setup-node@v4 with: node-version: 20.x - 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