-
Notifications
You must be signed in to change notification settings - Fork 78
121 lines (97 loc) · 3.65 KB
/
validate.yaml
File metadata and controls
121 lines (97 loc) · 3.65 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
name: Validate
concurrency:
group: "${{ github.workflow }}-${{ github.ref }}-validate"
cancel-in-progress: true
on:
pull_request:
branches:
- main
jobs:
validate:
name: Validate
if: ${{ !startsWith(github.head_ref, 'content/') }}
runs-on: ${{ matrix.os }}
timeout-minutes: 60
env:
NEXT_PUBLIC_APP_BASE_URL: "http://localhost:3000"
NEXT_PUBLIC_APP_PRODUCTION_BASE_URL: "http://localhost:3000"
NEXT_PUBLIC_TYPESENSE_COLLECTION: "dariah-campus"
NEXT_PUBLIC_TYPESENSE_HOST: "localhost"
NEXT_PUBLIC_TYPESENSE_PORT: "8108"
NEXT_PUBLIC_TYPESENSE_PROTOCOL: "http"
TYPESENSE_ADMIN_API_KEY: "xyz"
strategy:
fail-fast: true
matrix:
node-version: [24.x]
os: [ubuntu-24.04]
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install pnpm
uses: pnpm/action-setup@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: "pnpm"
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Format
run: pnpm run format:check
- name: Transform content
run: pnpm run content:build
- name: Generate metadata dump
run: pnpm run generate:metadata-dump
- 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@v4
id: cache-playwright-browsers
with:
path: "~/.cache/ms-playwright"
key: "${{ matrix.os }}-playwright-browsers-${{ env.PLAYWRIGHT_VERSION }}"
- name: Install playwright browsers
if: steps.cache-playwright-browsers.outputs.cache-hit != 'true'
run: pnpm exec playwright install --with-deps
- name: Install playwright browsers (operating system dependencies)
if: steps.cache-playwright-browsers.outputs.cache-hit == 'true'
run: pnpm exec playwright install-deps
# https://nextjs.org/docs/pages/building-your-application/deploying/ci-build-caching#github-actions
- name: Cache Next.js build output
uses: actions/cache@v4
with:
path: "${{ github.workspace }}/.next/cache"
key: "${{ matrix.os }}-nextjs-${{ hashFiles('pnpm-lock.yaml') }}"
- name: Start typesense server and populate search index
run: |
touch .env.local
pnpm run dev:typesense:up
echo "Waiting for Typesense to be ready..."
until curl -s -o /dev/null -w "%{http_code}" -H "X-TYPESENSE-API-KEY: $TYPESENSE-API-KEY" http://localhost:8108/health | grep -q 200; do
echo -n "."
sleep 1
done
pnpm run typesense:collection:create
pnpm run typesense:collection:seed
echo NEXT_PUBLIC_TYPESENSE_SEARCH_API_KEY=$(pnpm run typesense:api-key:create | awk -F'"' '{print $2}') >> $GITHUB_ENV
- name: Build app
run: pnpm run build
- name: Run e2e tests
run: pnpm run test:e2e
- name: Stop typesense server
run: pnpm run dev:typesense:down
- uses: actions/upload-artifact@v4
if: ${{ !cancelled() }}
with:
name: playwright-report
path: playwright-report/
retention-days: 30