Skip to content

Commit

Permalink
Merge pull request #3959 from dependabot/bin-ci-test
Browse files Browse the repository at this point in the history
bin/ci-test
  • Loading branch information
thepwagner authored Jun 23, 2021
2 parents df81fa6 + 1672755 commit 2c638b6
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 0 deletions.
57 changes: 57 additions & 0 deletions bin/ci-test
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
#!/bin/bash -e
#/ usage: ci-test SUITE
#/ simulate the process followed by ~/.github/workflows/ci.yml

function print_usage() {
grep ^#/ "$0" | cut -c4-
}

function handle_args() {
export SUITE=$1
case $SUITE in
bundler1 | bundler2)
export MODULE=bundler
;;
"")
print_usage
exit 1
;;
*)
export MODULE=$SUITE
esac

if ! [ -d "$MODULE" ]; then
print_usage
echo "module not found, try:"
for m in */*.gemspec; do
[[ "$m" == "omnibus" ]] && continue
echo -n " "; dirname "$m"
done
exit 1
fi
}

function build() {
export DOCKER_BUILDKIT=1
export DOCKER_SCAN_SUGGEST=false
export CORE=dependabot/dependabot-core
export CI=dependabot/dependabot-core-ci

set -x
docker build -qt $CORE .
docker build -qt $CI -f Dockerfile.ci .
docker run --rm \
-e "CI=true" \
-e "SUITE_NAME=$SUITE" \
-e "DEPENDABOT_TEST_ACCESS_TOKEN=${LOCAL_GITHUB_ACCESS_TOKEN}" \
-it $CI \
bash -c \
"cd /home/dependabot/dependabot-core/$MODULE && ./script/ci-test"
}

function main() {
handle_args "$@"
build
}

main "$@"
1 change: 1 addition & 0 deletions bin/lint
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
set -e

shellcheck \
./bin/ci-test \
./bin/docker-dev-shell \
./bin/lint \
./*/helpers/build \
Expand Down

0 comments on commit 2c638b6

Please sign in to comment.