Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consolidate linters with github/super-linter. #103

Closed
wants to merge 3 commits into from
Closed
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
14 changes: 9 additions & 5 deletions .github/workflows/build-multiarch.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,11 @@ jobs:
show-progress: false
- id: set-matrix
run: |
echo "matrix=$(jq -c . < build-matrix.json)" >> $GITHUB_OUTPUT
echo "matrix_versions=$(jq -c .version < build-matrix.json)" >> $GITHUB_OUTPUT
echo "runs_on=$(jq -c .runs_on < build-matrix.json)" >> $GITHUB_OUTPUT
{
echo "matrix=$(jq -c . < build-matrix.json)"
echo "matrix_versions=$(jq -c .version < build-matrix.json)"
echo "runs_on=$(jq -c .runs_on < build-matrix.json)"
} >> "$GITHUB_OUTPUT"

build_and_push_image:
name: Build ruby_${{ join(matrix.version.rubyver, '.') }} for ${{ matrix.runs_on.arch }} and push to GHCR
Expand Down Expand Up @@ -67,7 +69,7 @@ jobs:
id: calculate-image-tags
run: |
CREATED_DATE="$(date -u +'%Y-%m-%dT%H:%M:%SZ')"
echo "createdDate=${CREATED_DATE}" >> $GITHUB_OUTPUT
echo "createdDate=${CREATED_DATE}" >> "$GITHUB_OUTPUT"

- name: Generate Base Image Metadata
uses: docker/metadata-action@v5
Expand Down Expand Up @@ -190,7 +192,7 @@ jobs:
id: calculate-image-tags
run: |
CREATED_DATE="$(date -u +'%Y-%m-%dT%H:%M:%SZ')"
echo "createdDate=${CREATED_DATE}" >> $GITHUB_OUTPUT
echo "createdDate=${CREATED_DATE}" >> "$GITHUB_OUTPUT"

- name: Login to GHCR
uses: docker/login-action@v3
Expand Down Expand Up @@ -224,6 +226,7 @@ jobs:
- name: Create Manifest Lists (for Base)
working-directory: /tmp/digests/base
run: |
# shellcheck disable=SC2046
docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \
$(printf '${{ env.REGISTRY_BASE }}/govuk-ruby-base@sha256:%s ' *)

Expand Down Expand Up @@ -252,6 +255,7 @@ jobs:
- name: Create Manifest Lists (for Builder)
working-directory: /tmp/digests/builder
run: |
# shellcheck disable=SC2046
docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \
$(printf '${{ env.REGISTRY_BASE }}/govuk-ruby-builder@sha256:%s ' *)

Expand Down
37 changes: 21 additions & 16 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
@@ -1,23 +1,28 @@
name: Run linters/fixers
---
name: Lint
on: [push]
permissions: {}
jobs:
shellcheck:
name: Shellcheck
superlinter:
runs-on: ubuntu-latest
permissions:
contents: read
packages: read
statuses: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I verified that it really does require this, even though we're not currently using any of the linters which use the commit history 🤷

show-progress: false
- name: Run ShellCheck
uses: ludeeus/action-shellcheck@00cae500b08a931fb5698e11e79bfbd38e612a38 # 2.0.0
hadolint:
name: Hadolint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
show-progress: false
- uses: jbergstroem/hadolint-gh-action@eac45b98f6d761309202bd201205a8f8c988bfad # v1.11.0
with:
dockerfile: '**/*Dockerfile'
error_level: '1' # Fail on warning or above.
- uses: github/super-linter@v6
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
VALIDATE_BASH: true
VALIDATE_BASH_EXEC: true
VALIDATE_DOCKERFILE_HADOLINT: true
VALIDATE_EDITORCONFIG: true
VALIDATE_ENV: true
VALIDATE_GITHUB_ACTIONS: true
VALIDATE_JSON: true
VALIDATE_MARKDOWN: true
VALIDATE_YAML: true