forked from ray-project/kuberay
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[CI] Auto download golang tools in pre-commit (ray-project#2917)
Signed-off-by: Chi-Sheng Liu <[email protected]>
- Loading branch information
1 parent
bc2bd71
commit 268a776
Showing
4 changed files
with
23 additions
and
49 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 |
---|---|---|
|
@@ -12,18 +12,6 @@ jobs: | |
name: Lint (pre-commit) | ||
runs-on: ubuntu-22.04 | ||
steps: | ||
- name: Install golangci-lint | ||
run: | | ||
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s v1.60.3 | ||
mv ./bin/golangci-lint /usr/local/bin/golangci-lint | ||
shell: bash | ||
|
||
- name: Install kubeconform | ||
run: | | ||
curl -L https://github.com/yannh/kubeconform/releases/download/v0.6.7/kubeconform-linux-amd64.tar.gz -o kubeconform.tar.gz | ||
tar -xzf kubeconform.tar.gz | ||
mv kubeconform /usr/local/bin/ | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-python@v3 | ||
- uses: pre-commit/[email protected] | ||
|
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 |
---|---|---|
|
@@ -29,48 +29,25 @@ repos: | |
|
||
- repo: local | ||
hooks: | ||
- id: check-golangci-lint-version | ||
name: golangci-lint version check | ||
entry: bash -c 'version="1.60.3"; [ "$(golangci-lint --version | awk "/version/ {print \$4}" | sed "s/^v//")" = "$version" ] || { echo "golangci-lint version is not $version"; exit 1; }' | ||
language: system | ||
always_run: true | ||
fail_fast: true | ||
pass_filenames: false | ||
|
||
- repo: local | ||
hooks: | ||
- id: golangci-lint-ray-operator | ||
name: golangci-lint (ray-operator) | ||
entry: bash -c 'cd ray-operator && golangci-lint run --fix --exclude-files _generated.go --timeout 10m0s; status=$?; cd ..; exit $status' | ||
- id: golangci-lint | ||
name: golangci-lint | ||
entry: ./scripts/lint.sh | ||
types: [ go ] | ||
language: golang | ||
require_serial: true | ||
files: ^ray-operator/ | ||
|
||
- repo: local | ||
hooks: | ||
- id: golangci-lint-kubectl-plugin | ||
name: golangci-lint (kubectl-plugin) | ||
entry: bash -c 'cd kubectl-plugin && golangci-lint run --fix --timeout 10m0s; status=$?; cd ..; exit $status' | ||
types: [ go ] | ||
language: golang | ||
require_serial: true | ||
files: ^kubectl-plugin/ | ||
|
||
- repo: local | ||
hooks: | ||
- id: check-kubeconform-version | ||
name: kubeconform version check | ||
entry: bash -c 'version="0.6.7"; [ "$(kubeconform -v | awk -F"v" "{print \$2}")" = "$version" ] || { echo "kubeconform version is not $version"; exit 1; }' | ||
language: system | ||
always_run: true | ||
fail_fast: true | ||
pass_filenames: false | ||
additional_dependencies: | ||
- github.com/golangci/golangci-lint/cmd/[email protected] | ||
|
||
- repo: local | ||
hooks: | ||
- id: validate-helm-charts | ||
name: validate helm charts with kubeconform | ||
entry: bash scripts/validate-helm.sh | ||
language: system | ||
language: golang | ||
require_serial: true | ||
always_run: true | ||
pass_filenames: false | ||
additional_dependencies: | ||
- github.com/yannh/kubeconform/cmd/[email protected] |
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,11 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -euo pipefail | ||
|
||
dirs_to_lint="ray-operator kubectl-plugin" | ||
|
||
for dir in $dirs_to_lint; do | ||
pushd $dir | ||
golangci-lint run --fix --exclude-files _generated.go --timeout 10m0s | ||
popd | ||
done |