diff --git a/.docker/build-linux.sh b/.docker/build-linux.sh index fe392f5ab..8b052f096 100755 --- a/.docker/build-linux.sh +++ b/.docker/build-linux.sh @@ -4,6 +4,36 @@ set -ex export CCACHE_DIR=/ccache +LOCAL_REPO_PATH=/local/repos +mkdir -p "$LOCAL_REPO_PATH" +LAST_UPDATE_FILE="$LOCAL_REPO_PATH/last-update" + +if [ -f "$LAST_UPDATE_FILE" ] && [ $(find "$LAST_UPDATE_FILE" -mmin -180) ]; then + echo "Skipping git repo update because it already ran in the last three hours." +else + echo "Running git repo update." + + for repo in "fmtlib/fmt" \ + "google/googletest" \ + "ericniebler/range-v3" \ + "greg7mdp/parallel-hashmap"; do + reponame=$(basename "$repo") + cd "$LOCAL_REPO_PATH" + if [ -d "$reponame" ]; then + cd "$reponame" + time git fetch + else + time git clone "https://github.com/$repo.git" + fi + done + + touch "$LAST_UPDATE_FILE" +fi + +if [[ "$BUILD_TYPE" != "clang-release-ninja-static" ]]; then + export DWARFS_LOCAL_REPO_PATH="$LOCAL_REPO_PATH" +fi + cd "$HOME" rm -rf dwarfs dwarfs-* diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 33624751c..59e791013 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -124,6 +124,7 @@ jobs: --mount type=bind,source=${GITHUB_WORKSPACE},target=/workspace,readonly \ --mount type=bind,source=${{ runner.temp }},target=/tmp-runner \ --mount type=bind,source=/home/mhx/github-ccache,target=/ccache \ + --mount type=bind,source=/home/mhx/github-local,target=/local \ --mount type=bind,source=/mnt/opensource/artifacts/dwarfs,target=/artifacts \ --env BUILD_TYPE=clang-release-ninja-source \ --env BUILD_ARCH=amd64 \ @@ -233,6 +234,7 @@ jobs: --mount type=bind,source=${GITHUB_WORKSPACE},target=/workspace,readonly \ --mount type=bind,source=${{ runner.temp }},target=/tmp-runner \ --mount type=bind,source=/home/mhx/github-ccache,target=/ccache \ + --mount type=bind,source=/home/mhx/github-local,target=/local \ --env BUILD_FROM_TARBALL=1 \ --env BUILD_TYPE=${{ matrix.build_type }} \ --env BUILD_ARCH=${{ matrix.arch }} \ @@ -372,6 +374,7 @@ jobs: --mount type=bind,source=${GITHUB_WORKSPACE},target=/workspace,readonly \ --mount type=bind,source=${{ runner.temp }},target=/tmp-runner \ --mount type=bind,source=/home/mhx/github-ccache,target=/ccache \ + --mount type=bind,source=/home/mhx/github-local,target=/local \ --mount type=bind,source=/mnt/opensource/artifacts/dwarfs,target=/artifacts \ --env BUILD_TYPE=${{ matrix.build_type }} \ --env BUILD_ARCH=${{ matrix.arch }} \