@@ -96,9 +96,53 @@ release_hygiene() {
9696 printf ' release workflow must upload dist artifacts to the current release\n' >&2
9797 return 1
9898 fi
99+ if ! git grep -nF ' repos/${GITHUB_REPOSITORY}/releases/tags/' -- " $workflow " > /dev/null; then
100+ printf ' release workflow must read metadata from the current GitHub repository\n' >&2
101+ return 1
102+ fi
99103 printf ' \n==> release hygiene ok\n'
100104}
101105
106+ container_hygiene () {
107+ local publish build compose
108+ publish=" .github/workflows/docker-publish.yml"
109+ build=" .github/workflows/docker-build.yml"
110+ compose=" docker-compose.hub.yml"
111+
112+ for file in " $publish " " $build " " $compose " ; do
113+ if [[ ! -f " $file " ]]; then
114+ printf ' container build file not found: %s\n' " $file " >&2
115+ return 1
116+ fi
117+ done
118+
119+ if git grep -nE ' DOCKERHUB|dockerhub|secrets[.]DOCKERHUB|iniwex[/]vohive' -- " $publish " " $build " " $compose " DOCKERHUB.md; then
120+ printf ' container build configuration must not reference DockerHub or legacy images\n' >&2
121+ return 1
122+ fi
123+ if git grep -nF ' ghcr.io/${{ github.repository }}/vohive' -- " $publish " " $build " ; then
124+ printf ' container build configuration must not duplicate the vohive image path\n' >&2
125+ return 1
126+ fi
127+ if ! git grep -nF ' CONTAINER_IMAGE: ghcr.io/${{ github.repository }}' -- " $publish " > /dev/null; then
128+ printf ' docker publish workflow must publish to ghcr.io/${{ github.repository }}\n' >&2
129+ return 1
130+ fi
131+ if ! git grep -nF ' tags: ghcr.io/${{ github.repository }}:dev' -- " $build " > /dev/null; then
132+ printf ' manual docker build workflow must tag the current GHCR repository\n' >&2
133+ return 1
134+ fi
135+ if [[ " $( git grep -nF ' registry: ghcr.io' -- " $publish " " $build " | wc -l | tr -d ' ' ) " -lt 2 ]]; then
136+ printf ' docker workflows must authenticate against ghcr.io when pushing\n' >&2
137+ return 1
138+ fi
139+ if ! git grep -nF ' image: ${VOHIVE_IMAGE:-ghcr.io/boa-z/vohive:latest}' -- " $compose " > /dev/null; then
140+ printf ' prebuilt compose file must default to the current GHCR image\n' >&2
141+ return 1
142+ fi
143+ printf ' \n==> container hygiene ok\n'
144+ }
145+
102146web_build () {
103147 run npm ci --prefix web
104148 run npm run build --prefix web
@@ -130,9 +174,9 @@ go_build() {
130174
131175usage () {
132176 cat << 'USAGE '
133- Usage: scripts/ci.sh [all|workflow-lint|hygiene|release-hygiene|web|tidy|test|build ...]
177+ Usage: scripts/ci.sh [all|workflow-lint|hygiene|release-hygiene|container-hygiene| web|tidy|test|build ...]
134178
135- Default all runs workflow-lint, hygiene, release-hygiene, web, tidy, test, and build.
179+ Default all runs workflow-lint, hygiene, release-hygiene, container-hygiene, web, tidy, test, and build.
136180
137181Environment:
138182 GO_BIN path to go binary
@@ -148,7 +192,7 @@ USAGE
148192GO_BIN=" $( find_go) "
149193
150194if [[ $# -eq 0 || " ${1:- } " == " all" ]]; then
151- tasks=(workflow-lint hygiene release-hygiene web tidy test build)
195+ tasks=(workflow-lint hygiene release-hygiene container-hygiene web tidy test build)
152196else
153197 tasks=(" $@ " )
154198fi
@@ -161,6 +205,7 @@ for task in "${tasks[@]}"; do
161205 workflow-lint | actionlint) workflow_lint ;;
162206 hygiene | dependency-hygiene) dependency_hygiene ;;
163207 release-hygiene | release) release_hygiene ;;
208+ container-hygiene | container | docker-hygiene) container_hygiene ;;
164209 web | frontend) web_build ;;
165210 tidy | tidy-check) tidy_check ;;
166211 test | go-test) go_tests ;;
0 commit comments