From 7dc620816f355a09830691af495b2a63c05fe971 Mon Sep 17 00:00:00 2001 From: vickunwu <31735039+vickunwu@users.noreply.github.com> Date: Wed, 30 Apr 2025 16:36:07 +0800 Subject: [PATCH] Add dependabot & Fix sccache fail in CI (#1451) * - Prevent sponsor.yml running on fork repos - Use gcr mirror for docker image pull - Add dependabot * Update sccache version & adjust for github change & fix foundationdb pkg download url --- .github/dependabot.yml | 19 +++++++++++++++++++ .github/workflows/ci.yml | 9 ++++++--- .github/workflows/sponsors.yml | 1 + Dockerfile.build | 8 ++++---- docker-bake.hcl | 2 +- 5 files changed, 31 insertions(+), 8 deletions(-) create mode 100644 .github/dependabot.yml diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 00000000..1d8bc936 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,19 @@ +# To get started with Dependabot version updates, you'll need to specify which +# package ecosystems to update and where the package manifests are located. +# Please see the documentation for all configuration options: +# https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file + +version: 2 +updates: + - package-ecosystem: "cargo" # See documentation for possible values + directory: "/" # Location of package manifests + schedule: + interval: "weekly" + + # Enable version updates for GitHub Actions + - package-ecosystem: "github-actions" + # Workflow files stored in the default location of `.github/workflows` + # You don't need to specify `/.github/workflows` for `directory`. You can use `directory: "/"`. + directory: "/" + schedule: + interval: "weekly" diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b773d9fd..41d8c32e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -157,6 +157,9 @@ jobs: - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 with: + buildkitd-config-inline: | + [registry."docker.io"] + mirrors = ["https://mirror.gcr.io"] driver-opts: | network=host @@ -301,7 +304,7 @@ jobs: uses: actions/checkout@v4 - name: Run sccache-cache - uses: mozilla-actions/sccache-action@v0.0.7 + uses: mozilla-actions/sccache-action@v0.0.9 with: disable_annotations: true @@ -334,7 +337,7 @@ jobs: uses: actions/checkout@v4 - name: Run sccache-cache - uses: mozilla-actions/sccache-action@v0.0.7 + uses: mozilla-actions/sccache-action@v0.0.9 with: disable_annotations: true @@ -344,7 +347,7 @@ jobs: run: | rustup target add ${{matrix.target}} # Get latest FoundationDB installer - curl --retry 5 -Lso foundationdb.pkg "$(gh api -X GET /repos/apple/foundationdb/releases --jq '.[] | select(.prerelease == false) | .assets[] | select(.name | test("${{startsWith(matrix.target, 'x86') && 'x86_64' || 'arm64'}}" + ".pkg")) | .browser_download_url' | head -n1)" + curl --retry 5 -Lso foundationdb.pkg "$(gh api -X GET /repos/apple/foundationdb/releases --jq '.[] | select(.prerelease == false) | .assets[] | select(.name | test("${{startsWith(matrix.target, 'x86') && 'x86_64' || 'arm64'}}" + ".pkg$")) | .browser_download_url' | head -n1)" sudo installer -allowUntrusted -dumplog -pkg foundationdb.pkg -target / cargo build --release --target ${{matrix.target}} -p mail-server --no-default-features --features "foundationdb elastic s3 redis enterprise" mkdir -p artifacts diff --git a/.github/workflows/sponsors.yml b/.github/workflows/sponsors.yml index 924ded3a..9def0d92 100644 --- a/.github/workflows/sponsors.yml +++ b/.github/workflows/sponsors.yml @@ -7,6 +7,7 @@ permissions: contents: write jobs: deploy: + if: github.event_name != 'schedule' || !github.event.repository.fork runs-on: ubuntu-latest steps: - name: Checkout 🛎️ diff --git a/Dockerfile.build b/Dockerfile.build index 8883db9d..8785cda4 100644 --- a/Dockerfile.build +++ b/Dockerfile.build @@ -70,7 +70,7 @@ RUN \ fi # Cargo-chef Cache layer RUN \ - --mount=type=secret,id=ACTIONS_CACHE_URL,env=ACTIONS_CACHE_URL \ + --mount=type=secret,id=ACTIONS_RESULTS_URL,env=ACTIONS_RESULTS_URL \ --mount=type=secret,id=ACTIONS_RUNTIME_TOKEN,env=ACTIONS_RUNTIME_TOKEN \ --mount=type=cache,target=/usr/local/cargo/registry \ --mount=type=cache,target=/usr/local/cargo/git \ @@ -79,7 +79,7 @@ RUN \ RUSTFLAGS="-L /usr/lib" cargo chef cook --recipe-path recipe.json --zigbuild --release --target ${TARGET} -p mail-server --no-default-features --features "foundationdb elastic s3 redis enterprise"; \ fi RUN \ - --mount=type=secret,id=ACTIONS_CACHE_URL,env=ACTIONS_CACHE_URL \ + --mount=type=secret,id=ACTIONS_RESULTS_URL,env=ACTIONS_RESULTS_URL \ --mount=type=secret,id=ACTIONS_RUNTIME_TOKEN,env=ACTIONS_RUNTIME_TOKEN \ --mount=type=cache,target=/usr/local/cargo/registry \ --mount=type=cache,target=/usr/local/cargo/git \ @@ -92,7 +92,7 @@ ENV RUSTC_WRAPPER="sccache" \ SCCACHE_GHA_ENABLED=true # Build FoundationDB version RUN \ - --mount=type=secret,id=ACTIONS_CACHE_URL,env=ACTIONS_CACHE_URL \ + --mount=type=secret,id=ACTIONS_RESULTS_URL,env=ACTIONS_RESULTS_URL \ --mount=type=secret,id=ACTIONS_RUNTIME_TOKEN,env=ACTIONS_RUNTIME_TOKEN \ --mount=type=cache,target=/usr/local/cargo/registry \ --mount=type=cache,target=/usr/local/cargo/git \ @@ -103,7 +103,7 @@ RUN \ fi # Build generic version RUN \ - --mount=type=secret,id=ACTIONS_CACHE_URL,env=ACTIONS_CACHE_URL \ + --mount=type=secret,id=ACTIONS_RESULTS_URL,env=ACTIONS_RESULTS_URL \ --mount=type=secret,id=ACTIONS_RUNTIME_TOKEN,env=ACTIONS_RUNTIME_TOKEN \ --mount=type=cache,target=/usr/local/cargo/registry \ --mount=type=cache,target=/usr/local/cargo/git \ diff --git a/docker-bake.hcl b/docker-bake.hcl index ca4a2128..ec490a35 100644 --- a/docker-bake.hcl +++ b/docker-bake.hcl @@ -16,7 +16,7 @@ variable "DOCKER_PLATFORM" { target "docker-metadata-action" {} target "build" { secret = [ - "type=env,id=ACTIONS_CACHE_URL", + "type=env,id=ACTIONS_RESULTS_URL", "type=env,id=ACTIONS_RUNTIME_TOKEN" ] args = {