Merge pull request #6166 from leseb/modcheck-workflow

ci: add modcheck github workflow
This commit is contained in:
Sébastien Han authored and GitHub committed 2020-08-27 15:43:04 +02:00
commit c5a1bbda75
5 files changed
+60 -14

No files matched your search

+1 -1
View File
@@ -16,5 +16,5 @@ jobs:
run: GOPATH=$(go env GOPATH) make codegen
- name: validate codegen
run: hack/validate-codegen.sh
run: hack/validate_modified_files.sh codegen
+20
View File
@@ -0,0 +1,20 @@
name: Mod check
on: [pull_request]
jobs:
modcheck:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v1
- uses: actions/setup-go@v2
with:
go-version: 1.13
- name: run mod check
run: GOPATH=$(go env GOPATH) make -j $(nproc) mod.check
- name: validate modcheck
run: hack/validate_modified_files.sh modcheck
Vendored
-3
View File
@@ -97,9 +97,6 @@ pipeline {
}
}
steps {
// quick check that no files are modified for the go modules
sh 'build/run make -j\$(nproc) mod.check'
sh 'git diff-index --quiet HEAD || { echo "CHANGES FOUND. You may need to run make clean"; git status -s; exit 1; }'
// run the build
sh 'build/run make -j\$(nproc) build.all'
sh 'git status'
-10
View File
@@ -1,10 +0,0 @@
#!/bin/bash
set -ex
for file in $(git status --porcelain); do
if [[ "$file" =~ "zz" ]]; then
echo "found codegen files!"
echo "please run 'make codegen' and update your PR"
exit 1
fi
done
+39
View File
@@ -0,0 +1,39 @@
#!/bin/bash
set -ex
#############
# VARIABLES #
#############
MOD_FILE="mod"
CODEGEN_FILE="zz"
CODEGEN_ERR="found codegen files! please run 'make codegen' and update your PR"
MOD_ERR="changes found by mod.check. You may need to run make clean"
#############
# FUNCTIONS #
#############
function validate(){
for file in $(git status --porcelain); do
if [[ "$file" =~ $1 ]]; then
echo "$2"
exit 1
fi
done
}
########
# MAIN #
########
case "$1" in
codegen)
validate "$CODEGEN_FILE" "$CODEGEN_ERR"
;;
modcheck)
validate "$MOD_FILE" "$MOD_ERR"
;;
*)
echo $"Usage: $0 {codegen|modcheck}"
exit 1
esac