Merge pull request #123 from lost-university/dependabot/npm_and_yarn/… #452
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 | |
| push: | |
| branches: | |
| - main | |
| tags: | |
| - '*' | |
| jobs: | |
| lint: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Run ESLint | |
| run: npm run lint | |
| build: | |
| runs-on: ubuntu-latest | |
| needs: lint | |
| outputs: | |
| tags: ${{ steps.meta.outputs.tags }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Docker meta | |
| id: meta | |
| uses: docker/metadata-action@v5 | |
| with: | |
| images: | | |
| ghcr.io/${{ github.repository }} | |
| tags: | | |
| type=ref,event=branch | |
| type=ref,event=pr | |
| type=semver,pattern={{version}} | |
| type=semver,pattern={{major}}.{{minor}} | |
| type=sha,format=long | |
| - name: Setup buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Build Docker image | |
| uses: docker/build-push-action@v6 | |
| with: | |
| push: false | |
| tags: ${{ steps.meta.outputs.tags }} | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max | |
| test: | |
| needs: build | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| browser: [ chrome, firefox, edge ] | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Setup buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Build Docker image | |
| uses: docker/build-push-action@v6 | |
| with: | |
| push: false | |
| tags: ${{ needs.build.outputs.tags }} | |
| load: true | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max | |
| - name: Run Docker container | |
| env: | |
| REPOSITORY: '${{ github.repository }}' | |
| run: | | |
| docker run -d -p 5173:80 ghcr.io/${REPOSITORY,,}:sha-${{ github.sha }} | |
| - name: Setup Firefox | |
| if: matrix.browser == 'firefox' | |
| uses: browser-actions/setup-firefox@v1 | |
| with: | |
| firefox-version: "140.0" | |
| - name: Cypress run | |
| uses: cypress-io/github-action@v6 | |
| with: | |
| browser: ${{ matrix.browser }} | |
| wait-on: 'http://localhost:5173' | |
| component: true | |
| - name: Upload Cypress Screenshots | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: cypress-screenshots-${{ matrix.browser }} | |
| path: cypress/screenshots/ | |
| retention-days: 7 |