diff --git a/.github/workflows/lint-caddy.yml b/.github/workflows/lint-caddy.yml new file mode 100644 index 0000000..693863c --- /dev/null +++ b/.github/workflows/lint-caddy.yml @@ -0,0 +1,27 @@ +name: 'Lint: Caddyfile' + +on: + push: + paths: + - '**/Caddyfile' + - .github/workflows/lint-caddy.yml + pull_request: + paths: + - '**/Caddyfile' + - .github/workflows/lint-caddy.yml + +jobs: + + caddy-fmt: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Run caddy fmt + run: | + cd caddy + for CADDYFILE in *; do + cp $CADDYFILE Caddyfile.orig + docker run -v "$PWD/$CADDYFILE":/srv/Caddyfile caddy \ + caddy fmt --overwrite + diff Caddyfile.orig $CADDYFILE + done diff --git a/.github/workflows/lint-hcl.yml b/.github/workflows/lint-hcl.yml new file mode 100644 index 0000000..8dff194 --- /dev/null +++ b/.github/workflows/lint-hcl.yml @@ -0,0 +1,34 @@ +name: 'Lint: hcl' + +on: + push: + paths: + - '**/{nomad,hcl}' + - .github/workflows/lint-hcl.yml + pull_request: + paths: + - '**/{nomad,hcl}' + - .github/workflows/lint-hcl.yml + +jobs: + + hcl-fmt: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-go@v5 + with: + go-version: '^1.16.3' + + - name: Install hclfmt + run: go install 'github.com/hashicorp/hcl/v2/cmd/hclfmt@latest' + + - name: Run hclfmt + run: | + for f in **/*.{nomad,hcl}; do + hclfmt \ + -check \ + -require-no-change \ + -w \ + "$f" + done diff --git a/.github/workflows/lint-tf.yml b/.github/workflows/lint-tf.yml new file mode 100644 index 0000000..fa32279 --- /dev/null +++ b/.github/workflows/lint-tf.yml @@ -0,0 +1,19 @@ +name: 'Lint: tf' + +on: + push: + paths: + - '**/*.tf' + - .github/workflows/lint-tf.yml + pull_request: + paths: + - '**/*.tf' + - .github/workflows/lint-tf.yml + +jobs: + tf-fmt: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Format + run: terraform -chdir=terraform fmt -check -diff -recursive diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml deleted file mode 100644 index 36bb06c..0000000 --- a/.github/workflows/lint.yml +++ /dev/null @@ -1,44 +0,0 @@ -on: [push, pull_request] - -jobs: - tf-fmt: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - name: Format - run: terraform -chdir=terraform fmt -check -diff -recursive - - hcl-fmt: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-go@v5 - with: - go-version: '^1.16.3' - - - name: Install hclfmt - run: go install 'github.com/hashicorp/hcl/v2/cmd/hclfmt@latest' - - - name: Run hclfmt - run: | - for f in **/*.{nomad,hcl}; do - hclfmt \ - -check \ - -require-no-change \ - -w \ - "$f" - done - - caddy-fmt: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - name: Run caddy fmt - run: | - cd caddy - for CADDYFILE in *; do - cp $CADDYFILE Caddyfile.orig - docker run -v "$PWD/$CADDYFILE":/srv/Caddyfile caddy \ - caddy fmt --overwrite - diff Caddyfile.orig $CADDYFILE - done