-
Notifications
You must be signed in to change notification settings - Fork 2
111 lines (94 loc) · 3.69 KB
/
web-nextjs_ci_reusable.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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
name: '[Web] CI - Next.js'
on:
workflow_call:
inputs:
workflowName:
required: true
type: string
description: 'Name of the workflow this is triggered from'
name:
required: true
type: string
description: 'Name of the package or application to analzye'
path:
required: true
type: string
description: 'Path to the package or application to analzye'
vercelProjectId:
required: true
type: string
description: 'Vercel Project ID'
env:
VERCEL_PROJECT_ID: ${{ inputs.vercelProjectId }}
VERCEL_ORG_ID: team_Ade0MlfC3211ml3wYJZ4c9hn
defaults:
run:
working-directory: ./web
jobs:
ci:
timeout-minutes: 5
runs-on: ubuntu-latest
concurrency:
group: ${{ github.workflow }}-${{ github.ref || github.run_id }}-${{ inputs.name }}
cancel-in-progress: true
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 2
- name: ✨ Setup Node
uses: actions/setup-node@v4
with:
node-version: "20.x"
- uses: pnpm/action-setup@v3
name: ✨ Install pnpm
with:
version: 9.2.0
- name: ✨ Get pnpm store directory
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- uses: actions/cache@v4
name: ✨ Setup pnpm cache
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: 📦️ Install dependencies
run: pnpm install --frozen-lockfile --filter ${{ inputs.name }}... --filter .
- name: 🔎 Lint app
if: success() && github.event_name == 'pull_request'
run: pnpm lint --filter=${{ inputs.name }}
- name: ✨ Setup Vercel CLI
run: npm i --g vercel@latest
- name: ⚙️ Pull Vercel Environment Information
run: vercel env pull --yes --environment=preview --token=${{ secrets.VERCEL_TOKEN }}
working-directory: ${{ inputs.path }}/
- name: ⚒️ Build app
run: pnpm build --filter=${{ inputs.name }}
- name: 📦️ Install playwright browsers
if: success() && github.event_name == 'pull_request'
run: |
pnpm install --global playwright
pnpm playwright install --with-deps
- name: ⚒️ Test app
if: success() && github.event_name == 'pull_request'
run: pnpm test --filter=${{ inputs.name }}
## TODO: Enable when stories-check is ready
# - name: Run stories-check
# run: pnpm stories-check
# id: runStoriesCheck
# continue-on-error: true
# working-directory: web/apps/web/
# - name: Commit changes
# id: ccc
# if: steps.runStoriesCheck.outcome == 'failure'
# uses: EndBug/add-and-commit@v9
# with:
# add: ".stories-approved"
# message: "[skip ci] [stories-check] Automated stories changes"
# new_branch: ${{ github.head_ref }}
# default_author: github_actions
# env:
# GITHUB_TOKEN: ${{ secrets.AT_GH_CD_REPO_PAT }}