From 5ca5a12b990d172401ac6d8dfaf90431293d13a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Socho=C5=84?= Date: Thu, 11 Jan 2024 21:45:58 +0100 Subject: [PATCH] Add yamllint, fix most yaml errors --- .github/dependabot.yml | 17 +++++++++-------- .github/workflows/ci.yml | 16 ++++++++++++++-- .pre-commit-config.yaml | 35 +++++++++++++++++++++++------------ .yamllint => .yamllint.yaml | 2 ++ 4 files changed, 48 insertions(+), 22 deletions(-) rename .yamllint => .yamllint.yaml (84%) diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 82dd81d..9c3788f 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -1,10 +1,11 @@ +--- version: 2 updates: -- package-ecosystem: "github-actions" - directory: "/" - schedule: - interval: "daily" -- package-ecosystem: "docker" - directory: "/" - schedule: - interval: "daily" + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "daily" + - package-ecosystem: "docker" + directory: "/" + schedule: + interval: "daily" diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 54763d8..1211ae7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,3 +1,4 @@ +--- name: "CI" on: push: @@ -37,7 +38,9 @@ jobs: build-test: name: Build and Test runs-on: ubuntu-20.04 - needs: [ "lint", "shellcheck" ] + needs: + - lint + - shellcheck steps: - uses: actions/checkout@v3 - name: Build Docker image @@ -55,7 +58,7 @@ jobs: steps: - uses: actions/checkout@v3 - - name: Run integration test 1 + - name: Run integration test 1 - good Dockerfile uses: ./ with: dockerfile: testdata/Dockerfile @@ -117,6 +120,15 @@ jobs: # format: 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: if: github.event_name == 'push' && github.ref == 'refs/heads/master' name: Release diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 1529807..518598a 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,12 +1,23 @@ -- repo: local - hooks: - - id: lint-dockerfile - name: Lint Dockerfile - entry: make lint-dockerfile - language: system - files: \.yml$ - - id: lint-yaml - name: Lint YAML - entry: make lint-yaml - language: system - files: \.yml$ +--- +repos: + - repo: local + hooks: + - id: lint-dockerfile + name: Lint Dockerfile + entry: make lint-dockerfile + language: system + files: \.yml$ + + - id: lint-yaml + 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 diff --git a/.yamllint b/.yamllint.yaml similarity index 84% rename from .yamllint rename to .yamllint.yaml index 39a5255..7cbb0fb 100644 --- a/.yamllint +++ b/.yamllint.yaml @@ -6,3 +6,5 @@ rules: max: 80 level: warning document-start: disable + truthy: + level: warning