Skip billed Google Geolocation API call when browser location is out of bounds #1143
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
| # This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node | |
| # For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions | |
| name: testsuite | |
| on: | |
| push: | |
| branches: [master] | |
| pull_request: | |
| branches: [master] | |
| env: | |
| NODE_VERSION: 18.x | |
| GCP_REPO: us-west2-docker.pkg.dev/askdarcel-184805/sheltertech/askdarcel-web | |
| jobs: | |
| lint: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ env.NODE_VERSION }} | |
| - uses: actions/cache@v4 | |
| with: | |
| path: ~/.npm | |
| key: npm-${{ hashFiles('package-lock.json') }} | |
| restore-keys: npm- | |
| - run: npm ci | |
| - run: cp config.example.yml config.yml | |
| - run: npm run prettier | |
| - run: npm run lint | |
| test_unit: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ env.NODE_VERSION }} | |
| - uses: actions/cache@v4 | |
| with: | |
| path: ~/.npm | |
| key: npm-${{ hashFiles('package-lock.json') }} | |
| restore-keys: npm- | |
| - run: npm ci | |
| - run: cp config.example.yml config.yml | |
| - run: npm run test | |
| test_e2e: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: google-github-actions/auth@v2 | |
| with: | |
| credentials_json: ${{ secrets.GCP_SA_KEY }} | |
| - uses: docker/login-action@v3 | |
| with: | |
| registry: us-west2-docker.pkg.dev | |
| username: _json_key | |
| password: ${{ secrets.GCP_SA_KEY }} | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ env.NODE_VERSION }} | |
| - uses: actions/cache@v4 | |
| with: | |
| path: ~/.npm | |
| key: npm-${{ hashFiles('package-lock.json') }} | |
| restore-keys: npm- | |
| - run: npm ci | |
| - run: cp config.example.yml config.yml | |
| - run: npm run build | |
| - run: docker compose -f docker-compose.test.yml up -d db api api-go frontend | |
| - run: sleep 60 | |
| - run: yarn cypress run | |
| - if: always() | |
| run: docker compose -f docker-compose.test.yml logs -t # Output all docker logs from API and frontend to help debugging after the fact | |
| - uses: actions/upload-artifact@v4 | |
| if: failure() | |
| with: | |
| name: E2E screenshot(s) and video(s) | |
| path: | | |
| /home/runner/work/askdarcel-web/askdarcel-web/cypress/videos/ | |
| /home/runner/work/askdarcel-web/askdarcel-web/cypress/screenshots/ | |
| retention-days: 3 | |
| publish-latest: | |
| runs-on: ubuntu-latest | |
| needs: [lint, test_e2e, test_unit] | |
| if: github.ref == 'refs/heads/master' && github.event_name == 'push' | |
| steps: | |
| - uses: actions/checkout@v4 | |
| # Setup Node.js | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ env.NODE_VERSION }} | |
| # Cache dependencies | |
| - uses: actions/cache@v4 | |
| with: | |
| path: ~/.npm | |
| key: npm-${{ hashFiles('package-lock.json') }} | |
| restore-keys: npm- | |
| # Install and build | |
| - run: npm ci | |
| - run: cp config.example.yml config.yml | |
| - run: CONFIG_YAML=config.docker.yml npm run build | |
| - run: echo ${{ steps.meta.outputs.tags }} > version.json | |
| # Setup Docker | |
| - uses: docker/setup-qemu-action@v3 | |
| - uses: docker/setup-buildx-action@v3 | |
| # Authenticate with Google Cloud | |
| - uses: google-github-actions/auth@v2 | |
| with: | |
| credentials_json: ${{ secrets.GCP_SA_KEY }} | |
| # Login to GCP Artifact Registry | |
| - uses: docker/login-action@v3 | |
| with: | |
| registry: us-west2-docker.pkg.dev | |
| username: _json_key | |
| password: ${{ secrets.GCP_SA_KEY }} | |
| # Build and push | |
| - uses: docker/build-push-action@v6 | |
| with: | |
| push: true | |
| context: . | |
| tags: | | |
| ${{ env.GCP_REPO }}:latest | |
| - run: echo ${{ steps.docker_build.outputs.digest }} |