ci: fix Rust cache (#9377)

This commit is contained in:
Brooooooklyn
2024-12-27 09:59:29 +00:00
parent 6da10f9a93
commit 12bfbf1db0
2 changed files with 14 additions and 12 deletions

View File

@@ -34,15 +34,10 @@ runs:
echo "TARGET_CC=clang" >> "$GITHUB_ENV" echo "TARGET_CC=clang" >> "$GITHUB_ENV"
- name: Cache cargo - name: Cache cargo
uses: actions/cache@v4 uses: Swatinem/rust-cache@v2
with: with:
path: | save-if: ${{ github.ref_name == 'canary' }}
~/.cargo/registry/index/ shared-key: ${{ inputs.target }}-inputs.package
~/.cargo/registry/cache/
~/.cargo/git/db/
~/.napi-rs
target/${{ inputs.target }}
key: stable-${{ inputs.target }}-cargo-cache
- name: Build - name: Build
shell: bash shell: bash
run: | run: |

View File

@@ -31,14 +31,14 @@ jobs:
name: Optimize CI name: Optimize CI
runs-on: ubuntu-latest runs-on: ubuntu-latest
outputs: outputs:
skip: ${{ steps.graphite.outputs.skip }} skip: ${{ steps.check_skip.outputs.skip }}
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- name: Graphite CI Optimizer - name: Graphite CI Optimizer
uses: withgraphite/graphite-ci-action@main uses: withgraphite/graphite-ci-action@main
id: graphite id: check_skip
with: with:
token: ${{ secrets.GRAPHITE_CI_OPTIMIZER_TOKEN }} graphite_token: ${{ secrets.GRAPHITE_CI_OPTIMIZER_TOKEN }}
analyze: analyze:
name: Analyze name: Analyze
@@ -311,6 +311,8 @@ jobs:
build-server-native: build-server-native:
name: Build Server native name: Build Server native
runs-on: ubuntu-latest runs-on: ubuntu-latest
needs: optimize_ci
if: needs.optimize_ci.outputs.skip == 'false'
env: env:
CARGO_PROFILE_RELEASE_DEBUG: '1' CARGO_PROFILE_RELEASE_DEBUG: '1'
steps: steps:
@@ -335,7 +337,8 @@ jobs:
build-electron-renderer: build-electron-renderer:
name: Build @affine/electron renderer name: Build @affine/electron renderer
runs-on: ubuntu-latest runs-on: ubuntu-latest
needs: optimize_ci
if: needs.optimize_ci.outputs.skip == 'false'
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- name: Setup Node.js - name: Setup Node.js
@@ -425,6 +428,8 @@ jobs:
rust-test: rust-test:
name: Run native tests name: Run native tests
runs-on: ubuntu-latest runs-on: ubuntu-latest
needs: optimize_ci
if: needs.optimize_ci.outputs.skip == 'false'
env: env:
CARGO_TERM_COLOR: always CARGO_TERM_COLOR: always
steps: steps:
@@ -826,6 +831,8 @@ jobs:
test-build-mobile-app: test-build-mobile-app:
uses: ./.github/workflows/release-mobile.yml uses: ./.github/workflows/release-mobile.yml
needs: optimize_ci
if: needs.optimize_ci.outputs.skip == 'false'
with: with:
build-type: canary build-type: canary
build-target: development build-target: development