diff --git a/.github/workflows/testnode.bash b/.github/workflows/testnode.bash index be7e696..63e5edf 100755 --- a/.github/workflows/testnode.bash +++ b/.github/workflows/testnode.bash @@ -5,7 +5,7 @@ # Start the test node and get PID, to terminate it once send-l2 is done. cd ${GITHUB_WORKSPACE} -./test-node.bash "$@" +./test-node.bash "$@" --ci if [ $? -ne 0 ]; then echo "test-node.bash failed" diff --git a/docker-compose-ci-cache.json b/docker-compose-ci-cache.json new file mode 100644 index 0000000..0fee603 --- /dev/null +++ b/docker-compose-ci-cache.json @@ -0,0 +1,37 @@ +{ + "target": { + "scripts": { + "cache-from": [ + "type=local,src=/tmp/.buildx-cache" + ], + "cache-to": [ + "type=local,dest=/tmp/.buildx-cache,mode=max" + ], + "output": [ + "type=docker" + ] + }, + "rollupcreator": { + "cache-from": [ + "type=local,src=/tmp/.buildx-cache" + ], + "cache-to": [ + "type=local,dest=/tmp/.buildx-cache,mode=max" + ], + "output": [ + "type=docker" + ] + }, + "tokenbridge": { + "cache-from": [ + "type=local,src=/tmp/.buildx-cache" + ], + "cache-to": [ + "type=local,dest=/tmp/.buildx-cache,mode=max" + ], + "output": [ + "type=docker" + ] + } + } +} diff --git a/test-node.bash b/test-node.bash index d40484a..58cb2ef 100755 --- a/test-node.bash +++ b/test-node.bash @@ -36,6 +36,7 @@ else fi run=true +ci=false validate=false detach=false blockscout=false @@ -107,6 +108,10 @@ while [[ $# -gt 0 ]]; do done fi ;; + --ci) + ci=true + shift + ;; --build) build_dev_nitro=true build_dev_blockscout=true @@ -342,11 +347,17 @@ if $build_utils; then if $tokenbridge || $l3_token_bridge; then LOCAL_BUILD_NODES="$LOCAL_BUILD_NODES tokenbridge" fi - UTILS_NOCACHE="" - if $force_build_utils; then + + if [ "$ci" == true ]; then + # workaround to cache docker layers and keep using docker-compose in CI + docker buildx bake --file docker-compose.yaml --file docker-compose-ci-cache.json $LOCAL_BUILD_NODES + else + UTILS_NOCACHE="" + if $force_build_utils; then UTILS_NOCACHE="--no-cache" + fi + docker compose build --no-rm $UTILS_NOCACHE $LOCAL_BUILD_NODES fi - docker compose build --no-rm $UTILS_NOCACHE $LOCAL_BUILD_NODES fi if $dev_nitro; then