chore(deps-dev): bump @eslint/eslintrc from 3.3.1 to 3.3.3 #3190
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: Validate | |
| on: | |
| pull_request: | |
| branches: [main] | |
| push: | |
| branches: [main] | |
| permissions: | |
| contents: read | |
| statuses: write | |
| env: | |
| DOCKER_APP_IMAGE_NAME: 'ghcr.io/hasadna/open-bus-map-search/open-bus-map-search' | |
| DOCKER_APP_IMAGE_TAG: 'latest' | |
| APPLITOOLS_API_KEY: ${{ secrets.APPLITOOLS_API_KEY }} | |
| APPLITOOLS_BATCH_ID: ${{ github.event.pull_request.head.sha }} | |
| APPLITOOLS_LOG_DIR: ./logs | |
| APPLITOOLS_SHOW_LOGS: true | |
| jobs: | |
| local-tests: | |
| name: Local Tests | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: latest | |
| cache: 'npm' | |
| - name: Check for yarn.json | |
| run: | | |
| if [ -f yarn.json ]; then | |
| echo "::error file=yarn.json::yarn.json is being added" | |
| exit 1 | |
| fi | |
| - name: Ensure package-lock.json exists | |
| run: | | |
| if [ ! -f package-lock.json ]; then | |
| echo "::error file=package-lock.json::package-lock.json is being removed" | |
| exit 1 | |
| fi | |
| - name: Validate package-lock.json is updated | |
| run: | | |
| if ! npm ci; then | |
| echo "::error file=package-lock.json::package-lock.json is not updated" | |
| exit 1 | |
| fi | |
| - name: Run linter | |
| run: npm run lint | |
| - name: Check for circular dependencies | |
| run: npx madge --extensions js,ts --circular . | |
| build: | |
| name: Docker Build | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Generate hash.txt with commit hash | |
| run: echo "$(git rev-parse --short HEAD)" >> public/hash.txt | |
| - name: Setup Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Build and export Docker image | |
| uses: docker/build-push-action@v6 | |
| with: | |
| context: . | |
| tags: ${{ env.DOCKER_APP_IMAGE_NAME }}:${{ env.DOCKER_APP_IMAGE_TAG }} | |
| outputs: type=docker, dest=/tmp/docker-image.tar | |
| - name: Upload Docker image artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: docker-image | |
| path: /tmp/docker-image.tar | |
| build-outside-docker: | |
| name: Node.js Build | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: latest | |
| cache: 'npm' | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Build application | |
| run: npm run build | |
| - name: Build Storybook | |
| run: npm run build-storybook | |
| test: | |
| name: Application & Playwright Tests | |
| runs-on: ubuntu-latest | |
| needs: [build, build-outside-docker] | |
| steps: | |
| - name: Set timezone | |
| run: echo "TZ=Asia/Jerusalem" >> $GITHUB_ENV | |
| - name: Download Docker image artifact | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: docker-image | |
| path: /tmp | |
| - name: Load Docker image | |
| run: docker load -i /tmp/docker-image.tar | |
| - name: Start application container | |
| run: docker run -d -p 3000:80 ${{ env.DOCKER_APP_IMAGE_NAME }}:${{ env.DOCKER_APP_IMAGE_TAG }} | |
| - uses: actions/checkout@v4 | |
| with: | |
| ref: ${{ github.event.pull_request.head.sha }} | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: latest | |
| cache: 'npm' | |
| - name: Validate hash.txt endpoint | |
| run: | | |
| response=$(curl -s -w "%{http_code}" -o /tmp/hash.txt http://localhost:3000/hash.txt) | |
| http_code=${response: -3} | |
| if [ "$http_code" -ne 200 ]; then | |
| echo "Error: HTTP request failed with status code $http_code" | |
| exit 1 | |
| fi | |
| mime_type=$(file --mime-type -b /tmp/hash.txt) | |
| if [ "$mime_type" != "text/plain" ]; then | |
| echo "Error: hash.txt does not have MIME type text/plain. Found: $mime_type" | |
| exit 1 | |
| fi | |
| content_length=$(wc -c < /tmp/hash.txt | xargs) | |
| if [ "$content_length" -ge 100 ]; then | |
| echo "Error: hash.txt content exceeds 100 characters. Length: $content_length" | |
| exit 1 | |
| fi | |
| echo "hash.txt is valid with MIME type $mime_type and length $content_length characters." | |
| - name: Install Dependencies and Playwright | |
| run: npm ci | |
| - run: npx playwright install chromium | |
| - name: Run Playwright tests | |
| run: npm test | |
| - name: Prepare Playwright artifact directory | |
| if: always() | |
| run: | | |
| mkdir -p playwright-artifact | |
| if [ -d test-results ]; then cp -r test-results/* playwright-artifact/; fi | |
| if [ -d playwright-report ]; then cp -r playwright-report/* playwright-artifact/; fi | |
| touch playwright-artifact/.keep | |
| - name: Upload Playwright test artifact | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: playwright-test | |
| path: playwright-artifact | |
| - name: Upload logs if exists | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: logs-test | |
| path: logs | |
| if-no-files-found: warn | |
| storybook-test: | |
| name: Storybook Visual Tests | |
| runs-on: ubuntu-22.04 # not working whit ubuntu 23+ | |
| needs: [build, build-outside-docker] | |
| steps: | |
| - name: Prepare for Testing | |
| run: | | |
| echo "127.0.0.1 openstreetmap.org" | sudo tee -a /etc/hosts | |
| echo "127.0.0.1 tile-a.openstreetmap.fr" | sudo tee -a /etc/hosts | |
| echo "SHORT_SHA=$(echo ${{ github.event.pull_request.head.sha }} | cut -c1-7)" >> $GITHUB_ENV | |
| - name: Download Docker image artifact | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: docker-image | |
| path: /tmp | |
| - name: Load Docker image | |
| run: docker load -i /tmp/docker-image.tar | |
| - name: Start application container | |
| run: docker run -d -p 3000:80 ${{ env.DOCKER_APP_IMAGE_NAME }}:${{ env.DOCKER_APP_IMAGE_TAG }} | |
| - uses: actions/checkout@v4 | |
| with: | |
| ref: ${{ github.event.pull_request.head.sha }} | |
| - run: export APPLITOOLS_SHOW_LOGS=true && export APPLITOOLS_LOG_DIR=./logs | |
| - run: npm i -g @applitools/eyes-storybook | |
| - name: Run Storybook visual tests | |
| if: env.APPLITOOLS_API_KEY | |
| env: | |
| APPLITOOLS_BATCH_NAME: open-bus-map-search/${{ github.ref }}/${{ env.SHORT_SHA }}/storybook | |
| run: npm run test:storybook -- --storybook-url http://localhost:3000/storybook/index.html | |
| - name: Upload logs if exists | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: logs-storybook-test | |
| path: logs | |
| if-no-files-found: warn | |
| visual-test: | |
| name: Playwright Visual Tests | |
| runs-on: ubuntu-latest | |
| needs: [build, build-outside-docker] | |
| steps: | |
| - name: Prepare for Testing | |
| run: | | |
| echo "127.0.0.1 openstreetmap.org" | sudo tee -a /etc/hosts | |
| echo "127.0.0.1 tile-a.openstreetmap.fr" | sudo tee -a /etc/hosts | |
| echo "SHORT_SHA=$(echo ${{ github.event.pull_request.head.sha }} | cut -c1-7)" >> $GITHUB_ENV | |
| - uses: actions/checkout@v4 | |
| with: | |
| ref: ${{ github.event.pull_request.head.sha }} | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: latest | |
| cache: 'npm' | |
| - name: Install Dependencies and Playwright | |
| run: npm ci | |
| - run: npx playwright install chromium | |
| - name: Run Playwright Visual Tests | |
| env: | |
| APPLITOOLS_BATCH_NAME: open-bus-map-search/${{ github.ref }}/${{ env.SHORT_SHA }}/ | |
| run: npm run test:e2e:visual | |
| - name: Prepare Playwright artifact directory | |
| if: always() | |
| run: | | |
| mkdir -p playwright-artifact | |
| if [ -d test-results ]; then cp -r test-results/* playwright-artifact/; fi | |
| if [ -d playwright-report ]; then cp -r playwright-report/* playwright-artifact/; fi | |
| touch playwright-artifact/.keep | |
| - name: Upload Playwright test artifact | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: playwright-visual-test | |
| path: playwright-artifact | |
| - name: Upload logs if exists | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: logs-visual-test | |
| path: logs | |
| if-no-files-found: warn | |
| publish-test-results: | |
| name: Publish Test Results | |
| runs-on: ubuntu-latest | |
| needs: [test] | |
| if: always() && github.event.repository.fork == false && github.actor != 'dependabot[bot]' | |
| env: | |
| AWS_KEY_ID: ${{ secrets.AWS_KEY_ID }} | |
| steps: | |
| - name: Download Playwright test artifact | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: playwright-test | |
| path: test-results | |
| - name: Publish test results to S3 | |
| uses: shallwefootball/s3-upload-action@master | |
| if: always() && ${{ env.AWS_KEY_ID }} | |
| id: s3-trace | |
| continue-on-error: true | |
| with: | |
| aws_key_id: ${{env.AWS_KEY_ID}} | |
| aws_secret_access_key: ${{ secrets.AWS_SECRET_ACCESS_KEY}} | |
| aws_bucket: noam-gaash.co.il | |
| source_dir: test-results | |
| destination_dir: ${{ github.run_id }}/open-bus/${{ github.event.pull_request.head.sha }}/test-results | |
| - name: Set commit status for test results | |
| uses: myrotvorets/set-commit-status-action@master | |
| if: always() && ${{ env.AWS_KEY_ID }} | |
| with: | |
| sha: ${{ github.event.pull_request.head.sha }} | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| description: 'Playwright html report with traces' | |
| status: ${{needs.test.result}} | |
| context: 'Test results (click to see!)' | |
| targetUrl: 'https://s3.amazonaws.com/noam-gaash.co.il/${{ github.run_id }}/open-bus/${{ github.event.pull_request.head.sha }}/test-results/index.html' | |
| close-visual-batches: | |
| name: Close Applitools Visual Test Batches | |
| runs-on: ubuntu-latest | |
| needs: [visual-test, storybook-test] | |
| if: always() && github.event.repository.fork == false && github.actor != 'dependabot[bot]' | |
| steps: | |
| - name: Close Applitools batches | |
| run: | | |
| export APPLITOOLS_SERVER_URL=https://eyesapi.applitools.com | |
| curl -v -X DELETE "$APPLITOOLS_SERVER_URL/api/sessions/batches/$APPLITOOLS_BATCH_ID/close/bypointerid?apiKey=$APPLITOOLS_API_KEY" | |
| all-passed: | |
| name: All Jobs Passed | |
| runs-on: ubuntu-latest | |
| needs: [test, visual-test, storybook-test] | |
| steps: | |
| - name: All jobs passed | |
| run: echo "All passed" |