fix: update to dev.97, workspaces, simplify test run #31
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CI | |
| on: | |
| pull_request: | |
| branches: | |
| - main | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| lint: | |
| name: Lint | |
| defaults: | |
| run: | |
| working-directory: ${{ matrix.project }} | |
| strategy: | |
| matrix: | |
| project: | |
| - 'react-app' | |
| - 'rest-api-with-express' | |
| - 'rest-api-with-fastify' | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Use Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version-file: '.nvmrc' | |
| cache: 'npm' | |
| cache-dependency-path: ${{ matrix.project }}/package-lock.json | |
| - name: Install Dependencies | |
| run: npm ci | |
| - name: Run linters | |
| run: npm run lint | |
| test-ui: | |
| name: Test (UI) | |
| runs-on: ubuntu-latest | |
| defaults: | |
| run: | |
| working-directory: ${{ matrix.project }} | |
| strategy: | |
| matrix: | |
| browser: | |
| - 'chrome' | |
| project: | |
| - 'react-app' | |
| - 'rest-api-with-express' | |
| - 'rest-api-with-fastify' | |
| - 'html-web-page' | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version-file: '.nvmrc' | |
| cache: 'npm' | |
| cache-dependency-path: ${{ matrix.project }}/package-lock.json | |
| - name: Run Cypress | |
| uses: cypress-io/github-action@v6 | |
| if: matrix.project != 'react-app' | |
| with: | |
| working-directory: ${{ matrix.project }} | |
| build: npm run build -- --logLevel error | |
| browser: ${{ matrix.browser }} | |
| start: npm start | |
| - name: Run Cypress | |
| if: matrix.project == 'react-app' | |
| uses: cypress-io/github-action@v6 | |
| with: | |
| working-directory: ${{ matrix.project }} | |
| start: npm run serve | |
| browser: ${{ matrix.browser }} | |
| install: true | |
| - uses: actions/upload-artifact@master | |
| if: always() | |
| with: | |
| name: screenshots | |
| path: ${{ matrix.project }}/${{ matrix.project }}-cypress-report.xml | |
| - uses: actions/upload-artifact@master | |
| if: failure() | |
| with: | |
| name: screenshots | |
| path: ${{ matrix.project }}/cypress/screenshots | |
| - uses: actions/upload-artifact@master | |
| if: failure() | |
| with: | |
| name: videos | |
| path: ${{ matrix.project }}/cypress/videos | |
| test-unit: | |
| name: Test (Unit) | |
| runs-on: ubuntu-latest | |
| defaults: | |
| run: | |
| working-directory: ${{ matrix.project }} | |
| strategy: | |
| matrix: | |
| project: | |
| - 'rest-api-with-express' | |
| - 'rest-api-with-fastify' | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version-file: '.nvmrc' | |
| cache: 'npm' | |
| cache-dependency-path: ${{ matrix.project }}/package-lock.json | |
| - name: Install Dependencies | |
| run: npm ci | |
| - name: Run Unit Tests | |
| run: npm test -- --reporter=xunit --reporter-options output=${{matrix.project}}-unit-tests.xml | |
| - name: Upload Test Results | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: Test Results (${{matrix.project}}) | |
| path: ${{matrix.project}}/${{matrix.project}}-unit-tests.xml | |
| publish-test-results: | |
| name: "Publish Tests Results" | |
| needs: test-unit | |
| runs-on: ubuntu-latest | |
| permissions: | |
| checks: write | |
| pull-requests: write | |
| if: always() | |
| steps: | |
| - name: Download Artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: artifacts | |
| - name: Publish Test Results | |
| uses: EnricoMi/publish-unit-test-result-action@v2 | |
| with: | |
| files: "artifacts/**/*.xml" |