This repository was archived by the owner on Oct 15, 2025. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 0
121 lines (97 loc) · 2.95 KB
/
ci.yml
File metadata and controls
121 lines (97 loc) · 2.95 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: CI
on:
push:
branches: ["*"]
tags: ["v*"]
pull_request:
branches: ["*"]
permissions:
contents: write
jobs:
build:
name: "Build"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: "22"
- name: Restore cache
uses: actions/cache@v4
with:
path: |
.next/cache
key: ${{ runner.os }}-nextjs-${{ hashFiles('**/pnpm-lock.yaml') }}-${{ hashFiles('**.[jt]s', '**.[jt]sx') }}
restore-keys: |
${{ runner.os }}-nextjs-${{ hashFiles('**/pnpm-lock.yaml') }}-
- name: Install the latest version of Corepack
run: npm i -g corepack@latest
- name: Enable Corepack
run: corepack enable
- name: Install dependencies
run: pnpm install
- name: Build
run: pnpm build
test:
name: "Test"
needs: [build]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: "22"
- name: Create a .env.test file
run: |
touch .env.test
echo "APP_NAME=\"Testing\"" >> .env.test
echo "APP_HOST=\"${{ vars.APP_HOST }}\"" >> .env.test
echo "CS_API_KEY=\"${{ vars.CS_API_KEY }}\"" >> .env.test
echo "CS_DELIVERY_TOKEN=\"${{ vars.CS_DELIVERY_TOKEN }}\"" >> .env.test
echo "CS_PREVIEW_TOKEN=\"${{ vars.CS_PREVIEW_TOKEN }}\"" >> .env.test
echo "CS_API_ENDPOINT=\"${{ vars.CS_API_ENDPOINT }}\"" >> .env.test
echo "CS_ENVIRONMENT=\"${{ vars.CS_ENVIRONMENT }}\"" >> .env.test
echo "DISABLE_QUERY_CACHE=0" >> .env.test
- name: Install the latest version of Corepack
run: npm i -g corepack@latest
- name: Enable Corepack
run: corepack enable
- name: Install dependencies
run: pnpm install
- name: Run tests
run: pnpm coverage
- name: Delete the .env.test file after tests are completed
run: rm .env.test
- uses: actions/upload-artifact@v4
with:
name: coverage
path: coverage/
sonar-scan:
name: "SonarQube Scan"
needs: [test]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/download-artifact@v4
- name: SonarQube Scan
uses: SonarSource/sonarqube-scan-action@v5.3.1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
deploy:
name: "Release"
needs: [build, test]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Release
run: ls # Placeholder for now
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
if:
startsWith(github.ref, 'refs/tags/')