diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b9ec2133..9b827ccd 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -35,7 +35,7 @@ jobs: uses: actions/cache@v3 with: path: /tmp/.buildx-cache - key: ${{ runner.os }}-buildx-${{ hashFiles('Dockerfile') }} + key: ${{ runner.os }}-buildx-${{ hashFiles('**/Dockerfile') }} restore-keys: ${{ runner.os }}-buildx- - name: Startup Nitro testnode diff --git a/.github/workflows/testnode.bash b/.github/workflows/testnode.bash index be7e6961..63e5edf3 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 00000000..0fee603d --- /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/docker-compose.yaml b/docker-compose.yaml index f8facecc..c3cbf4cf 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -47,7 +47,7 @@ services: - "127.0.0.1:6379:6379" geth: - image: ethereum/client-go:latest + image: ethereum/client-go:stable ports: - "127.0.0.1:8545:8545" - "127.0.0.1:8551:8551" diff --git a/test-node.bash b/test-node.bash index 12062b5a..58cb2ef1 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 @@ -366,7 +377,7 @@ if $blockscout; then fi if $build_node_images; then - docker compose build --no-rm $NODES scripts + docker compose build --no-rm $NODES fi if $force_init; then