Skip to content

Commit 357da24

Browse files
committed
build: proxies ci workflows
1 parent 6ed85ec commit 357da24

6 files changed

Lines changed: 74 additions & 82 deletions

File tree

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: Events Graphql Proxy check
2+
3+
on:
4+
push:
5+
branches: [main]
6+
# Only consider those paths to trigger the action
7+
paths:
8+
- 'proxies/events-graphql-proxy/**'
9+
- '.yarnrc.yml'
10+
- 'tsconfig.base.json'
11+
- '.prettier*'
12+
- '.github/workflows/**'
13+
14+
pull_request:
15+
branches: [main]
16+
# Only consider those paths to trigger the action
17+
paths:
18+
- 'proxies/events-graphql-proxy/**'
19+
- '.yarnrc.yml'
20+
- 'tsconfig.base.json'
21+
- '.prettier*'
22+
- '.github/workflows/**'
23+
workflow_dispatch:
24+
25+
jobs:
26+
common:
27+
uses: City-of-Helsinki/.github/.github/workflows/ci-node.yml@ci_node_parameters
28+
secrets: inherit
29+
with:
30+
node-version: 20
31+
typecheck: true
32+
app-directory: proxies/events-graphql-proxy
33+
extra-commands: |
34+
echo "NODE_ENV=production" >> $GITHUB_ENV
35+
echo "GRAPHQL_PROXY_DEBUG=debug" >> $GITHUB_ENV
36+
echo "GRAPHQL_PROXY_PORT=4100" >> $GITHUB_ENV
37+
echo "GRAPHQL_PROXY_SENTRY_ENVIRONMENT=local" >> $GITHUB_ENV
38+
echo "GRAPHQL_PROXY_DISABLE_WINSTON_LOGGING=0" >> $GITHUB_ENV
39+
echo "GRAPHQL_PROXY_INTROSPECTION=1" >> $GITHUB_ENV
40+
# events proxy only
41+
echo "GRAPHQL_PROXY_MAP_OPEN_DATA_API_BASE_URL=https://kartta.hel.fi/ws/geoserver/avoindata" >> $GITHUB_ENV
42+
echo "GRAPHQL_PROXY_API_BASE_URL=https://api.hel.fi/linkedevents/v1/" >> $GITHUB_ENV

.github/workflows/ci-venue-graphql-proxy-check.yml

Lines changed: 20 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,7 @@ name: Venue Graphql Proxy check
22

33
on:
44
push:
5-
branches:
6-
- dev
7-
- main
5+
branches: [main]
86
# Only consider those paths to trigger the action
97
paths:
108
- 'proxies/venue-graphql-proxy/**'
@@ -14,91 +12,31 @@ on:
1412
- '.github/workflows/**'
1513

1614
pull_request:
17-
types:
18-
- opened
19-
- synchronize
20-
- reopened
15+
branches: [main]
2116
# Only consider those paths to trigger the action
2217
paths:
2318
- 'proxies/venue-graphql-proxy/**'
2419
- '.yarnrc.yml'
2520
- 'tsconfig.base.json'
2621
- '.prettier*'
2722
- '.github/workflows/**'
28-
29-
env:
30-
NODE_ENV: development
31-
GRAPHQL_PROXY_DEBUG: debug
32-
GRAPHQL_PROXY_PORT: 4100
33-
GRAPHQL_PROXY_API_BASE_URL: https://api.hel.fi
34-
GRAPHQL_PROXY_MAP_OPEN_DATA_API_BASE_URL: https://kartta.hel.fi/ws/geoserver/avoindata
35-
GRAPHQL_PROXY_SENTRY_DSN:
36-
GRAPHQL_PROXY_SENTRY_ENVIRONMENT: local
23+
workflow_dispatch:
3724

3825
jobs:
39-
test:
40-
runs-on: ubuntu-latest
41-
strategy:
42-
matrix:
43-
node-version: [16.x]
44-
steps:
45-
- uses: actions/checkout@v4
46-
47-
- name: Use Node.js ${{ matrix.node-version }}
48-
uses: actions/setup-node@v4
49-
with:
50-
node-version: ${{ matrix.node-version }}
51-
52-
# Why not using setup-node 2.2+ cache option (yet) ?
53-
# see https://github.com/belgattitude/nextjs-monorepo-example/pull/369
54-
- name: Get yarn cache directory path
55-
id: yarn-cache-dir-path
56-
run: echo "::set-output name=dir::$(yarn config get cacheFolder)"
57-
58-
- name: Restore yarn cache
59-
uses: actions/cache@v4
60-
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
61-
with:
62-
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
63-
key: yarn-cache-folder-${{ hashFiles('**/yarn.lock', '.yarnrc.yml') }}
64-
restore-keys: |
65-
yarn-cache-folder-
66-
67-
- name: Install dependencies
68-
run: |
69-
yarn install --immutable --inline-builds
70-
env:
71-
HUSKY: 0
72-
73-
- name: Typecheck
74-
working-directory: proxies/venue-graphql-proxy
75-
run: |
76-
yarn typecheck
77-
78-
- name: Linter
79-
working-directory: proxies/venue-graphql-proxy
80-
run: |
81-
yarn lint
82-
83-
- name: Unit tests
84-
working-directory: proxies/venue-graphql-proxy
85-
run: |
86-
yarn test --coverage
87-
env:
88-
TZ: Europe/Helsinki
89-
NEXT_PUBLIC_FEDERATION_ROUTER_ENDPOINT: ${{env.NEXT_PUBLIC_FEDERATION_ROUTER_ENDPOINT}}
90-
NEXT_PUBLIC_CMS_ORIGIN: ${{env.NEXT_PUBLIC_CMS_ORIGIN}}
91-
# Mock origin
92-
NEXT_PUBLIC_APP_ORIGIN: https://localhost:3001
93-
94-
- name: Build web-app
95-
working-directory: proxies/venue-graphql-proxy
96-
run: |
97-
yarn build
98-
99-
- name: Check ecmascript checks for build files
100-
working-directory: proxies/venue-graphql-proxy
101-
run: |
102-
yarn check-dist
103-
- name: Upload coverage report to Codecov
104-
uses: codecov/codecov-action@v1
26+
common:
27+
uses: City-of-Helsinki/.github/.github/workflows/ci-node.yml@ci_node_parameters
28+
secrets: inherit
29+
with:
30+
node-version: 20
31+
typecheck: true
32+
app-directory: proxies/venue-graphql-proxy
33+
extra-commands: |
34+
echo "NODE_ENV=production" >> $GITHUB_ENV
35+
echo "GRAPHQL_PROXY_DEBUG=debug" >> $GITHUB_ENV
36+
echo "GRAPHQL_PROXY_PORT=4100" >> $GITHUB_ENV
37+
echo "GRAPHQL_PROXY_SENTRY_ENVIRONMENT=local" >> $GITHUB_ENV
38+
echo "GRAPHQL_PROXY_DISABLE_WINSTON_LOGGING=0" >> $GITHUB_ENV
39+
echo "GRAPHQL_PROXY_INTROSPECTION=1" >> $GITHUB_ENV
40+
# events proxy only
41+
echo "GRAPHQL_PROXY_MAP_OPEN_DATA_API_BASE_URL=https://kartta.hel.fi/ws/geoserver/avoindata" >> $GITHUB_ENV
42+
echo "GRAPHQL_PROXY_API_BASE_URL=https://api.hel.fi/linkedevents/v1/" >> $GITHUB_ENV

proxies/events-graphql-proxy/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
"dev": "nodemon --exec 'ts-node' src/index.ts",
1010
"start": "node build -r dotenv-expand/config",
1111
"test": "jest",
12+
"test:coverage": "jest --coverage",
1213
"prepare": "husky install",
1314
"pre-commit": "lint-fix",
1415
"lint": "eslint . --ext .ts,.tsx,.js,.jsx,.cjs,.mjs,.mdx,.graphql --cache --cache-location ../../.cache/eslint/events-graphql-proxy.eslintcache",
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
sonar.projectKey = City-of-Helsinki_events-graphql-proxy
2+
sonar.organization = city-of-helsinki
3+
sonar.exclusions = **/__tests__/**,**/browser-tests/**
4+
sonar.sources = src
5+
sonar.javascript.lcov.reportPaths = coverage/lcov.info

proxies/venue-graphql-proxy/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
"dev": "nodemon --exec 'ts-node' src/index.ts",
1010
"start": "node build -r dotenv-expand/config",
1111
"test": "jest --passWithNoTests",
12+
"test:coverage": "jest --passWithNoTests --coverage",
1213
"prepare": "husky install",
1314
"pre-commit": "lint-fix",
1415
"lint": "eslint . --ext .ts,.tsx,.js,.jsx,.cjs,.mjs,.mdx,.graphql --cache --cache-location ../../.cache/eslint/venue-graphql-proxy.eslintcache",
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
sonar.projectKey = City-of-Helsinki_venue-graphql-proxy
2+
sonar.organization = city-of-helsinki
3+
sonar.exclusions = **/__tests__/**,**/browser-tests/**
4+
sonar.sources = src
5+
sonar.javascript.lcov.reportPaths = coverage/lcov.info

0 commit comments

Comments
 (0)