Skip to content

Commit 20d3e34

Browse files
committed
wip
1 parent f96fb14 commit 20d3e34

2 files changed

Lines changed: 47 additions & 1 deletion

File tree

.github/workflows/pr-pipeline.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
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+
12+
jobs:
13+
build-check-test:
14+
name: Build, check, test
15+
runs-on: ubuntu-latest
16+
steps:
17+
- name: Checkout
18+
uses: actions/checkout@v4
19+
with:
20+
clean: 'true'
21+
fetch-depth: 2
22+
23+
- name: Lowercase Docker Image Name
24+
run: echo "IMAGE_NAME=${IMAGE_NAME,,}" >> "${GITHUB_ENV}"
25+
26+
- name: Setup Docker Buildx
27+
uses: docker/setup-buildx-action@v3
28+
29+
- name: Build tester image
30+
uses: docker/build-push-action@v6
31+
with:
32+
context: .
33+
load: true
34+
target: "${{ env.TEST_STAGE }}"
35+
tags: "${{ env.IMAGE_NAME }}:${{ env.TEST_STAGE }}"
36+
37+
- name: Run checks and tests inside Docker
38+
run: docker run --rm "${{ env.IMAGE_NAME }}:${{ env.TEST_STAGE }}"

Dockerfile

Lines changed: 9 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,14 @@ RUN yarn install && yarn cache clean
2727

2828
COPY . ${WORK}
2929

30+
# tester stage: install devDependencies and run linting; exits non-zero on failures
31+
FROM base AS tester
32+
RUN NODE_ENV=development yarn install && yarn cache clean
33+
RUN node_modules/.bin/eslint .
34+
35+
# production stage: download map data and run the server
36+
FROM base AS production
37+
3038
RUN mkdir -p ${DATA_DIR}
3139

3240
# OpenMapTiles dataset generated by hsldevcom

0 commit comments

Comments
 (0)