Skip to content

Commit a532939

Browse files
committed
build: restore ci checks PLATTA-6231
1 parent 0594d34 commit a532939

7 files changed

Lines changed: 465 additions & 12 deletions
Lines changed: 151 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,151 @@
1+
name: CI-Events-Helsinki
2+
3+
on:
4+
push:
5+
branches:
6+
- dev
7+
- main
8+
# Only consider those paths to trigger the action
9+
paths:
10+
- 'apps/events-helsinki/**'
11+
- 'packages/components/**'
12+
- 'packages/common-i18n/**'
13+
- '.yarnrc.yml'
14+
- 'tsconfig.base.json'
15+
- '.prettier*'
16+
- '.github/workflows/**'
17+
18+
pull_request:
19+
types:
20+
- opened
21+
- synchronize
22+
- reopened
23+
# Only consider those paths to trigger the action
24+
paths:
25+
- 'apps/events-helsinki/**'
26+
- 'packages/components/**'
27+
- 'packages/common-i18n/**'
28+
- '.yarnrc.yml'
29+
- 'tsconfig.base.json'
30+
- '.prettier*'
31+
- '.github/workflows/**'
32+
33+
env:
34+
CI: true
35+
FEDERATION_ROUTER_ENDPOINT: https://events-graphql-federation-events.test.hel.ninja/
36+
CMS_ORIGIN: https://tapahtumat.app-staging.hkih.hion.dev
37+
LINKEDEVENTS_EVENT_ENDPOINT: https://api.hel.fi/linkedevents/v1/event
38+
39+
jobs:
40+
test:
41+
runs-on: ubuntu-latest
42+
strategy:
43+
matrix:
44+
node-version: [20.x]
45+
steps:
46+
- uses: actions/checkout@v4
47+
48+
- name: Use Node.js ${{ matrix.node-version }}
49+
uses: actions/setup-node@v4
50+
with:
51+
node-version: ${{ matrix.node-version }}
52+
53+
# Why not using setup-node 2.2+ cache option (yet) ?
54+
# see https://github.com/belgattitude/nextjs-monorepo-example/pull/369
55+
- name: Get yarn cache directory path
56+
id: yarn-cache-dir-path
57+
run: echo "::set-output name=dir::$(yarn config get cacheFolder)"
58+
59+
- name: Restore yarn cache
60+
uses: actions/cache@v4
61+
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
62+
with:
63+
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
64+
key: yarn-cache-folder-${{ hashFiles('**/yarn.lock', '.yarnrc.yml') }}
65+
restore-keys: |
66+
yarn-cache-folder-
67+
68+
# see https://github.com/vercel/next.js/pull/27362
69+
- name: Restore nextjs build events-helsinki from cache
70+
uses: actions/cache@v4
71+
with:
72+
path: |
73+
${{ github.workspace }}/apps/events-helsinki/.next/cache
74+
${{ github.workspace }}/.cache
75+
${{ github.workspace }}/**/tsconfig.tsbuildinfo
76+
77+
key: ${{ runner.os }}-events-helsinki-${{ hashFiles('**/yarn.lock') }}-${{ hashFiles('apps/events-helsinki/src/**.[jt]sx?', 'apps/events-helsinki/src/**.json') }}
78+
restore-keys: |
79+
${{ runner.os }}-events-helsinki-${{ hashFiles('**/yarn.lock') }}-
80+
81+
- name: Install dependencies
82+
run: |
83+
yarn install --immutable --inline-builds
84+
env:
85+
HUSKY: 0
86+
87+
- name: Typecheck
88+
working-directory: apps/events-helsinki
89+
run: |
90+
yarn typecheck
91+
92+
- name: Linter
93+
working-directory: apps/events-helsinki
94+
run: |
95+
yarn lint
96+
97+
- name: Unit tests
98+
working-directory: apps/events-helsinki
99+
run: |
100+
yarn test --coverage
101+
env:
102+
TZ: Europe/Helsinki
103+
FEDERATION_ROUTER_ENDPOINT: ${{env.FEDERATION_ROUTER_ENDPOINT}}
104+
CMS_ORIGIN: ${{env.CMS_ORIGIN}}
105+
LINKEDEVENTS_EVENT_ENDPOINT: ${{env.LINKEDEVENTS_EVENT_ENDPOINT}}
106+
# Mock origin
107+
NEXT_PUBLIC_APP_ORIGIN: https://localhost:3001
108+
109+
- name: SonarQube Cloud Scan
110+
uses: SonarSource/sonarqube-scan-action@v5.1.0
111+
env:
112+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
113+
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
114+
115+
- name: Build web-app
116+
working-directory: apps/events-helsinki
117+
run: |
118+
yarn build
119+
env:
120+
# Speed up build: they are linted in a previous step
121+
NEXTJS_IGNORE_ESLINT: true
122+
# Speed up build: they are typechecked in a previous step
123+
NEXTJS_IGNORE_TYPECHECK: true
124+
# Speed up build: don't run if not needed, enable if it becomes needed
125+
NEXT_DISABLE_SOURCEMAPS: true
126+
# Don't send telemetry for ci
127+
NEXT_TELEMETRY_DISABLED: true
128+
# To allow checking size-limits
129+
NEXTJS_DISABLE_SENTRY: false
130+
# Fully disable sentry upload
131+
NEXTJS_SENTRY_UPLOAD_DRY_RUN: true
132+
FEDERATION_ROUTER_ENDPOINT: ${{env.FEDERATION_ROUTER_ENDPOINT}}
133+
CMS_ORIGIN: ${{env.CMS_ORIGIN}}
134+
LINKEDEVENTS_EVENT_ENDPOINT: ${{env.LINKEDEVENTS_EVENT_ENDPOINT}}
135+
# Mock origin
136+
NEXT_PUBLIC_APP_ORIGIN: https://localhost:3001
137+
NEXT_PUBLIC_MATOMO_URL_BASE: '//webanalytics.digiaiiris.com/js/'
138+
NEXT_PUBLIC_MATOMO_SITE_ID: 708
139+
NEXT_PUBLIC_MATOMO_SRC_URL: 'piwik.min.js'
140+
NEXT_PUBLIC_MATOMO_TRACKER_URL: 'tracker.php'
141+
NEXT_PUBLIC_MATOMO_ENABLED: 0
142+
143+
- name: Check browser bundle size limits
144+
working-directory: apps/events-helsinki
145+
run: |
146+
yarn check-size
147+
148+
- name: Check ecmascript checks for build files
149+
working-directory: apps/events-helsinki
150+
run: |
151+
yarn check-dist
Lines changed: 151 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,151 @@
1+
name: CI-Hobbies-Helsinki
2+
3+
on:
4+
push:
5+
branches:
6+
- dev
7+
- main
8+
# Only consider those paths to trigger the action
9+
paths:
10+
- 'apps/hobbies-helsinki/**'
11+
- 'packages/components/**'
12+
- 'packages/common-i18n/**'
13+
- '.yarnrc.yml'
14+
- 'tsconfig.base.json'
15+
- '.prettier*'
16+
- '.github/workflows/**'
17+
18+
pull_request:
19+
types:
20+
- opened
21+
- synchronize
22+
- reopened
23+
# Only consider those paths to trigger the action
24+
paths:
25+
- 'apps/hobbies-helsinki/**'
26+
- 'packages/components/**'
27+
- 'packages/common-i18n/**'
28+
- '.yarnrc.yml'
29+
- 'tsconfig.base.json'
30+
- '.prettier*'
31+
- '.github/workflows/**'
32+
33+
env:
34+
CI: true
35+
FEDERATION_ROUTER_ENDPOINT: https://events-graphql-federation-hobbies.test.hel.ninja/
36+
CMS_ORIGIN: https://harrastus.app-staging.hkih.hion.dev
37+
LINKEDEVENTS_EVENT_ENDPOINT: https://api.hel.fi/linkedevents/v1/event
38+
39+
jobs:
40+
test:
41+
runs-on: ubuntu-latest
42+
strategy:
43+
matrix:
44+
node-version: [20.x]
45+
steps:
46+
- uses: actions/checkout@v4
47+
48+
- name: Use Node.js ${{ matrix.node-version }}
49+
uses: actions/setup-node@v4
50+
with:
51+
node-version: ${{ matrix.node-version }}
52+
53+
# Why not using setup-node 2.2+ cache option (yet) ?
54+
# see https://github.com/belgattitude/nextjs-monorepo-example/pull/369
55+
- name: Get yarn cache directory path
56+
id: yarn-cache-dir-path
57+
run: echo "::set-output name=dir::$(yarn config get cacheFolder)"
58+
59+
- name: Restore yarn cache
60+
uses: actions/cache@v4
61+
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
62+
with:
63+
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
64+
key: yarn-cache-folder-${{ hashFiles('**/yarn.lock', '.yarnrc.yml') }}
65+
restore-keys: |
66+
yarn-cache-folder-
67+
68+
# see https://github.com/vercel/next.js/pull/27362
69+
- name: Restore nextjs build hobbies-helsinki from cache
70+
uses: actions/cache@v4
71+
with:
72+
path: |
73+
${{ github.workspace }}/apps/hobbies-helsinki/.next/cache
74+
${{ github.workspace }}/.cache
75+
${{ github.workspace }}/**/tsconfig.tsbuildinfo
76+
77+
key: ${{ runner.os }}-hobbies-helsinki-${{ hashFiles('**/yarn.lock') }}-${{ hashFiles('apps/hobbies-helsinki/src/**.[jt]sx?', 'apps/hobbies-helsinki/src/**.json') }}
78+
restore-keys: |
79+
${{ runner.os }}-hobbies-helsinki-${{ hashFiles('**/yarn.lock') }}-
80+
81+
- name: Install dependencies
82+
run: |
83+
yarn install --immutable --inline-builds
84+
env:
85+
HUSKY: 0
86+
87+
- name: Typecheck
88+
working-directory: apps/hobbies-helsinki
89+
run: |
90+
yarn typecheck
91+
92+
- name: Linter
93+
working-directory: apps/hobbies-helsinki
94+
run: |
95+
yarn lint
96+
97+
- name: Unit tests
98+
working-directory: apps/hobbies-helsinki
99+
run: |
100+
yarn test --coverage
101+
env:
102+
TZ: Europe/Helsinki
103+
FEDERATION_ROUTER_ENDPOINT: ${{env.FEDERATION_ROUTER_ENDPOINT}}
104+
CMS_ORIGIN: ${{env.CMS_ORIGIN}}
105+
LINKEDEVENTS_EVENT_ENDPOINT: ${{env.LINKEDEVENTS_EVENT_ENDPOINT}}
106+
# Mock origin
107+
NEXT_PUBLIC_APP_ORIGIN: https://localhost:3001
108+
109+
- name: SonarQube Cloud Scan
110+
uses: SonarSource/sonarqube-scan-action@v5.1.0
111+
env:
112+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
113+
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
114+
115+
- name: Build web-app
116+
working-directory: apps/hobbies-helsinki
117+
run: |
118+
yarn build
119+
env:
120+
# Speed up build: they are linted in a previous step
121+
NEXTJS_IGNORE_ESLINT: true
122+
# Speed up build: they are typechecked in a previous step
123+
NEXTJS_IGNORE_TYPECHECK: true
124+
# Speed up build: don't run if not needed, enable if it becomes needed
125+
NEXT_DISABLE_SOURCEMAPS: true
126+
# Don't send telemetry for ci
127+
NEXT_TELEMETRY_DISABLED: true
128+
# To allow checking size-limits
129+
NEXTJS_DISABLE_SENTRY: false
130+
# Fully disable sentry upload
131+
NEXTJS_SENTRY_UPLOAD_DRY_RUN: true
132+
FEDERATION_ROUTER_ENDPOINT: ${{env.FEDERATION_ROUTER_ENDPOINT}}
133+
CMS_ORIGIN: ${{env.CMS_ORIGIN}}
134+
LINKEDEVENTS_EVENT_ENDPOINT: ${{env.LINKEDEVENTS_EVENT_ENDPOINT}}
135+
# Mock origin
136+
NEXT_PUBLIC_APP_ORIGIN: https://localhost:3001
137+
NEXT_PUBLIC_MATOMO_URL_BASE: '//webanalytics.digiaiiris.com/js/'
138+
NEXT_PUBLIC_MATOMO_SITE_ID: 939
139+
NEXT_PUBLIC_MATOMO_SRC_URL: 'piwik.min.js'
140+
NEXT_PUBLIC_MATOMO_TRACKER_URL: 'tracker.php'
141+
NEXT_PUBLIC_MATOMO_ENABLED: 0
142+
143+
- name: Check browser bundle size limits
144+
working-directory: apps/hobbies-helsinki
145+
run: |
146+
yarn check-size
147+
148+
- name: Check ecmascript checks for build files
149+
working-directory: apps/hobbies-helsinki
150+
run: |
151+
yarn check-dist

.github/workflows/ci-monorepo-integrity.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,10 @@ jobs:
2727
matrix:
2828
node-version: [16.x]
2929
steps:
30-
- uses: actions/checkout@v3
30+
- uses: actions/checkout@v4
3131

3232
- name: Use Node.js ${{ matrix.node-version }}
33-
uses: actions/setup-node@v3
33+
uses: actions/setup-node@v4
3434
with:
3535
node-version: ${{ matrix.node-version }}
3636

@@ -41,7 +41,7 @@ jobs:
4141
run: echo "::set-output name=dir::$(yarn config get cacheFolder)"
4242

4343
- name: Restore yarn cache
44-
uses: actions/cache@v3
44+
uses: actions/cache@v4
4545
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
4646
with:
4747
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}

.github/workflows/ci-packages.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,14 +38,14 @@ jobs:
3838
matrix:
3939
node-version: [16.x]
4040
steps:
41-
- uses: actions/checkout@v3
41+
- uses: actions/checkout@v4
4242
with:
4343
# Fetch all git history so that yarn workspaces --since can compare with the correct commits
4444
# @link https://github.com/actions/checkout#fetch-all-history-for-all-tags-and-branches
4545
fetch-depth: 0
4646

4747
- name: Use Node.js ${{ matrix.node-version }}
48-
uses: actions/setup-node@v3
48+
uses: actions/setup-node@v4
4949
with:
5050
node-version: ${{ matrix.node-version }}
5151

@@ -56,7 +56,7 @@ jobs:
5656
run: echo "::set-output name=dir::$(yarn config get cacheFolder)"
5757

5858
- name: Restore yarn cache
59-
uses: actions/cache@v3
59+
uses: actions/cache@v4
6060
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
6161
with:
6262
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
@@ -65,7 +65,7 @@ jobs:
6565
yarn-cache-folder-
6666
6767
- name: Restore packages cache
68-
uses: actions/cache@v3
68+
uses: actions/cache@v4
6969
with:
7070
path: |
7171
${{ github.workspace }}/.cache

0 commit comments

Comments
 (0)