Skip to content

Update hasResource cnd to allow for setting initial resources #41

Update hasResource cnd to allow for setting initial resources

Update hasResource cnd to allow for setting initial resources #41

Workflow file for this run

name: 'Build'
on: [push, pull_request, merge_group]
env:
CI: true
jobs:
prepare:
name: 'Install dependencies'
runs-on: ubuntu-latest
env:
YARN_CACHE_FOLDER: .yarn-cache
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '20.x'
- name: Restore "node_modules" from cache
uses: martijnhols/actions-cache/restore@v3
id: cache
with:
path: |
node_modules
key: ${{ runner.os }}-node_modules-${{ hashFiles('package.json', 'yarn.lock') }}-v3
restore-keys: ${{ runner.os }}-node_modules-
- name: Get yarn cache directory path
if: steps.cache.outputs.cache-hit != 'true'
id: yarn-cache-dir-path
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
# Use week number for automatically purging the cache every week. This is
# useful because caching yarn-cache would otherwise lead it to grow
# indefinitely since old dependencies are never purged.
- name: Get week number
if: steps.cache.outputs.cache-hit != 'true'
id: week-number
run: echo "value=$(date +%W)" >> $GITHUB_OUTPUT
- name: Cache "yarn-cache"
uses: martijnhols/actions-cache@v3
if: steps.cache.outputs.cache-hit != 'true'
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-${{ steps.week-number.outputs.value }}-yarn-cache-${{ hashFiles('yarn.lock') }}
restore-keys: ${{ runner.os }}-${{ steps.week-number.outputs.value }}-yarn-cache-
- run: yarn --frozen-lockfile --prefer-offline
if: steps.cache.outputs.cache-hit != 'true'
- name: Save "node_modules" in cache
if: steps.cache.outputs.cache-hit != 'true'
uses: martijnhols/actions-cache/save@v3
with:
path: |
node_modules
key: ${{ steps.cache.outputs.primary-key }}
# TODO: Update this when possible to include the node_modules folder. GH is updating artifact action soon to make this
# easier (https://github.com/actions/upload-artifact/issues/7#issuecomment-566114993), and cache action multiple path
# support is popular (https://github.com/actions/cache/issues/16)
typecheck:
needs: [prepare]
name: 'Typecheck'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '20.x'
- name: Restore "node_modules" from cache
uses: martijnhols/actions-cache/restore@v3
with:
path: |
node_modules
key: ${{ runner.os }}-node_modules-${{ hashFiles('package.json', 'yarn.lock') }}-v3
required: true
- run: yarn typecheck
linting:
needs: [prepare]
name: 'ESLint'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '20.x'
- name: Restore "node_modules" from cache
uses: martijnhols/actions-cache/restore@v3
with:
path: |
node_modules
key: ${{ runner.os }}-node_modules-${{ hashFiles('package.json', 'yarn.lock') }}-v3
required: true
- run: yarn lint --max-warnings=0
prettier:
needs: [prepare]
name: 'Prettier'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '20.x'
- name: Restore "node_modules" from cache
uses: martijnhols/actions-cache/restore@v3
with:
path: |
node_modules
key: ${{ runner.os }}-node_modules-${{ hashFiles('package.json', 'yarn.lock') }}-v3
required: true
- run: yarn prettier . --check
test-interface:
needs: [prepare]
# This should actually include anything but parser tests
name: 'Interface tests'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '20.x'
- name: Restore "node_modules" from cache
uses: martijnhols/actions-cache/restore@v3
with:
path: |
node_modules
key: ${{ runner.os }}-node_modules-${{ hashFiles('package.json', 'yarn.lock') }}-v3
required: true
- run: yarn test:interface --runInBand
test-parser:
needs: [prepare]
name: 'Parser tests'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '20.x'
- name: Restore "node_modules" from cache
uses: martijnhols/actions-cache/restore@v3
with:
path: |
node_modules
key: ${{ runner.os }}-node_modules-${{ hashFiles('package.json', 'yarn.lock') }}-v3
required: true
- run: yarn test:parser --runInBand
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: actions/setup-node@v4
with:
node-version: '20.x'
- name: Restore "node_modules" from cache
uses: martijnhols/actions-cache/restore@v3
with:
path: |
node_modules
key: ${{ runner.os }}-node_modules-${{ hashFiles('package.json', 'yarn.lock') }}-v3
required: true
- name: Extract messages
if: github.event_name != 'pull_request' && github.repository == 'wowanalyzer/wowanalyzer'
run: |
yarn extract
yarn lingui compile
- name: Calculate environment name
id: environment-name
run: echo "environment_name=${GITHUB_REF##*/}" >> $GITHUB_OUTPUT
- name: Production build
run: yarn build
env:
DISABLE_AUTOMATIC_ESLINT: true
REACT_APP_ENABLE_GA: true
REACT_APP_ENVIRONMENT_NAME: ${{ steps.environment-name.outputs.environment_name }}
REACT_APP_VERSION: ${{ github.sha }}
- name: Inject debug info into sourcemaps
run: yarn sourcemaps
- run: tar -czf build.tar.gz build
- uses: actions/upload-artifact@v3
with:
name: build
path: build.tar.gz
e2e-build:
needs: [prepare]
name: 'e2e-build'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '20.x'
- name: Restore "node_modules" from cache
uses: martijnhols/actions-cache/restore@v3
with:
path: |
node_modules
key: ${{ runner.os }}-node_modules-${{ hashFiles('package.json', 'yarn.lock') }}-v3
required: true
- name: Extract messages
run: |
yarn extract
yarn 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: yarn build
env:
DISABLE_AUTOMATIC_ESLINT: true
REACT_APP_ENABLE_GA: false
REACT_APP_ENVIRONMENT_NAME: ${{ steps.environment-name.outputs.environment_name }}
REACT_APP_VERSION: ${{ github.sha }}
REACT_APP_FORCE_PREMIUM: true
- run: tar -czf build.tar.gz build
- uses: actions/upload-artifact@v3
with:
name: e2e-build
path: build.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: actions/setup-node@v4
with:
node-version: '20.x'
- name: Restore "node_modules" from cache
uses: martijnhols/actions-cache/restore@v3
with:
path: |
node_modules
key: ${{ runner.os }}-node_modules-${{ hashFiles('package.json', 'yarn.lock') }}-v3
required: true
- uses: actions/download-artifact@v3
with:
name: e2e-build
- run: tar -xzf build.tar.gz
- name: Install Playwright deps
run: yarn playwright install --with-deps
- name: Run Playwright tests
run: yarn e2e --shard=${{ matrix.shard }}/4
- uses: actions/upload-artifact@v3
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: actions/setup-node@v4
with:
node-version: '20.x'
- name: Restore "node_modules" from cache
uses: martijnhols/actions-cache/restore@v3
with:
path: |
node_modules
key: ${{ runner.os }}-node_modules-${{ hashFiles('package.json', 'yarn.lock') }}-v3
required: true
- name: Extract messages
run: yarn extract
- name: Compile messages
run: yarn lingui compile
docker-image:
needs: [typecheck, linting, prettier, test-interface, test-parser, 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@v1
with:
name: build
path: .
- run: tar -xzf build.tar.gz
# Remove files we no longer need to speed up sending context to Docker
- run: rm build.tar.gz
- name: Docker meta
id: docker_meta
uses: crazy-max/ghaction-docker-meta@v1
with:
images: wowanalyzer/wowanalyzer
tag-sha: true
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{secrets.DOCKER_USERNAME}}
password: ${{secrets.DOCKER_PASSWORD}}
- name: 'Build martijnhols/healfie:${{env.DOCKER_BUILD_TAG}}'
id: docker_build
uses: docker/build-push-action@v2
with:
context: .
file: ./Dockerfile
push: true
tags: ${{ steps.docker_meta.outputs.tags }}
labels: ${{ steps.docker_meta.outputs.labels }}
- uses: getsentry/action-release@v1
env:
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
SENTRY_ORG: wowanalyzer
SENTRY_PROJECT: wowanalyzer-app
with:
environment: ${{ needs.build.outputs.environment_name }}
sourcemaps: './build/static/js'
url_prefix: '~/static/js'
require-changelog-entry:
name: 'Has new changelog entry'
runs-on: ubuntu-latest
if: github.event_name == 'pull_request'
env:
YARN_CACHE_FOLDER: .yarn-cache
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.js