Skip to content

Commit

Permalink
Merge pull request #11 from Nordix/mod-mael
Browse files Browse the repository at this point in the history
🏃 Add code generation test script
  • Loading branch information
metal3-io-bot authored Jul 19, 2020
2 parents 4f03d84 + d76503d commit 82a1839
Showing 1 changed file with 39 additions and 0 deletions.
39 changes: 39 additions & 0 deletions hack/codegen.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#!/bin/sh

set -eux

IS_CONTAINER="${IS_CONTAINER:-false}"
ARTIFACTS="${ARTIFACTS:-/tmp}"
CONTAINER_RUNTIME="${CONTAINER_RUNTIME:-podman}"

if [ "${IS_CONTAINER}" != "false" ]; then
export XDG_CACHE_HOME=/tmp/.cache
eval "$(go env)"
INPUT_FILES="\
config/certmanager/*.yaml
config/crd/*.yaml
config/crd/bases/*.yaml
config/crd/patches/*.yaml
config/default/*.yaml
config/manager/*.yaml
config/rbac/*.yaml
config/webhook/*.yaml
config/*.yaml
api/v1alpha1/zz_generated.*.go"

# shellcheck disable=SC2086
cksum $INPUT_FILES > "$ARTIFACTS/lint.cksums.before"
export VERBOSE="--verbose"
make generate
# shellcheck disable=SC2086
cksum $INPUT_FILES > "$ARTIFACTS/lint.cksums.after"
diff "$ARTIFACTS/lint.cksums.before" "$ARTIFACTS/lint.cksums.after"
else
"${CONTAINER_RUNTIME}" run --rm \
--env IS_CONTAINER=TRUE \
--volume "${PWD}:/data:rw,z" \
--entrypoint sh \
--workdir /data \
registry.hub.docker.com/library/golang:1.13.7 \
/data/hack/codegen.sh
fi;

0 comments on commit 82a1839

Please sign in to comment.