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
This commit is contained in:
vickunwu 2025-04-30 16:36:07 +08:00 committed by GitHub
parent f3ae865f38
commit 7dc620816f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 31 additions and 8 deletions

19
.github/dependabot.yml vendored Normal file
View file

@ -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"

View file

@ -157,6 +157,9 @@ jobs:
- name: Set up Docker Buildx - name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3 uses: docker/setup-buildx-action@v3
with: with:
buildkitd-config-inline: |
[registry."docker.io"]
mirrors = ["https://mirror.gcr.io"]
driver-opts: | driver-opts: |
network=host network=host
@ -301,7 +304,7 @@ jobs:
uses: actions/checkout@v4 uses: actions/checkout@v4
- name: Run sccache-cache - name: Run sccache-cache
uses: mozilla-actions/sccache-action@v0.0.7 uses: mozilla-actions/sccache-action@v0.0.9
with: with:
disable_annotations: true disable_annotations: true
@ -334,7 +337,7 @@ jobs:
uses: actions/checkout@v4 uses: actions/checkout@v4
- name: Run sccache-cache - name: Run sccache-cache
uses: mozilla-actions/sccache-action@v0.0.7 uses: mozilla-actions/sccache-action@v0.0.9
with: with:
disable_annotations: true disable_annotations: true
@ -344,7 +347,7 @@ jobs:
run: | run: |
rustup target add ${{matrix.target}} rustup target add ${{matrix.target}}
# Get latest FoundationDB installer # 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 / 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" cargo build --release --target ${{matrix.target}} -p mail-server --no-default-features --features "foundationdb elastic s3 redis enterprise"
mkdir -p artifacts mkdir -p artifacts

View file

@ -7,6 +7,7 @@ permissions:
contents: write contents: write
jobs: jobs:
deploy: deploy:
if: github.event_name != 'schedule' || !github.event.repository.fork
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Checkout 🛎️ - name: Checkout 🛎️

View file

@ -70,7 +70,7 @@ RUN \
fi fi
# Cargo-chef Cache layer # Cargo-chef Cache layer
RUN \ 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=secret,id=ACTIONS_RUNTIME_TOKEN,env=ACTIONS_RUNTIME_TOKEN \
--mount=type=cache,target=/usr/local/cargo/registry \ --mount=type=cache,target=/usr/local/cargo/registry \
--mount=type=cache,target=/usr/local/cargo/git \ --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"; \ 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 fi
RUN \ 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=secret,id=ACTIONS_RUNTIME_TOKEN,env=ACTIONS_RUNTIME_TOKEN \
--mount=type=cache,target=/usr/local/cargo/registry \ --mount=type=cache,target=/usr/local/cargo/registry \
--mount=type=cache,target=/usr/local/cargo/git \ --mount=type=cache,target=/usr/local/cargo/git \
@ -92,7 +92,7 @@ ENV RUSTC_WRAPPER="sccache" \
SCCACHE_GHA_ENABLED=true SCCACHE_GHA_ENABLED=true
# Build FoundationDB version # Build FoundationDB version
RUN \ 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=secret,id=ACTIONS_RUNTIME_TOKEN,env=ACTIONS_RUNTIME_TOKEN \
--mount=type=cache,target=/usr/local/cargo/registry \ --mount=type=cache,target=/usr/local/cargo/registry \
--mount=type=cache,target=/usr/local/cargo/git \ --mount=type=cache,target=/usr/local/cargo/git \
@ -103,7 +103,7 @@ RUN \
fi fi
# Build generic version # Build generic version
RUN \ 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=secret,id=ACTIONS_RUNTIME_TOKEN,env=ACTIONS_RUNTIME_TOKEN \
--mount=type=cache,target=/usr/local/cargo/registry \ --mount=type=cache,target=/usr/local/cargo/registry \
--mount=type=cache,target=/usr/local/cargo/git \ --mount=type=cache,target=/usr/local/cargo/git \

View file

@ -16,7 +16,7 @@ variable "DOCKER_PLATFORM" {
target "docker-metadata-action" {} target "docker-metadata-action" {}
target "build" { target "build" {
secret = [ secret = [
"type=env,id=ACTIONS_CACHE_URL", "type=env,id=ACTIONS_RESULTS_URL",
"type=env,id=ACTIONS_RUNTIME_TOKEN" "type=env,id=ACTIONS_RUNTIME_TOKEN"
] ]
args = { args = {