-
Notifications
You must be signed in to change notification settings - Fork 5
92 lines (76 loc) · 2.58 KB
/
CI.yml
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
name: CI
# Variables
env:
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
# Triggering the workflow on PRs and pushes to relevant branches
on:
pull_request:
branches:
- main
- feature/**
jobs:
# Build and test job
build-and-test:
name: Build and test
runs-on: ubuntu-latest
permissions:
contents: write
steps:
# Checkout
- name: Checkout
uses: actions/checkout@v4
# Installing pnpm
- name: Install pnpm
uses: pnpm/[email protected]
with:
version: latest
# Defining what Node.js version to use
- name: Use Node.js 18.x
uses: actions/setup-node@v4
with:
node-version: 18.x
cache: pnpm
cache-dependency-path: ./pnpm-lock.yaml
# Installing node dependencies using pnpm
- name: Pnpm install
run: pnpm install --frozen-lockfile
# Linting the application
- name: Pnpm lint
run: pnpm lint
# Persisting Next.js' cache across builds
- name: Use Next.js cache
uses: actions/[email protected]
with:
path: ${{ github.workspace }}/.next/cache
# Generate a new cache whenever packages or source files change.
key: ${{ runner.os }}-nextjs-${{ hashFiles('**/pnpm-lock.yaml') }}-${{ hashFiles('**.[jt]s', '**.[jt]sx') }}
# If source files changed but packages didn't, rebuild from a prior cache.
restore-keys: |
${{ runner.os }}-nextjs-${{ hashFiles('**/pnpm-lock.yaml') }}-
# Building the application
- name: Pnpm build
run: pnpm build
# Installing Playwright's browsers
- name: Install Playwright's browsers
run: pnpm playwright install --with-deps
# Running application tests
- name: Pnpm test
run: pnpm test
# Running E2E screenshots check
- name: E2E check
run: pnpm e2e-check
# Committing E2E screenshot changes
- name: Commit E2E changes
uses: EndBug/[email protected]
with:
message: "[skip ci] [e2e-check] Automated Playwright E2E screenshot changes commit"
new_branch: ${{ env.BRANCH_NAME }}
# Running Storybook story screenshots check
- name: Run stories-check
run: pnpm stories-check
# Committing Storybook story screenshot changes
- name: Commit Storybook changes
uses: EndBug/[email protected]
with:
message: "[skip ci] [storybook-check] Automated Storybook screenshot changes commit"
new_branch: ${{ env.BRANCH_NAME }}