From e8182113117d5de74811d23fd3417b57af72ce29 Mon Sep 17 00:00:00 2001 From: DeveloperC Date: Tue, 17 Jun 2025 18:50:50 +0100 Subject: [PATCH] ci: adding Makefile Renovate updating --- .github/{renovate.json => renovate.json5} | 12 ++++++++ .github/workflows/continuous-integration.yml | 23 +++++++-------- Makefile | 31 +++++++++++++++----- ci/compile.Dockerfile | 6 ++-- ci/unit-test.Dockerfile | 8 ++--- 5 files changed, 54 insertions(+), 26 deletions(-) rename .github/{renovate.json => renovate.json5} (75%) diff --git a/.github/renovate.json b/.github/renovate.json5 similarity index 75% rename from .github/renovate.json rename to .github/renovate.json5 index 83f2242..351cef7 100644 --- a/.github/renovate.json +++ b/.github/renovate.json5 @@ -36,6 +36,18 @@ "datasourceTemplate": "repology", "depNameTemplate": "alpine_{{alpineMajor}}_{{alpineMinor}}/{{name}}", "versioningTemplate": "loose" + }, + { + "customType": "regex", + "managerFilePatterns": [ + "/(^|/|\\.)Makefile$/", + "/(^|/)Makefile[^/]*$/" + ], + "matchStrings": [ + "# renovate: depName=(?.*?)\\s.+_VERSION=(?[a-z0-9.-]+)(?:@(?sha256:[a-f0-9]+))?" + ], + "datasourceTemplate": "docker", + "versioningTemplate": "docker" } ] } diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index 73bb1f9..8afba1d 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -2,19 +2,22 @@ name: Continuous Integration (CI) on: pull_request -env: - # Forcing Earthly to use colours, to make reading output easier. - FORCE_COLOR: 1 - jobs: + formatting: + name: Formatting + runs-on: ubuntu-latest + strategy: + matrix: + language: [shell] + steps: + - name: Checkout code. + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + - name: Check formatting. + run: make check-${{ matrix.language }}-formatting compile: name: Compile runs-on: ubuntu-latest steps: - - name: Download Earthly. - uses: earthly/actions-setup@43211c7a0eae5344d6d79fb4aaf209c8f8866203 # v1.0.13 - with: - version: v0.8.15 - name: Checkout code. uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - name: Compile. @@ -23,10 +26,6 @@ jobs: name: Unit Test runs-on: ubuntu-latest steps: - - name: Download Earthly. - uses: earthly/actions-setup@43211c7a0eae5344d6d79fb4aaf209c8f8866203 # v1.0.13 - with: - version: v0.8.15 - name: Checkout code. uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - name: Unit Test. diff --git a/Makefile b/Makefile index 92d3355..415af37 100644 --- a/Makefile +++ b/Makefile @@ -2,7 +2,7 @@ UID := $(shell id -u) GID := $(shell id -g) -.PHONY: check-clean-git-history check-conventional-commits-linting check-yaml-formatting fix-yaml-formatting check-github-actions-workflows-linting compile unit-test payload +.PHONY: check-clean-git-history check-conventional-commits-linting check-shell-formatting check-yaml-formatting fix-shell-formatting fix-yaml-formatting check-github-actions-workflows-linting compile unit-test payload check-clean-git-history: docker build -t check-clean-git-history -f ci/check-clean-git-history.Dockerfile . @@ -12,17 +12,34 @@ check-conventional-commits-linting: docker build -t check-conventional-commits-linting -f ci/check-conventional-commits-linting.Dockerfile . docker run --rm -v $(PWD):/workspace -u $(UID):$(GID) check-conventional-commits-linting $(FROM) +# renovate: depName=mvdan/shfmt +SHFMT_VERSION=v3.11.0-alpine@sha256:394d755b6007056a2e6d7537ccdbdcfca01b9855ba91e99df0166ca039c9d422 + +check-shell-formatting: + docker pull mvdan/shfmt:$(SHFMT_VERSION) + docker run --rm -v $(PWD):/workspace -w /workspace -u $(UID):$(GID) mvdan/shfmt:$(SHFMT_VERSION) --simplify --diff ci/* + +# renovate: depName=ghcr.io/google/yamlfmt +YAMLFMT_VERSION=0.17.0@sha256:b4ebf4ff064f5bcf779ef4799dad1fc52542e137677699210aea2de2b270e97f + check-yaml-formatting: - docker pull ghcr.io/google/yamlfmt:0.17.0 - docker run --rm -v $(PWD):/workspace -u $(UID):$(GID) ghcr.io/google/yamlfmt:0.17.0 -verbose -lint -dstar .github/workflows/* + docker pull ghcr.io/google/yamlfmt:$(YAMLFMT_VERSION) + docker run --rm -v $(PWD):/workspace -u $(UID):$(GID) ghcr.io/google/yamlfmt:$(YAMLFMT_VERSION) -verbose -lint -dstar .github/workflows/* + +fix-shell-formatting: + docker pull mvdan/shfmt:$(SHFMT_VERSION) + docker run --rm -v $(PWD):/workspace -w /workspace -u $(UID):$(GID) mvdan/shfmt:$(SHFMT_VERSION) --simplify --write ci/* fix-yaml-formatting: - docker pull ghcr.io/google/yamlfmt:0.17.0 - docker run --rm -v $(PWD):/workspace -u $(UID):$(GID) ghcr.io/google/yamlfmt:0.17.0 -verbose -dstar .github/workflows/* + docker pull ghcr.io/google/yamlfmt:$(YAMLFMT_VERSION) + docker run --rm -v $(PWD):/workspace -u $(UID):$(GID) ghcr.io/google/yamlfmt:$(YAMLFMT_VERSION) -verbose -dstar .github/workflows/* + +# renovate: depName=rhysd/actionlint +ACTIONLINT_VERSION=1.7.7@sha256:887a259a5a534f3c4f36cb02dca341673c6089431057242cdc931e9f133147e9 check-github-actions-workflows-linting: - docker pull rhysd/actionlint:1.7.7 - docker run --rm -v $(PWD):/workspace -w /workspace -u $(UID):$(GID) rhysd/actionlint:1.7.7 -verbose -color + docker pull rhysd/actionlint:$(ACTIONLINT_VERSION) + docker run --rm -v $(PWD):/workspace -w /workspace -u $(UID):$(GID) rhysd/actionlint:$(ACTIONLINT_VERSION) -verbose -color compile: docker build -t compile -f ci/compile.Dockerfile . diff --git a/ci/compile.Dockerfile b/ci/compile.Dockerfile index 3194de6..06f0db7 100644 --- a/ci/compile.Dockerfile +++ b/ci/compile.Dockerfile @@ -1,9 +1,9 @@ FROM alpine:3.22.0@sha256:8a1f59ffb675680d47db6337b49d22281a139e9d709335b492be023728e11715 RUN apk add --no-cache \ - gcc=14.2.0-r6 \ - build-base=0.5-r3 + gcc=14.2.0-r6 \ + build-base=0.5-r3 WORKDIR /workspace -ENTRYPOINT ["gcc", "-o", "shellcode-generator", "src/shellcode-generator.c"] \ No newline at end of file +ENTRYPOINT ["gcc", "-o", "shellcode-generator", "src/shellcode-generator.c"] diff --git a/ci/unit-test.Dockerfile b/ci/unit-test.Dockerfile index 5a40fcc..a4490de 100644 --- a/ci/unit-test.Dockerfile +++ b/ci/unit-test.Dockerfile @@ -1,10 +1,10 @@ FROM alpine:3.22.0@sha256:8a1f59ffb675680d47db6337b49d22281a139e9d709335b492be023728e11715 RUN apk add --no-cache \ - gcc=14.2.0-r6 \ - build-base=0.5-r3 \ - cunit-dev=2.1.3-r7 + gcc=14.2.0-r6 \ + build-base=0.5-r3 \ + cunit-dev=2.1.3-r7 WORKDIR /workspace -ENTRYPOINT ["gcc", "-o", "shellcode-generator-tests", "tests/shellcode-generator-tests.c", "-lcunit"] \ No newline at end of file +ENTRYPOINT ["gcc", "-o", "shellcode-generator-tests", "tests/shellcode-generator-tests.c", "-lcunit"]