Skip to content
Open

wip #143

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 38 additions & 0 deletions .github/workflows/pr-pipeline.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: PR pipeline

on:
pull_request:
branches:
- develop

env:
IMAGE_NAME: hsldevcom/hsl-map-server
TEST_STAGE: tester

jobs:
build-check-test:
name: Build, check, test
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
clean: 'true'
fetch-depth: 2

- name: Lowercase Docker Image Name
run: echo "IMAGE_NAME=${IMAGE_NAME,,}" >> "${GITHUB_ENV}"

- name: Setup Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Build tester image
uses: docker/build-push-action@v6
with:
context: .
load: true
target: "${{ env.TEST_STAGE }}"
tags: "${{ env.IMAGE_NAME }}:${{ env.TEST_STAGE }}"

- name: Run checks and tests inside Docker
run: docker run --rm "${{ env.IMAGE_NAME }}:${{ env.TEST_STAGE }}"
10 changes: 9 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
FROM node:16-bullseye-slim
FROM node:16-bullseye-slim AS base

ENV WORK=/opt/hsl-map-server
ENV DATA_DIR=${WORK}/data
ENV NODE_OPTS ""

Check warning on line 5 in Dockerfile

View workflow job for this annotation

GitHub Actions / Build, check, test

Legacy key/value format with whitespace separator should not be used

LegacyKeyValueFormat: "ENV key=value" should be used instead of legacy "ENV key value" format More info: https://docs.docker.com/go/dockerfile/rule/legacy-key-value-format/
ENV NODE_ENV=production

RUN apt-get update \
Expand All @@ -27,6 +27,14 @@

COPY . ${WORK}

# tester stage: install devDependencies and run linting; exits non-zero on failures
FROM base AS tester
RUN NODE_ENV=development yarn install && yarn cache clean
RUN node_modules/.bin/eslint .

# production stage: download map data and run the server
FROM base AS production

RUN mkdir -p ${DATA_DIR}

# OpenMapTiles dataset generated by hsldevcom
Expand Down
Loading