fix(website-frontend): copy badge producing broken links #4424
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: e2e | |
on: | |
workflow_dispatch: | |
pull_request: | |
types: [synchronize, opened, reopened] | |
permissions: | |
id-token: write | |
contents: read | |
jobs: | |
build-and-release: | |
name: Build and Release | |
runs-on: ubuntu-latest | |
outputs: | |
npm-package-version: ${{ steps.version.outputs.npm-package-version }} | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Set NPM Env | |
run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > ~/.npmrc | |
- name: Setup Node | |
uses: actions/setup-node@v4 | |
with: | |
node-version-file: '.nvmrc' | |
cache: 'npm' | |
- name: Install dependencies | |
run: npm ci | |
- name: Choose version | |
id: version | |
run: 'node tasks/set-npm-canary-version.js' | |
- name: Build | |
run: npm run build | |
- name: Lerna publish canary version | |
run: | | |
git config --global user.name "stryker-mutator[bot]" | |
git config --global user.email 158062761+stryker-mutator[bot]@users.noreply.github.com | |
npx lerna version ${{ steps.version.outputs.npm-package-version }} --no-git-tag-version --no-push --exact --force-publish --yes --no-conventional-commits | |
git commit -am "temp-commit" | |
npx lerna publish from-package --dist-tag canary --no-git-reset --yes | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Extract metadata (tags, labels) for Docker | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: ghcr.io/stryker-mutator/dashboard | |
tags: | | |
type=ref,event=branch | |
type=ref,event=pr | |
type=semver,pattern={{version}},value=v${{ steps.version.outputs.npm-package-version }} | |
- name: Wait for package to be available | |
run: node tasks/wait-for-npm-package.js ${{ steps.version.outputs.npm-package-version }} | |
- name: Build and push Docker image | |
uses: docker/build-push-action@v6 | |
id: build | |
with: | |
context: ./docker | |
push: true | |
build-args: 'version=${{ steps.meta.outputs.version }}' | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
annotations: ${{ steps.meta.outputs.annotations }} | |
platforms: linux/amd64 | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
deploy-and-test: | |
name: Deploy to Acceptance and run E2E tests | |
needs: build-and-release | |
runs-on: ubuntu-latest | |
environment: | |
name: Acceptance | |
url: https://stryker-dashboard-acceptance.azurewebsites.net/ | |
concurrency: | |
group: Acceptance | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Download & install badge-api package | |
run: ./tasks/download-badge-api-package.sh ${{ needs.build-and-release.outputs.npm-package-version }} | |
- name: Azure login | |
uses: Azure/login@v2 | |
with: | |
client-id: ${{ secrets.AZURE_IDENTITY_CLIENT_ID }} | |
tenant-id: ${{ secrets.AZURE_IDENTITY_TENANT_ID }} | |
subscription-id: ${{ secrets.AZURE_IDENTITY_SUBSCRIPTION_ID }} | |
- name: 'Deploy stryker-dashboard-acceptance.azurewebsites.net' | |
uses: azure/webapps-deploy@v3 | |
with: | |
app-name: 'stryker-dashboard-acceptance' | |
images: 'ghcr.io/stryker-mutator/dashboard:${{ needs.build-and-release.outputs.npm-package-version }}' | |
- name: 'Deploy stryker-mutator-badge-api-acceptance.azurewebsites.net' | |
uses: Azure/functions-action@v1 | |
id: fa | |
with: | |
app-name: stryker-mutator-badge-api-acceptance | |
package: 'package' | |
- name: 'Verify deployment' | |
run: | | |
node tasks/check-version badge-api https://stryker-mutator-badge-api-acceptance.azurewebsites.net/api ${{ needs.build-and-release.outputs.npm-package-version }} | |
node tasks/check-version dashboard https://stryker-dashboard-acceptance.azurewebsites.net/api/version ${{ needs.build-and-release.outputs.npm-package-version }} | |
- name: Setup Node | |
uses: actions/setup-node@v4 | |
with: | |
node-version-file: '.nvmrc' | |
cache: 'npm' | |
- name: Install dependencies | |
run: npm ci | |
- name: Install browsers | |
run: | | |
cd packages/e2e | |
npx playwright install chromium --with-deps | |
- name: Build | |
run: | | |
cd packages/e2e | |
npx tsc -b | |
cd ../.. | |
- name: Run e2e tests | |
run: | | |
cd packages/e2e | |
npm run test | |
env: | |
BASE_URL: https://stryker-dashboard-acceptance.azurewebsites.net | |
E2E_AZURE_STORAGE_CONNECTION_STRING: ${{ secrets.E2E_AZURE_STORAGE_CONNECTION_STRING }} | |
E2E_JWT_SECRET: ${{ secrets.E2E_JWT_SECRET }} | |
E2E_ACCESS_TOKEN: ${{ secrets.E2E_ACCESS_TOKEN }} | |
E2E_BADGE_API_BASE_URL: https://stryker-mutator-badge-api-acceptance.azurewebsites.net | |
- name: Upload artifacts if failed | |
uses: actions/upload-artifact@v4 | |
if: failure() | |
with: | |
name: playwright-videos | |
path: | | |
packages/e2e/test-results/ | |
packages/e2e/playwright-report/ |