From 6556e4a084dfbccee668e89d66f55f2308a74e97 Mon Sep 17 00:00:00 2001 From: Jamie Snape Date: Wed, 25 Nov 2026 21:36:27 -0500 Subject: [PATCH] Update Dockerfile and add Docker/hadolint CI workflows Signed-off-by: Jamie Snape --- .github/hadolint-matcher.json | 16 ++++ .github/hadolint-matcher.json.license | 31 ++++++++ .github/workflows/actionlint.yml | 14 ++++ .github/workflows/actions-lock.yml | 8 ++ .github/workflows/actions.lock | 16 ++++ .github/workflows/buildifier.yml | 20 +++++ .github/workflows/docker.yml | 89 ++++++++++++++++++++++ .github/workflows/hadolint.yml | 104 ++++++++++++++++++++++++++ .github/workflows/yamllint.yml | 8 ++ Dockerfile | 41 +++++++--- QUALITY_DECLARATION.md | 15 ++++ 11 files changed, 352 insertions(+), 10 deletions(-) create mode 100644 .github/hadolint-matcher.json create mode 100644 .github/hadolint-matcher.json.license create mode 100644 .github/workflows/docker.yml create mode 100644 .github/workflows/hadolint.yml diff --git a/.github/hadolint-matcher.json b/.github/hadolint-matcher.json new file mode 100644 index 0000000..be8e5f6 --- /dev/null +++ b/.github/hadolint-matcher.json @@ -0,0 +1,16 @@ +{ + "problemMatcher": [ + { + "owner": "hadolint", + "pattern": [ + { + "regexp": "^(.+):(\\d+) (\\S+) ((?:error|warning|info|style): .+)$", + "file": 1, + "line": 2, + "code": 3, + "message": 4 + } + ] + } + ] +} diff --git a/.github/hadolint-matcher.json.license b/.github/hadolint-matcher.json.license new file mode 100644 index 0000000..a5dcf3f --- /dev/null +++ b/.github/hadolint-matcher.json.license @@ -0,0 +1,31 @@ +hadolint-matcher.json +AVO2 Library + +SPDX-FileCopyrightText: 2010 University of North Carolina at Chapel Hill +SPDX-License-Identifier: Apache-2.0 + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +Please send all bug reports to . + +The authors may be contacted via: + +Jur van den Berg, Jamie Snape, Stephen J. Guy, and Dinesh Manocha +Dept. of Computer Science +201 S. Columbia St. +Frederick P. Brooks, Jr. Computer Science Bldg. +Chapel Hill, N.C. 27599-3175 +United States of America + + + diff --git a/.github/workflows/actionlint.yml b/.github/workflows/actionlint.yml index 84854c6..0ec3288 100644 --- a/.github/workflows/actionlint.yml +++ b/.github/workflows/actionlint.yml @@ -39,9 +39,23 @@ on: # yamllint disable-line rule:truthy push: branches: - main + paths: + - .github/actionlint-matcher.json + - .github/actionlint.yaml + - .github/actionlint.yml + - .github/workflows/*.yaml + - .github/workflows/*.yml + - .shellcheckrc pull_request: branches: - main + paths: + - .github/actionlint-matcher.json + - .github/actionlint.yaml + - .github/actionlint.yml + - .github/workflows/*.yaml + - .github/workflows/*.yml + - .shellcheckrc schedule: - cron: '40 7 * * *' diff --git a/.github/workflows/actions-lock.yml b/.github/workflows/actions-lock.yml index e9a3550..cf53f0e 100644 --- a/.github/workflows/actions-lock.yml +++ b/.github/workflows/actions-lock.yml @@ -39,9 +39,17 @@ on: # yamllint disable-line rule:truthy push: branches: - main + paths: + - .github/workflows/actions.lock + - .github/workflows/*.yaml + - .github/workflows/*.yml pull_request: branches: - main + paths: + - .github/workflows/actions.lock + - .github/workflows/*.yaml + - .github/workflows/*.yml permissions: contents: read diff --git a/.github/workflows/actions.lock b/.github/workflows/actions.lock index f3cfe8c..c24b3c6 100644 --- a/.github/workflows/actions.lock +++ b/.github/workflows/actions.lock @@ -17,6 +17,12 @@ workflows: '.github/workflows/codeql.yml': - 'actions/checkout@v7.0.1' - 'github/codeql-action@v4.39.5' + '.github/workflows/docker.yml': + - 'actions/checkout@v7.0.1' + - 'docker/build-push-action@v7.4.0' + - 'docker/setup-buildx-action@v4.4.1' + '.github/workflows/hadolint.yml': + - 'actions/checkout@v7.0.1' '.github/workflows/reuse.yml': - 'actions/checkout@v7.0.1' - 'fsfe/reuse-action@v6.0.0' @@ -33,6 +39,16 @@ dependencies: commit: 'sha1-3d3c42e5aac5ba805825da76410c181273ba90b1' owner_id: 44036562 repo_id: 197814629 + 'docker/build-push-action@v7.4.0': + ref: 'v7.4.0' + commit: 'sha1-c3c9e263c25d99ce0380d002d59b67737d91b0dc' + owner_id: 5429470 + repo_id: 241092383 + 'docker/setup-buildx-action@v4.4.1': + ref: 'v4.4.1' + commit: 'sha1-f87e5991a6d7451dcb8d9637bfbc97413f497069' + owner_id: 5429470 + repo_id: 288485773 'fsfe/reuse-action@v6.0.0': ref: 'v6.0.0' commit: 'sha1-676e2d560c9a403aa252096d99fcab3e1132b0f5' diff --git a/.github/workflows/buildifier.yml b/.github/workflows/buildifier.yml index 8da94e8..78ef0d5 100644 --- a/.github/workflows/buildifier.yml +++ b/.github/workflows/buildifier.yml @@ -39,9 +39,29 @@ on: # yamllint disable-line rule:truthy push: branches: - main + paths: + - '**/*.bzl' + - '**/BUILD' + - '**/BUILD.bazel' + - '**/MODULE.bazel' + - '**/WORKSPACE' + - '**/WORKSPACE.bazel' + - '**/WORKSPACE.bzlmod' + - .buildifier.json + - .github/workflows/buildifier.yml pull_request: branches: - main + paths: + - '**/*.bzl' + - '**/BUILD' + - '**/BUILD.bazel' + - '**/MODULE.bazel' + - '**/WORKSPACE' + - '**/WORKSPACE.bazel' + - '**/WORKSPACE.bzlmod' + - .buildifier.json + - .github/workflows/buildifier.yml schedule: - cron: '50 7 * * *' diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml new file mode 100644 index 0000000..bc7ada9 --- /dev/null +++ b/.github/workflows/docker.yml @@ -0,0 +1,89 @@ +# +# docker.yml +# AVO2 Library +# +# SPDX-FileCopyrightText: 2010 University of North Carolina at Chapel Hill +# SPDX-License-Identifier: Apache-2.0 +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Please send all bug reports to . +# +# The authors may be contacted via: +# +# Jur van den Berg, Jamie Snape, Stephen J. Guy, and Dinesh Manocha +# Dept. of Computer Science +# 201 S. Columbia St. +# Frederick P. Brooks, Jr. Computer Science Bldg. +# Chapel Hill, N.C. 27599-3175 +# United States of America +# +# +# + +# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json +--- +name: docker + +on: # yamllint disable-line rule:truthy + push: + branches: + - main + paths: + - Dockerfile + - .dockerignore + - .github/workflows/docker.yml + pull_request: + branches: + - main + paths: + - Dockerfile + - .dockerignore + - .github/workflows/docker.yml + schedule: + - cron: '20 8 * * 3' + +permissions: + contents: read + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: ${{ github.event_name == 'pull_request' }} + +jobs: + docker: + name: docker ${{ matrix.name }} + runs-on: ${{ matrix.runner }} + timeout-minutes: 60 + strategy: + fail-fast: false + matrix: + include: + - name: amd64 + runner: ubuntu-latest + - name: arm64 + runner: ubuntu-26.04-arm + steps: + - name: checkout + uses: actions/checkout@v7.0.1 + with: + persist-credentials: false + - name: setup buildx + uses: docker/setup-buildx-action@v4.4.1 + - name: build + uses: docker/build-push-action@v7.4.0 + with: + context: . + push: false + cache-from: type=gha,scope=${{ matrix.name }} + cache-to: type=gha,mode=max,scope=${{ matrix.name }} diff --git a/.github/workflows/hadolint.yml b/.github/workflows/hadolint.yml new file mode 100644 index 0000000..8dccd01 --- /dev/null +++ b/.github/workflows/hadolint.yml @@ -0,0 +1,104 @@ +# +# hadolint.yml +# AVO2 Library +# +# SPDX-FileCopyrightText: 2010 University of North Carolina at Chapel Hill +# SPDX-License-Identifier: Apache-2.0 +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Please send all bug reports to . +# +# The authors may be contacted via: +# +# Jur van den Berg, Jamie Snape, Stephen J. Guy, and Dinesh Manocha +# Dept. of Computer Science +# 201 S. Columbia St. +# Frederick P. Brooks, Jr. Computer Science Bldg. +# Chapel Hill, N.C. 27599-3175 +# United States of America +# +# +# + +# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json +--- +name: hadolint + +on: # yamllint disable-line rule:truthy + push: + branches: + - main + paths: + - .github/hadolint-matcher.json + - .github/workflows/hadolint.yml + - .hadolint.yaml + - .hadolint.yml + - Dockerfile + pull_request: + branches: + - main + paths: + - .github/hadolint-matcher.json + - .github/workflows/hadolint.yml + - .hadolint.yaml + - .hadolint.yml + - Dockerfile + schedule: + - cron: '50 7 * * *' + +permissions: + contents: read + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: ${{ github.event_name == 'pull_request' }} + +jobs: + hadolint: + name: hadolint + runs-on: ubuntu-latest + container: debian:trixie-slim + timeout-minutes: 20 + steps: + - name: setup + run: | + apt-get -qq -o APT::Acquire::Retries=4 update \ + || (sleep 15; apt-get -qq -o APT::Acquire::Retries=4 update) + apt-get -qq -o APT::Acquire::Retries=4 -o Dpkg::Use-Pty=0 \ + upgrade + apt-get -qq -o APT::Acquire::Retries=4 -o Dpkg::Use-Pty=0 \ + --no-install-recommends install \ + ca-certificates \ + git \ + wget + apt-get -qq -o Dpkg::Use-Pty=0 autoremove + rm -rf /var/lib/apt/lists/* + wget --tries=4 --waitretry=15 --retry-on-http-error=429,500,502,503,504 \ + -qO /usr/local/bin/hadolint \ + https://github.com/hadolint/hadolint/releases/latest/download/hadolint-linux-x86_64 + chmod +x /usr/local/bin/hadolint + env: + DEBIAN_FRONTEND: noninteractive + shell: bash + - name: checkout + uses: actions/checkout@v7.0.1 + with: + persist-credentials: false + - name: add problem matcher + run: | + echo "::add-matcher::${GITHUB_WORKSPACE}/.github/hadolint-matcher.json" + shell: bash + - name: hadolint + run: hadolint Dockerfile + shell: bash diff --git a/.github/workflows/yamllint.yml b/.github/workflows/yamllint.yml index c98ac6a..1ed7a79 100644 --- a/.github/workflows/yamllint.yml +++ b/.github/workflows/yamllint.yml @@ -39,9 +39,17 @@ on: # yamllint disable-line rule:truthy push: branches: - main + paths: + - '**/*.yaml' + - '**/*.yml' + - .yamllint pull_request: branches: - main + paths: + - '**/*.yaml' + - '**/*.yml' + - .yamllint schedule: - cron: '30 7 * * *' diff --git a/Dockerfile b/Dockerfile index 804f2ac..442c9dd 100644 --- a/Dockerfile +++ b/Dockerfile @@ -36,7 +36,7 @@ FROM ubuntu:26.04 ARG TARGETARCH LABEL org.opencontainers.image.authors="Jur van den Berg, Jamie Snape, Stephen J. Guy, and Dinesh Manocha" -LABEL org.opencontainers.image.base.name="docker.io/library/ubuntu:latest" +LABEL org.opencontainers.image.base.name="docker.io/library/ubuntu:26.04" LABEL org.opencontainers.image.description="Reciprocal Collision Avoidance with Acceleration-Velocity Obstacles" LABEL org.opencontainers.image.licenses="Apache-2.0" LABEL org.opencontainers.image.source="https://github.com/snape/AVO2/" @@ -47,16 +47,22 @@ LABEL org.opencontainers.image.version="1.0.1" ENV LANG=C.UTF-8 ENV LOGNAME=root ENV USER=root +SHELL ["/bin/bash", "-o", "pipefail", "-c"] +# hadolint ignore=DL3008,DL3013 RUN export DEBIAN_FRONTEND=noninteractive \ && apt-get update -qq \ && apt-get install --no-install-recommends -o Dpkg::Use-Pty=0 -qy \ ca-certificates \ clang \ + clang-format \ clang-tidy \ + clang-tools \ cmake \ cmake-format \ + codespell \ cppcheck \ cpplint \ + curl \ dirmngr \ doxygen \ dpkg-dev \ @@ -65,54 +71,69 @@ RUN export DEBIAN_FRONTEND=noninteractive \ gdb \ git \ gnupg \ + gcovr \ graphviz \ iwyu \ jsonlint \ - lcov \ lldb \ make \ markdownlint \ + meson \ nano \ netbase \ ninja-build \ openssh-client \ pkgconf \ + pipx \ python3 \ python3-click \ python3-dateutil \ python3-docopt \ python3-jsonschema \ + python3-pathspec \ python3-pip \ + python3-pygments \ python3-pykwalify \ python3-requests \ python3-ruamel.yaml \ python3-venv \ reuse \ + shellcheck \ strace \ sudo \ valgrind \ yamllint \ && rm -rf /var/lib/apt/lists/* \ - && wget -q https://github.com/bazelbuild/bazelisk/releases/latest/download/bazelisk-${TARGETARCH:-amd64}.deb \ + && curl -fsSLO \ + https://github.com/bazelbuild/bazelisk/releases/latest/download/bazelisk-${TARGETARCH:-amd64}.deb \ && dpkg -i bazelisk-${TARGETARCH:-amd64}.deb \ && rm -rf bazelisk-${TARGETARCH:-amd64}.deb \ - && wget -qO /usr/local/bin/buildifier \ + && curl -fsSL \ https://github.com/bazelbuild/buildtools/releases/latest/download/buildifier-linux-${TARGETARCH:-amd64} \ - && wget -qO /usr/local/bin/buildozer \ + -o /usr/local/bin/buildifier \ + && curl -fsSL \ https://github.com/bazelbuild/buildtools/releases/latest/download/buildozer-linux-${TARGETARCH:-amd64} \ + -o /usr/local/bin/buildozer \ + && curl -fsSL \ + "https://github.com/hadolint/hadolint/releases/latest/download/hadolint-linux-$([ "${TARGETARCH:-amd64}" = "arm64" ] && echo arm64 || echo x86_64)" \ + -o /usr/local/bin/hadolint \ && chmod +x \ /usr/local/bin/buildifier \ /usr/local/bin/buildozer \ - && python3 -m venv --system-site-packages /home/ubuntu/.venv \ - && . /home/ubuntu/.venv/bin/activate \ - && pip install --no-cache-dir -qq \ + /usr/local/bin/hadolint \ + && curl -fsSL \ + https://raw.githubusercontent.com/rhysd/actionlint/main/scripts/download-actionlint.bash \ + | bash -s -- '' /usr/local/bin \ + && pipx install --global \ cffconvert \ + check-jsonschema \ + lizard \ + pre-commit \ && echo "ubuntu ALL=(root) NOPASSWD:ALL" > /etc/sudoers.d/ubuntu \ && chmod 0440 /etc/sudoers.d/ubuntu ENV LOGNAME=ubuntu -ENV PATH="/home/ubuntu/.venv/bin:${PATH}" ENV SHELL=/bin/bash ENV USER=ubuntu -ENV VIRTUAL_ENV=/home/ubuntu/.venv +# hadolint ignore=DL3066 USER ubuntu WORKDIR /workspace diff --git a/QUALITY_DECLARATION.md b/QUALITY_DECLARATION.md index bac2e67..b3a7b2a 100644 --- a/QUALITY_DECLARATION.md +++ b/QUALITY_DECLARATION.md @@ -118,9 +118,16 @@ maintainer [@snape](https://github.com/snape) before merging. CI is performed via GitHub Actions on every push and pull request to `main`, and on a daily schedule: +- [`.github/workflows/actionlint.yml`](.github/workflows/actionlint.yml): + validates GitHub Actions workflow files with actionlint. +- [`.github/workflows/actions-lock.yml`](.github/workflows/actions-lock.yml): + verifies pinned GitHub Actions dependencies in + [`.github/workflows/actions.lock`](.github/workflows/actions.lock). - [`.github/workflows/bazel.yml`](.github/workflows/bazel.yml): builds and tests with Bazel on AlmaLinux, Arch Linux, Fedora, openSUSE, Ubuntu (amd64 and arm64), macOS (arm64), and Windows (amd64 and arm64). +- [`.github/workflows/buildifier.yml`](.github/workflows/buildifier.yml): + enforces Bazel file formatting with buildifier. - [`.github/workflows/cmake.yml`](.github/workflows/cmake.yml): builds and tests with CMake on AlmaLinux, Alpine Linux, Arch Linux, Fedora, openSUSE, Ubuntu (amd64 and arm64), macOS (arm64), and Windows (amd64 and arm64). CMake builds @@ -129,6 +136,14 @@ and on a daily schedule: `WARNINGS_AS_ERRORS`. - [`.github/workflows/codeql.yml`](.github/workflows/codeql.yml): runs GitHub CodeQL semantic code analysis for C++ on a weekly schedule. +- [`.github/workflows/docker.yml`](.github/workflows/docker.yml): builds the + development environment Docker image (amd64 and arm64) on a weekly schedule. +- [`.github/workflows/hadolint.yml`](.github/workflows/hadolint.yml): lints + the Dockerfile with hadolint. +- [`.github/workflows/reuse.yml`](.github/workflows/reuse.yml): verifies + REUSE license compliance. +- [`.github/workflows/yamllint.yml`](.github/workflows/yamllint.yml): lints + all YAML files with yamllint. ### Documentation Policy [2.v]