# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node # For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs name: Node.js CI on: push: branches: [ "main" ] pull_request: branches: [ "main" ] jobs: build: runs-on: ubuntu-latest strategy: matrix: node-version: [18.x, 20.x, 22.x] # See supported Node.js release schedule at https://nodejs.org/en/about/releases/ steps: - name: Test Summary uses: test-summary/action@v2 with: paths: "test/results/**/TEST-*.xml" output: test-summary.md if: always() - name: Use checkout repository uses: actions/checkout@v4 - name: Use Node.js ${{ matrix.node-version }} uses: actions/setup-node@v4 with: node-version: ${{ matrix.node-version }} cache: 'npm' - run: npm ci - run: npm run build --if-present - run: npm test - name: Output Build Status uses: actions/github-script@v6 with: github_token: ${{ secrets.GITHUB_TOKEN }} script: | const { context } = require('@actions/github'); const core = require('@actions/core'); const fs = require('fs'); const path = require('path'); const readline = require('readline'); const outputPath = path.join(process.env.GITHUB_WORKSPACE, 'README.md'); const fileStream = fs.createWriteStream(outputPath, { flags: 'a' }); const rl = readline.createInterface({ input: process.stdin, output: fileStream }); if (context.isFailureGroup) { core.setFailed('Build failed'); } else { rl.write('## Build Status\n'); rl.write('![Build Status](https://github.com/Ichitux/lambada-fiesta-live/workflows/Node.js%20CI/badge.svg)\n'); rl.close(); }