-
Notifications
You must be signed in to change notification settings - Fork 87
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #21 from tinkerbell/lint-and-format-checks-in-ci
Lint and format checks in ci
- Loading branch information
Showing
8 changed files
with
85 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
which nix &>/dev/null && use nix |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
#!/usr/bin/env nix-shell | ||
#!nix-shell -i bash ../../shell.nix | ||
# shellcheck shell=bash | ||
|
||
set -eux | ||
|
||
failed=0 | ||
|
||
if ! git ls-files '*.md' '*.yaml' '*.yml' | xargs prettier --list-different --write; then | ||
failed=1 | ||
fi | ||
|
||
if ! git ls-files '*.json' | xargs -I '{}' sh -c 'jq --sort-keys . {} > {}.t && mv {}.t {}'; then | ||
failed=1 | ||
fi | ||
|
||
if ! shfmt -f . | xargs shfmt -s -l -d; then | ||
failed=1 | ||
fi | ||
|
||
if ! shfmt -f . | xargs shellcheck; then | ||
failed=1 | ||
fi | ||
|
||
if ! terraform fmt -write -recursive deploy/terraform/; then | ||
failed=1 | ||
fi | ||
|
||
if ! git diff | (! grep .); then | ||
failed=1 | ||
fi | ||
|
||
exit "$failed" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
name: For each commit and PR | ||
on: | ||
push: | ||
pull_request: | ||
|
||
jobs: | ||
validation: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
with: | ||
lfs: true | ||
- name: Install nix | ||
uses: cachix/install-nix-action@v12 | ||
with: | ||
nix_path: nixpkgs=channel:nixpkgs-unstable | ||
- name: Run ci-checks.sh | ||
run: ./.github/workflows/ci-non-go.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
let _pkgs = import <nixpkgs> { }; | ||
in { pkgs ? import (_pkgs.fetchFromGitHub { | ||
owner = "NixOS"; | ||
repo = "nixpkgs"; | ||
#branch@date: nixpkgs-unstable@2020-11-04 | ||
rev = "dfea4e4951a3cee4d1807d8d4590189cf16f366b"; | ||
sha256 = "02j7f5l2p08144b2fb7pg6sbni5km5y72k3nk3i7irddx8j2s04i"; | ||
}) { } }: | ||
|
||
with pkgs; | ||
|
||
mkShell { | ||
buildInputs = [ go nodePackages.prettier shellcheck shfmt terraform ]; | ||
} |