Initial commit #1
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: Validate | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
on: | |
pull_request: | |
branches: | |
- main | |
push: | |
branches: | |
- main | |
jobs: | |
validate: | |
name: Validate | |
runs-on: ${{ matrix.os }} | |
timeout-minutes: 60 | |
strategy: | |
fail-fast: true | |
matrix: | |
node-version: [20.x] | |
os: [ubuntu-latest] | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Enable corepack | |
run: corepack enable | |
- name: Use Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ matrix.node-version }} | |
cache: "pnpm" | |
- name: Install dependencies | |
run: pnpm install --frozen-lockfile | |
- name: Commit message | |
if: github.event_name == 'push' | |
run: | | |
pnpm exec commitlint \ | |
--from ${{ github.event.before }} \ | |
--to ${{ github.event.after }} \ | |
--verbose | |
- name: Commit messages | |
if: github.event_name == 'pull_request' | |
run: | | |
pnpm exec commitlint \ | |
--from ${{ github.event.pull_request.base.sha }} \ | |
--to ${{ github.event.pull_request.head.sha }} \ | |
--verbose | |
- name: Format | |
run: pnpm run format:check | |
- name: Lint | |
run: pnpm run lint:check | |
- name: Typecheck | |
run: pnpm run types:check | |
- name: Test | |
run: pnpm run test | |
- name: Get playwright version | |
run: | | |
PLAYWRIGHT_VERSION=$(pnpm ls @playwright/test --json | jq --raw-output '.[0].devDependencies["@playwright/test"].version') | |
echo "PLAYWRIGHT_VERSION=$PLAYWRIGHT_VERSION" >> $GITHUB_ENV | |
- name: Cache playwright browsers | |
uses: actions/cache@v3 | |
id: cache-playwright-browsers | |
with: | |
path: "~/.cache/ms-playwright" | |
key: ${{ matrix.os }}-playwright-browsers-${{ env.PLAYWRIGHT_VERSION }} | |
# TODO: might need https://github.com/microsoft/playwright/issues/7249#issuecomment-1597663397 | |
- name: Install playwright browsers | |
if: steps.cache-playwright-browsers.outputs.cache-hit != 'true' | |
run: pnpm exec playwright install --with-deps | |
- name: Cache Next.js build output | |
uses: actions/cache@v3 | |
with: | |
path: ${{ github.workspace }}/.next/cache | |
key: ${{ matrix.os }}-nextjs-${{ hashFiles('pnpm-lock.yaml') }} | |
- name: Build app | |
run: pnpm run build | |
env: | |
NUXT_PUBLIC_APP_BASE_URL: "http://localhost:3000" | |
NUXT_PUBLIC_REDMINE_ID: "${{ vars.SERVICE_ID }}" | |
- name: Run e2e tests | |
run: pnpm run test:e2e | |
- uses: actions/upload-artifact@v3 | |
if: always() | |
with: | |
name: playwright-report | |
path: playwright-report/ | |
retention-days: 30 | |
build-deploy: | |
if: ${{ github.event_name == 'push' }} | |
needs: [validate] | |
uses: ./.github/workflows/build-deploy.yml |