3737 LINKEDEVENTS_EVENT_ENDPOINT : https://api.hel.fi/linkedevents/v1/event
3838
3939jobs :
40- test :
40+ build :
41+ name : Lint and build
4142 runs-on : ubuntu-latest
4243 strategy :
4344 matrix :
@@ -49,71 +50,14 @@ jobs:
4950 uses : actions/setup-node@v4
5051 with :
5152 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') }}-
53+ cache : ' yarn'
8054
8155 - name : Install dependencies
8256 run : |
8357 yarn install --immutable --inline-builds
8458 env :
8559 HUSKY : 0
8660
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- with :
112- projectBaseDir : apps/hobbies-helsinki
113- env :
114- GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
115- SONAR_TOKEN : ${{ secrets.SONAR_TOKEN }}
116-
11761 - name : Build web-app
11862 working-directory : apps/hobbies-helsinki
11963 run : |
@@ -151,3 +95,55 @@ jobs:
15195 working-directory : apps/hobbies-helsinki
15296 run : |
15397 yarn check-dist
98+
99+ test :
100+ name : Test
101+ runs-on : ubuntu-latest
102+ strategy :
103+ matrix :
104+ node-version : [20.x]
105+ steps :
106+ - uses : actions/checkout@v4
107+
108+ - name : Use Node.js ${{ matrix.node-version }}
109+ uses : actions/setup-node@v4
110+ with :
111+ node-version : ${{ matrix.node-version }}
112+ cache : ' yarn'
113+
114+ - name : Install dependencies
115+ run : |
116+ yarn install --immutable --inline-builds
117+ env :
118+ HUSKY : 0
119+
120+ - name : Typecheck
121+ working-directory : apps/hobbies-helsinki
122+ run : |
123+ yarn typecheck
124+
125+ - name : Linter
126+ working-directory : apps/hobbies-helsinki
127+ run : |
128+ yarn lint
129+
130+ - name : Unit tests
131+ working-directory : apps/hobbies-helsinki
132+ run : |
133+ yarn test --coverage
134+ env :
135+ TZ : Europe/Helsinki
136+ FEDERATION_ROUTER_ENDPOINT : ${{env.FEDERATION_ROUTER_ENDPOINT}}
137+ CMS_ORIGIN : ${{env.CMS_ORIGIN}}
138+ LINKEDEVENTS_EVENT_ENDPOINT : ${{env.LINKEDEVENTS_EVENT_ENDPOINT}}
139+ # Mock origin
140+ NEXT_PUBLIC_APP_ORIGIN : https://localhost:3001
141+
142+ - name : SonarQube Cloud Scan
143+ uses : SonarSource/sonarqube-scan-action@v5.1.0
144+ with :
145+ projectBaseDir : apps/hobbies-helsinki
146+ env :
147+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
148+ SONAR_TOKEN : ${{ secrets.SONAR_TOKEN }}
149+
0 commit comments