Skip to content

Build and test

Build and test #1459

Workflow file for this run

---
name: Build and test
on:
schedule:
# run at 1 AM UTC on every day-of-week from Monday through Friday
- cron: "0 1 * * 1-5"
push:
branches:
- renovate/automerge-**
pull_request:
branches: [main]
types: [opened, synchronize, reopened, ready_for_review]
# allow manual trigger
workflow_dispatch:
concurrency:
group: ci-tests-${{ github.ref }}-1
cancel-in-progress: true
jobs:
build:
if: |
!(
(
github.event_name == 'pull_request'
&& startsWith(github.head_ref, 'renovate/automerge-')
)
|| github.event.pull_request.draft
)
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
- name: Setup Node.js 18 (current LTS)
uses: actions/setup-node@v4
with:
node-version: 18
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn config get cacheFolder)"
shell: bash
- name: Restore yarn cache
uses: actions/cache@v4
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: yarn-cache-folder-${{ hashFiles('**/yarn.lock', '**/.yarnrc.yml') }}
restore-keys: |
yarn-cache-folder-
- name: Audit production dependencies
run: yarn npm audit --all --recursive --environment=production
- name: Install dependencies
run: yarn install --immutable --network-timeout 1000000
- name: Cache build
uses: actions/cache@v4
with:
path: |
${{ github.workspace }}/.next/cache
# Generate a new cache whenever packages or source files change.
key: ${{ runner.os }}-nextjs-${{ hashFiles('**/yarn.lock') }}-${{ hashFiles('**.[jt]s', '**.[jt]sx') }}
# If source files changed but packages didn't, rebuild from a prior cache.
restore-keys: |
${{ runner.os }}-nextjs-${{ hashFiles('**/yarn.lock') }}-
- name: Build
run: yarn build