Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add vendor-check to github actions #135

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
The diff you're trying to view is too large. We only load the first 3000 changed files.
4 changes: 3 additions & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,6 @@ jobs:
with:
go-version: '1.21'
- run: make tidy
- run: make lint
- run: make lint
- name: vendor
run: hack/verify-vendor.sh
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,3 @@ device_plugin.sh
libvgpu/build
updateso.sh
.idea
vendor
17 changes: 17 additions & 0 deletions hack/update-vendor.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/usr/bin/env bash

set -o errexit
set -o nounset
set -o pipefail

REPO_ROOT=$(dirname "${BASH_SOURCE[0]}")/..

cd "${REPO_ROOT}"
source "hack/util.sh"
util::verify_go_version

echo "running 'go mod tidy'"
go mod tidy

echo "running 'go mod vendor'"
go mod vendor
45 changes: 45 additions & 0 deletions hack/verify-vendor.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
#!/usr/bin/env bash


set -o errexit
set -o nounset
set -o pipefail

SCRIPT_ROOT=$(dirname "${BASH_SOURCE[0]}")/..

DIFFROOT="${SCRIPT_ROOT}/vendor"
TMP_DIFFROOT="${SCRIPT_ROOT}/_tmp/vendor"
_tmp="${SCRIPT_ROOT}/_tmp"

cleanup() {
rm -rf "${_tmp}"
}
trap "cleanup" EXIT SIGINT

cleanup

mkdir -p "${TMP_DIFFROOT}"
cp -a "${DIFFROOT}"/* "${TMP_DIFFROOT}"
cp "${SCRIPT_ROOT}"/go.mod "$_tmp"/go.mod
cp "${SCRIPT_ROOT}"/go.sum "$_tmp"/go.sum

bash "${SCRIPT_ROOT}/hack/update-vendor.sh"
echo "diffing ${DIFFROOT} against freshly generated files"

govendor=0
diff -Naupr "${DIFFROOT}" "${TMP_DIFFROOT}" || govendor=$?
gomod=0
diff -Naupr "${SCRIPT_ROOT}"/go.mod "${_tmp}"/go.mod || gomod=$?
gosum=0
diff -Naupr "${SCRIPT_ROOT}"/go.sum "${_tmp}"/go.sum || gosum=$?

cp -a "${TMP_DIFFROOT}"/* "${DIFFROOT}"
cp "${_tmp}"/go.mod "${SCRIPT_ROOT}"/go.mod
cp "${_tmp}"/go.sum "${SCRIPT_ROOT}"/go.sum
if [[ $govendor -eq 0 && $gomod -eq 0 && $gosum -eq 0 ]]
then
echo "${DIFFROOT} up to date."
else
echo "${DIFFROOT}, 'go.mod' or 'go.sum' is out of date. Please run hack/update-vendor.sh"
exit 1
fi
2 changes: 1 addition & 1 deletion pkg/device/nvidia/device_test.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package nvidia

import (
"github.com/Project-HAMi/HAMi/pkg/scheduler/config"
"testing"

"github.com/Project-HAMi/HAMi/pkg/scheduler/config"
"github.com/Project-HAMi/HAMi/pkg/util"

"gotest.tools/v3/assert"
Expand Down
202 changes: 202 additions & 0 deletions vendor/github.com/NVIDIA/go-gpuallocator/LICENSE

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading