Merge pull request #21 from tinkerbell/lint-and-format-checks-in-ci
Lint and format checks in ci
This commit is contained in:
commit
09adeb815f
33
.github/workflows/ci-non-go.sh
vendored
Executable file
33
.github/workflows/ci-non-go.sh
vendored
Executable file
@ -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"
|
19
.github/workflows/ci.yaml
vendored
Normal file
19
.github/workflows/ci.yaml
vendored
Normal file
@ -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
|
@ -6,11 +6,18 @@
|
||||
"profiles": {
|
||||
"server": {
|
||||
"expiry": "8760h",
|
||||
"usages": ["signing", "key encipherment", "server auth"]
|
||||
"usages": [
|
||||
"signing",
|
||||
"key encipherment",
|
||||
"server auth"
|
||||
]
|
||||
},
|
||||
"signing": {
|
||||
"expiry": "8760h",
|
||||
"usages": ["signing", "key encipherment"]
|
||||
"usages": [
|
||||
"signing",
|
||||
"key encipherment"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
14
shell.nix
Normal file
14
shell.nix
Normal file
@ -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 ];
|
||||
}
|
Loading…
Reference in New Issue
Block a user