diff --git a/.eslintignore b/.eslintignore new file mode 100644 index 0000000..a48cf0d --- /dev/null +++ b/.eslintignore @@ -0,0 +1 @@ +public diff --git a/.github/workflows/automerger.yml b/.github/workflows/automerger.yml index 78607f4..ee097e9 100644 --- a/.github/workflows/automerger.yml +++ b/.github/workflows/automerger.yml @@ -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: diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..94f01b3 --- /dev/null +++ b/.github/workflows/ci.yml @@ -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 diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index 5acb039..d4df176 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -1,3 +1,5 @@ +name: 'CodeQL' + on: push: branches: diff --git a/.github/workflows/ct.yml b/.github/workflows/ct.yml index f7b55c3..b1cfd34 100644 --- a/.github/workflows/ct.yml +++ b/.github/workflows/ct.yml @@ -1,12 +1,7 @@ name: 'Continuous Testing' on: - push: - branches: - - master - pull_request: - branches: - - master + workflow_call: permissions: checks: write diff --git a/.github/workflows/pipeline.yml b/.github/workflows/pipeline.yml new file mode 100644 index 0000000..8432a18 --- /dev/null +++ b/.github/workflows/pipeline.yml @@ -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 diff --git a/.hadolint.yml b/.hadolint.yml new file mode 100644 index 0000000..438a9dd --- /dev/null +++ b/.hadolint.yml @@ -0,0 +1,3 @@ +ignored: + - DL3008 + - DL3015 diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 0000000..a48cf0d --- /dev/null +++ b/.prettierignore @@ -0,0 +1 @@ +public diff --git a/Dockerfile b/Dockerfile index 0644af3..632d74c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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; \