Add yamllint, fix most yaml errors

This commit is contained in:
Michał Sochoń 2024-01-11 21:45:58 +01:00
parent d292784f8f
commit 5ca5a12b99
4 changed files with 48 additions and 22 deletions

View file

@ -1,10 +1,11 @@
---
version: 2 version: 2
updates: updates:
- package-ecosystem: "github-actions" - package-ecosystem: "github-actions"
directory: "/" directory: "/"
schedule: schedule:
interval: "daily" interval: "daily"
- package-ecosystem: "docker" - package-ecosystem: "docker"
directory: "/" directory: "/"
schedule: schedule:
interval: "daily" interval: "daily"

View file

@ -1,3 +1,4 @@
---
name: "CI" name: "CI"
on: on:
push: push:
@ -37,7 +38,9 @@ jobs:
build-test: build-test:
name: Build and Test name: Build and Test
runs-on: ubuntu-20.04 runs-on: ubuntu-20.04
needs: [ "lint", "shellcheck" ] needs:
- lint
- shellcheck
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- name: Build Docker image - name: Build Docker image
@ -55,7 +58,7 @@ jobs:
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- name: Run integration test 1 - name: Run integration test 1 - good Dockerfile
uses: ./ uses: ./
with: with:
dockerfile: testdata/Dockerfile dockerfile: testdata/Dockerfile
@ -117,6 +120,15 @@ jobs:
# format: sarif # format: sarif
# output-file: report.sarif # output-file: report.sarif
- name: Run integration test 9 - run with no Dockerfiles
# This should not fail if no Dockerfiles are found in the path
# especially if git change deletes Dockerfile
uses: testdata/test_empty_dir
with:
dockerfile: ""
failure-threshold: error
recursive: true
release: release:
if: github.event_name == 'push' && github.ref == 'refs/heads/master' if: github.event_name == 'push' && github.ref == 'refs/heads/master'
name: Release name: Release

View file

@ -1,12 +1,23 @@
- repo: local ---
hooks: repos:
- id: lint-dockerfile - repo: local
name: Lint Dockerfile hooks:
entry: make lint-dockerfile - id: lint-dockerfile
language: system name: Lint Dockerfile
files: \.yml$ entry: make lint-dockerfile
- id: lint-yaml language: system
name: Lint YAML files: \.yml$
entry: make lint-yaml
language: system - id: lint-yaml
files: \.yml$ name: Lint YAML
entry: make lint-yaml
language: system
files: \.yml$
- repo: https://github.com/adrienverge/yamllint
rev: v1.33.0
hooks:
- id: yamllint
- repo: https://github.com/koalaman/shellcheck-precommit
rev: v0.9.0
hooks:
- id: shellcheck

View file

@ -6,3 +6,5 @@ rules:
max: 80 max: 80
level: warning level: warning
document-start: disable document-start: disable
truthy:
level: warning