changelog #316
Workflow file for this run
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: 'Build' | |
on: [push, pull_request, merge_group] | |
env: | |
CI: true | |
jobs: | |
prepare: | |
name: 'Install dependencies' | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: pnpm/action-setup@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: '20.x' | |
cache: 'pnpm' | |
- run: pnpm install --frozen-lockfile | |
typecheck: | |
needs: [prepare] | |
name: 'Typecheck' | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: pnpm/action-setup@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: '20.x' | |
cache: 'pnpm' | |
- run: pnpm install --frozen-lockfile | |
- run: pnpm run typecheck | |
linting: | |
needs: [prepare] | |
name: 'ESLint' | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: pnpm/action-setup@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: '20.x' | |
cache: 'pnpm' | |
- run: pnpm install --frozen-lockfile | |
- run: pnpm run lint --max-warnings=0 | |
prettier: | |
needs: [prepare] | |
name: 'Prettier' | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: pnpm/action-setup@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: '20.x' | |
cache: 'pnpm' | |
- run: pnpm install --frozen-lockfile | |
- run: pnpm exec prettier . --check | |
tests: | |
needs: [prepare] | |
name: 'Tests' | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: pnpm/action-setup@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: '20.x' | |
cache: 'pnpm' | |
- run: pnpm install --frozen-lockfile | |
- run: pnpm run test | |
build: | |
needs: [prepare] | |
name: 'Build' | |
runs-on: ubuntu-latest | |
if: github.repository == 'wowanalyzer/wowanalyzer' | |
outputs: | |
environment_name: ${{ steps.environment-name.outputs.environment_name }} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: pnpm/action-setup@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: '20.x' | |
cache: 'pnpm' | |
- run: pnpm install --frozen-lockfile | |
- name: Extract messages | |
if: github.event_name != 'pull_request' && github.repository == 'wowanalyzer/wowanalyzer' | |
run: | | |
pnpm run extract | |
pnpm exec lingui compile | |
- name: Calculate environment name | |
id: environment-name | |
run: echo "environment_name=${GITHUB_REF_NAME}" >> $GITHUB_OUTPUT | |
- name: Production build | |
run: pnpm run build | |
env: | |
DISABLE_AUTOMATIC_ESLINT: true | |
VITE_ENABLE_GA: true | |
VITE_ENVIRONMENT_NAME: ${{ steps.environment-name.outputs.environment_name }} | |
VITE_VERSION: ${{ github.sha }} | |
- run: tar -czf dist.tar.gz dist | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: dist | |
path: dist.tar.gz | |
e2e-build: | |
needs: [prepare] | |
name: 'e2e-build' | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: pnpm/action-setup@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: '20.x' | |
cache: 'pnpm' | |
- run: pnpm install --frozen-lockfile | |
- name: Extract messages | |
run: | | |
pnpm run extract | |
pnpm exec lingui compile | |
- name: Calculate environment name | |
id: environment-name | |
run: echo "environment_name=${GITHUB_REF##*/}" >> $GITHUB_OUTPUT | |
- name: Customize production environment variables | |
# Even though this is a "production" build, it's actually a "development" build we're | |
# using for e2e testing. | |
run: cp .env.development .env.production | |
- name: Production build | |
run: pnpm run build | |
env: | |
DISABLE_AUTOMATIC_ESLINT: true | |
VITE_ENABLE_GA: false | |
VITE_ENVIRONMENT_NAME: ${{ steps.environment-name.outputs.environment_name }} | |
VITE_VERSION: ${{ github.sha }} | |
VITE_FORCE_PREMIUM: true | |
- run: tar -czf dist.tar.gz dist | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: e2e-build | |
path: dist.tar.gz | |
e2e-test: | |
needs: [e2e-build] | |
name: e2e-test-shard-${{ matrix.shard }} | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
shard: [1, 2, 3, 4] | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: pnpm/action-setup@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: '20.x' | |
cache: 'pnpm' | |
- run: pnpm install --frozen-lockfile | |
- uses: actions/download-artifact@v4 | |
with: | |
name: e2e-build | |
- run: tar -xzf dist.tar.gz | |
- name: Install Playwright deps | |
run: pnpm exec playwright install --with-deps | |
- name: Run Playwright tests | |
run: pnpm run e2e --shard=${{ matrix.shard }}/4 | |
- uses: actions/upload-artifact@v4 | |
if: always() | |
with: | |
name: playwright-report-shard-${{ matrix.shard }} | |
path: playwright-report/ | |
retention-days: 30 | |
# This only runs on PRs since it's not a part of the build step. This is | |
# required as mistakes in i18n tags may trigger errors, and we skip the | |
# extraction in the build for performance in PRs. | |
extract-verify: | |
needs: [prepare] | |
name: 'Verify i18n messages' | |
runs-on: ubuntu-latest | |
if: github.event_name == 'pull_request' | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: pnpm/action-setup@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: '20.x' | |
cache: 'pnpm' | |
- run: pnpm install --frozen-lockfile | |
- name: Extract messages | |
run: pnpm run extract | |
- name: Compile messages | |
run: pnpm exec lingui compile | |
docker-image: | |
needs: [typecheck, linting, prettier, tests, build] | |
name: 'Publish Docker image' | |
runs-on: ubuntu-latest | |
if: github.event_name == 'push' && github.repository == 'wowanalyzer/wowanalyzer' | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/download-artifact@v4 | |
with: | |
name: dist | |
path: . | |
- run: tar -xzf dist.tar.gz | |
# Remove files we no longer need to speed up sending context to Docker | |
- run: rm dist.tar.gz | |
- name: Docker meta | |
id: docker_meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: | | |
wowanalyzer/wowanalyzer | |
tags: | | |
type=ref,event=branch | |
type=ref,event=pr | |
type=sha | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to DockerHub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{secrets.DOCKER_USERNAME}} | |
password: ${{secrets.DOCKER_PASSWORD}} | |
- name: Build Docker image | |
id: docker_build | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
file: ./Dockerfile | |
push: true | |
tags: ${{ steps.docker_meta.outputs.tags }} | |
labels: ${{ steps.docker_meta.outputs.labels }} | |
require-changelog-entry: | |
name: 'Has new changelog entry' | |
runs-on: ubuntu-latest | |
if: github.event_name == 'pull_request' | |
steps: | |
- uses: actions/checkout@v4 | |
- run: git fetch --no-tags --depth=1 origin $GITHUB_BASE_REF:$GITHUB_BASE_REF | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: '20.x' | |
- run: node scripts/require-changelog-entry.cjs |