build: add CI workflow 🕺 (#671)

* build: add CI workflow 🕺

Signed-off-by: Vinayak Kulkarni <19776877+vinayakkulkarni@users.noreply.github.com>

* refactor: use correct event in CT workflow

Signed-off-by: Vinayak Kulkarni <19776877+vinayakkulkarni@users.noreply.github.com>

* feat: setup Pipeline 🚰

Signed-off-by: Vinayak Kulkarni <19776877+vinayakkulkarni@users.noreply.github.com>

* style: fix lint issues in Dockerfile

Signed-off-by: Vinayak Kulkarni <19776877+vinayakkulkarni@users.noreply.github.com>

* refactor: automerger now requires CI & CT Workflows

Signed-off-by: Vinayak Kulkarni <19776877+vinayakkulkarni@users.noreply.github.com>

* chore: add name for CodeQL workflow

Signed-off-by: Vinayak Kulkarni <19776877+vinayakkulkarni@users.noreply.github.com>

* fix: add ignore files for prettier & eslint

Signed-off-by: Vinayak Kulkarni <19776877+vinayakkulkarni@users.noreply.github.com>

* chore(deps): bump pinned apt-get packages

Signed-off-by: Vinayak Kulkarni <19776877+vinayakkulkarni@users.noreply.github.com>

* feat: add `hadolint` config file

Signed-off-by: Vinayak Kulkarni <19776877+vinayakkulkarni@users.noreply.github.com>

* fix: correct workflow file for automerger

Signed-off-by: Vinayak Kulkarni <19776877+vinayakkulkarni@users.noreply.github.com>

* style: remove pinned versions of apt deps

Signed-off-by: Vinayak Kulkarni <19776877+vinayakkulkarni@users.noreply.github.com>

Signed-off-by: Vinayak Kulkarni <19776877+vinayakkulkarni@users.noreply.github.com>
This commit is contained in:
Vinayak Kulkarni 2023-01-10 20:31:26 +05:30 committed by GitHub
parent 687bbe1606
commit ab4f0ef4a1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 129 additions and 17 deletions

1
.eslintignore Normal file
View File

@ -0,0 +1 @@
public

View File

@ -1,9 +1,7 @@
name: 'Auto Merge PRs'
on:
pull_request:
branches:
- master
workflow_call:
permissions:
pull-requests: write
@ -12,8 +10,6 @@ permissions:
jobs:
automerge:
runs-on: ubuntu-latest
if: >
github.event_name == 'pull_request' && github.event.pull_request.user.login == 'dependabot[bot]'
steps:
- uses: fastify/github-action-merge-dependabot@v3
with:

51
.github/workflows/ci.yml vendored Normal file
View File

@ -0,0 +1,51 @@
name: 'Continuous Integration'
on:
workflow_call:
permissions:
checks: write
contents: read
jobs:
ci:
runs-on: ubuntu-20.04
steps:
- name: Check out repository ✨ (non-dependabot)
if: ${{ github.actor != 'dependabot[bot]' }}
uses: actions/checkout@v3
- name: Check out repository 🎉 (dependabot)
if: ${{ github.actor == 'dependabot[bot]' }}
uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Setup node env 📦
uses: actions/setup-node@v3
with:
node-version-file: 'package.json'
check-latest: true
cache: 'npm'
- name: Install dependencies 🚀
run: npm ci --prefer-offline --no-audit --omit=optional
- name: Run linter(s) 💅
uses: wearerequired/lint-action@v2
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
continue_on_error: false
git_name: github-actions[bot]
git_email: github-actions[bot]@users.noreply.github.com
auto_fix: false
eslint: true
eslint_extensions: js,cjs,mjs,ts
prettier: true
prettier_extensions: js,cjs,ts,json
- name: Run hadolint 🐳
uses: hadolint/hadolint-action@v3.0.0
with:
dockerfile: Dockerfile
ignore: DL3008,DL3015

View File

@ -1,3 +1,5 @@
name: 'CodeQL'
on:
push:
branches:

View File

@ -1,12 +1,7 @@
name: 'Continuous Testing'
on:
push:
branches:
- master
pull_request:
branches:
- master
workflow_call:
permissions:
checks: write

43
.github/workflows/pipeline.yml vendored Normal file
View File

@ -0,0 +1,43 @@
name: 'The Pipeline'
on:
push:
branches:
- master
pull_request:
branches:
- master
concurrency:
group: ci-${{ github.ref }}-1
cancel-in-progress: true
jobs:
extract-branch:
name: 'Fetch branch'
runs-on: ubuntu-latest
outputs:
current_branch: ${{ steps.get-branch.outputs.current_branch }}
steps:
- name: Extract branch name 🕊
id: get-branch
run: echo "current_branch=${GITHUB_REF##*/}" >> $GITHUB_OUTPUT
ci:
name: 'CI'
needs:
- extract-branch
uses: maptiler/tileserver-gl/.github/workflows/ci.yml@master
ct:
name: 'CT'
needs:
- extract-branch
uses: maptiler/tileserver-gl/.github/workflows/ct.yml@master
automerger:
name: 'Automerge Dependabot PRs'
needs:
- ci
- ct
- extract-branch
if: >
github.event_name == 'pull_request' && github.event.pull_request.user.login == 'dependabot[bot]'
uses: maptiler/tileserver-gl/.github/workflows/automerger.yml@master

3
.hadolint.yml Normal file
View File

@ -0,0 +1,3 @@
ignored:
- DL3008
- DL3015

1
.prettierignore Normal file
View File

@ -0,0 +1 @@
public

View File

@ -20,19 +20,32 @@ RUN set -ex; \
libjpeg-dev \
libgif-dev \
librsvg2-dev \
gir1.2-rsvg-2.0 \
librsvg2-2 \
librsvg2-common \
libcurl4-openssl-dev \
libpixman-1-dev; \
wget -qO- https://deb.nodesource.com/setup_18.x | bash; \
libpixman-1-dev \
libpixman-1-0; \
apt-get -y --purge autoremove; \
apt-get clean; \
rm -rf /var/lib/apt/lists/*;
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
RUN wget -qO- https://deb.nodesource.com/setup_18.x | bash; \
apt-get install -y nodejs; \
npm i -g npm@latest; \
apt-get -y remove wget; \
apt-get -y --purge autoremove; \
apt-get clean; \
rm -rf /var/lib/apt/lists/*;
RUN mkdir -p /usr/src/app
COPY package* /usr/src/app/
COPY package* /usr/src/app
RUN cd /usr/src/app && npm ci --omit=dev
WORKDIR /usr/src/app
RUN npm install --omit=dev
FROM ubuntu:focal AS final
@ -60,9 +73,16 @@ RUN set -ex; \
libpixman-1-0 \
libcurl4 \
librsvg2-2 \
libpango1.0; \
wget -qO- https://deb.nodesource.com/setup_18.x | bash; \
libpango-1.0-0; \
apt-get -y --purge autoremove; \
apt-get clean; \
rm -rf /var/lib/apt/lists/*;
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
RUN wget -qO- https://deb.nodesource.com/setup_18.x | bash; \
apt-get install -y nodejs; \
npm i -g npm@latest; \
apt-get -y remove wget; \
apt-get -y --purge autoremove; \
apt-get clean; \