Added eslint for formatting #3
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: Node.js CI | |
| on: | |
| push: | |
| branches: [main,develop] # Trigger the workflow on every commit to the main and develop branch. | |
| pull_request: | |
| branches: [main,develop] # Trigger the workflow on pull requests targeting the main and develop branch | |
| env: | |
| node-version: 21.x | |
| working-directory: ./ | |
| jobs: | |
| format: | |
| name: Run linting & formatting | |
| runs-on: ubuntu-latest | |
| concurrency: | |
| group: '${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}' | |
| cancel-in-progress: true | |
| defaults: | |
| run: | |
| working-directory: ${{ env.working-directory }} | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| steps: | |
| - name: Checkout the Git repository | |
| uses: actions/checkout@v4 | |
| with: | |
| ref: ${{ github.head_ref }} | |
| - name: Use Node.js ${{ env.node-version }} | |
| uses: ./.github/actions/setup-node | |
| with: | |
| node-version: ${{ env.node-version }} | |
| - name: Install Node modules | |
| uses: ./.github/actions/install-node-modules | |
| - name: Format code | |
| uses: ./.github/actions/format-code | |
| test: | |
| name: Run type checking & tests | |
| needs: format | |
| runs-on: ubuntu-latest | |
| concurrency: | |
| group: "${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }} - ${{ matrix.node-version }}" | |
| cancel-in-progress: true | |
| strategy: | |
| matrix: | |
| node-version: [21x] | |
| steps: | |
| - name: Checkout the Git repository | |
| uses: actions/checkout@v4 | |
| - name: Use Node.js ${{ env.node-version }} | |
| uses: ./.github/actions/setup-node | |
| with: | |
| node-version: ${{ env.node-version }} | |
| - name: Install Node modules | |
| uses: ./.github/actions/install-node-modules | |
| - name: Run tests using the vitest framework | |
| uses: ./.github/actions/run-tests | |
| build: | |
| name: Builds the app | |
| needs: test | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| node-version: [21.x] | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 # Step 1: Check out the source code from the repository. | |
| - name: Use Node.js ${{ env.node-version }} | |
| uses: ./.github/actions/setup-node | |
| with: | |
| node-version: ${{ env.node-version }} | |
| - name: Install Node.js dependencies | |
| uses: ./.github/actions/install-node-modules # Step 3: Perform a clean install of Node.js dependencies. | |
| - name: Build App | |
| uses: ./.github/actions/build-app |