Skip to content

Commit 9ca0920

Browse files
committed
wip
1 parent f96fb14 commit 9ca0920

2 files changed

Lines changed: 56 additions & 1 deletion

File tree

.github/workflows/pr-pipeline.yml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: PR pipeline
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- develop
7+
8+
env:
9+
IMAGE_NAME: hsldevcom/hsl-map-server
10+
TEST_STAGE: tester
11+
PRODUCTION_STAGE: production
12+
13+
jobs:
14+
build-check-test:
15+
name: Build, check, test
16+
runs-on: ubuntu-latest
17+
steps:
18+
- name: Checkout
19+
uses: actions/checkout@v4
20+
with:
21+
clean: 'true'
22+
fetch-depth: 2
23+
24+
- name: Install Node
25+
uses: actions/setup-node@v4
26+
with:
27+
node-version: "lts/*"
28+
cache: "yarn"
29+
30+
- name: Install dependencies
31+
run: yarn install --frozen-lockfile
32+
33+
- name: Lowercase Docker Image Name
34+
run: echo "IMAGE_NAME=${IMAGE_NAME,,}" >> "${GITHUB_ENV}"
35+
36+
- name: Setup Docker Buildx
37+
uses: docker/setup-buildx-action@v3
38+
39+
- name: Build tester image
40+
uses: docker/build-push-action@v6
41+
with:
42+
context: .
43+
load: true
44+
target: "${{ env.TEST_STAGE }}"
45+
tags: "${{ env.IMAGE_NAME }}:${{ env.TEST_STAGE }}"
46+
47+
- name: Run checks and tests inside Docker
48+
run: docker run --rm "${{ env.IMAGE_NAME }}:${{ env.TEST_STAGE }}"

Dockerfile

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM node:16-bullseye-slim
1+
FROM node:16-bullseye-slim AS base
22

33
ENV WORK=/opt/hsl-map-server
44
ENV DATA_DIR=${WORK}/data
@@ -27,6 +27,13 @@ RUN yarn install && yarn cache clean
2727

2828
COPY . ${WORK}
2929

30+
# tester stage: run linting; exits non-zero on failures
31+
FROM base AS tester
32+
RUN yarn eslint .
33+
34+
# production stage: download map data and run the server
35+
FROM base AS production
36+
3037
RUN mkdir -p ${DATA_DIR}
3138

3239
# OpenMapTiles dataset generated by hsldevcom

0 commit comments

Comments
 (0)