feat(hide-data): add confirmation step #5004
This file contains 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: Test and Release | |
on: | |
push: | |
branches: | |
- saga | |
workflow_dispatch: | |
pull_request: | |
permissions: | |
contents: write | |
actions: write | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
environment: production | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: "22.x" | |
cache: "npm" | |
- name: Install dependencies | |
run: npm ci --no-audit | |
- name: Compile TypeScript | |
run: npx tsc | |
- name: Check source code with eslint | |
run: npx eslint ./ | |
- name: Check if source code is properly formatted | |
run: npx prettier -c ./ | |
- name: Run tests | |
run: npm test | |
- name: Ensure it builds | |
env: | |
REGISTRY_ENDPOINT: ${{ vars.REGISTRY_ENDPOINT }} | |
run: | | |
npm run build | |
cp -L -r ./static ./build/client | |
mkdir -p build/client/node_modules/maplibre-gl/dist/ | |
cp node_modules/maplibre-gl/dist/maplibre-gl.css build/client/node_modules/maplibre-gl/dist/ | |
e2e-tests: | |
runs-on: ubuntu-latest | |
environment: ci | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: "22.x" | |
cache: "npm" | |
- name: Install dependencies | |
run: npm ci --no-audit | |
- name: Store Playwright's Version | |
run: | | |
PLAYWRIGHT_VERSION=$(npm ls @playwright/test | grep @playwright | sed 's/.*@//') | |
echo "Playwright's Version: $PLAYWRIGHT_VERSION" | |
echo "PLAYWRIGHT_VERSION=$PLAYWRIGHT_VERSION" >> $GITHUB_ENV | |
- name: Cache Playwright Browsers for Playwright's Version | |
id: cache-playwright-browsers | |
uses: actions/cache@v4 | |
with: | |
path: ~/.cache/ms-playwright | |
key: playwright-browsers-${{ env.PLAYWRIGHT_VERSION }} | |
- name: Install Playwright Browsers | |
if: steps.cache-playwright-browsers.outputs.cache-hit != 'true' | |
run: npx playwright install --with-deps | |
- name: Run end to end tests | |
env: | |
VERSION: ${{ env.VERSION }} | |
MAP_REGION: ${{ vars.MAP_REGION }} | |
MAP_NAME: ${{ vars.MAP_NAME }} | |
MAP_API_KEY: ${{ vars.MAP_API_KEY }} | |
run: npm run test:e2e | |
# This generates a string containing the current date which is used in | |
# in artifact names to simplify locating and distinguishing them once they have | |
# been downloaded | |
- name: Generate date string | |
id: dateAsString | |
run: echo "dateAsString=$(date +'%Y%m%d%H%M%S')" >> $GITHUB_ENV | |
- uses: actions/upload-artifact@v4 | |
if: failure() | |
with: | |
name: e2e-test-results-${{ env.dateAsString }}-${{ github.sha }} | |
path: | | |
test-results | |
release: | |
runs-on: ubuntu-latest | |
needs: [build, e2e-tests] | |
if: github.ref == 'refs/heads/saga' | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: "22.x" | |
cache: "npm" | |
- name: Semantic release | |
run: npx semantic-release | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Trigger deployment workflow | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: gh workflow run deploy.yaml |