- 
                Notifications
    You must be signed in to change notification settings 
- Fork 44
ci: improve caching #2329
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
          
     Merged
      
      
    
  
     Merged
                    ci: improve caching #2329
Changes from 39 commits
      Commits
    
    
            Show all changes
          
          
            42 commits
          
        
        Select commit
          Hold shift + click to select a range
      
      0bba026
              
                ci: fix docker cache mounts
              
              
                shumkov ea76396
              
                Merge branch 'refs/heads/v1.6-dev' into ci/fix-docker-cache-mounts
              
              
                shumkov 4124bc3
              
                ci: switch more to gha
              
              
                shumkov fad022e
              
                Merge branch 'v1.6-dev' into ci/fix-docker-cache-mounts
              
              
                shumkov 83f6659
              
                ci: fix artifact key
              
              
                shumkov 6a03bd3
              
                ci: try using download artifact
              
              
                shumkov 98232ef
              
                ci: use artifacts
              
              
                shumkov bf3fb89
              
                ci: remove unnecessary archive step
              
              
                shumkov 9c79aec
              
                ci: rename artifact
              
              
                shumkov a12d16d
              
                ci: fix get modified files
              
              
                shumkov 30111be
              
                ci: fix get modified files again
              
              
                shumkov 8aa56d9
              
                ci: fix download certificates
              
              
                shumkov 5eab16c
              
                docs: add comment
              
              
                shumkov 71bddba
              
                ci: layer to registry, disable sccache
              
              
                shumkov 84852e4
              
                ci: fix workflow
              
              
                shumkov fe9f565
              
                ci: fix librocksdb cache
              
              
                shumkov c9dd655
              
                ci: fix docker layer cache
              
              
                shumkov a957dd0
              
                ci: back to ECR
              
              
                shumkov e338503
              
                ci: fix js artifacts
              
              
                shumkov b4f6d72
              
                build: remove target cache to enable chief
              
              
                shumkov b0795d0
              
                build: fix build-js
              
              
                shumkov 860a04c
              
                build: fix chief
              
              
                shumkov 55bb2ed
              
                build: fix chief 2
              
              
                shumkov c77aed5
              
                build: pass target and features to chef
              
              
                shumkov 3b1cf97
              
                build: trying to fix drive build
              
              
                shumkov 959016d
              
                build: remove target
              
              
                shumkov febf93e
              
                build: remove target and s3 for layercache
              
              
                shumkov 2e34367
              
                ci: enable sccache
              
              
                shumkov 3321e15
              
                ci: remove target in the same layer
              
              
                shumkov 7cb68cc
              
                ci: fix cache mounts and remove unnecessary steps
              
              
                shumkov 3b65eeb
              
                ci: fix RUNNER_TEMP
              
              
                shumkov 163323c
              
                ci: fix region and home
              
              
                shumkov 9cdea04
              
                ci: fix cache from
              
              
                shumkov 732b2b4
              
                chore: kick off CI
              
              
                shumkov 7aa6617
              
                chore: add new lines
              
              
                shumkov cdf633e
              
                ci: fix dashmate e2e tests
              
              
                shumkov 7b7e5aa
              
                ci: fix restore key
              
              
                shumkov 9869252
              
                ci: remove commented code
              
              
                shumkov 72539f4
              
                ci: cache to base manifest only on base branch push
              
              
                shumkov cd35f65
              
                ci: fix manifestNames is not defined
              
              
                shumkov f078ec0
              
                chore: fix security vulnerability
              
              
                shumkov 143f980
              
                ci: we don't want to remove artifacts
              
              
                shumkov File filter
Filter by extension
Conversations
          Failed to load comments.   
        
        
          
      Loading
        
  Jump to
        
          Jump to file
        
      
      
          Failed to load files.   
        
        
          
      Loading
        
  Diff view
Diff view
There are no files selected for viewing
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
|  | @@ -22,12 +22,6 @@ inputs: | |
| description: User name to use when pushing images to Docker Hub | ||
| dockerhub_token: | ||
| description: Docker Hub token to use | ||
| cache_mounts: | ||
| description: Load cache mounts cache | ||
| default: | | ||
| cargo_registry_index | ||
| cargo_registry_cache | ||
| cargo_git | ||
| cargo_profile: | ||
| description: Cargo build profile, i.e release or dev | ||
| default: dev | ||
|  | @@ -43,6 +37,9 @@ inputs: | |
| aws_secret_access_key: | ||
| description: AWS secret access key | ||
| required: true | ||
| cache_to_name: | ||
| description: 'Save cache to name manifest (should be used only on default branch)' | ||
| default: 'false' | ||
| outputs: | ||
| digest: | ||
| value: ${{ steps.docker_build.outputs.digest }} | ||
|  | @@ -65,17 +62,10 @@ runs: | |
| install: true | ||
| driver-opts: env.BUILDKIT_STEP_LOG_MAX_SIZE=10485760 | ||
| cleanup: false | ||
| config-inline: | | ||
| buildkitd-config-inline: | | ||
| [worker.oci] | ||
| gc = false | ||
|  | ||
| - name: Load Docker mount cache | ||
| uses: dcginfra/buildkit-cache-dance/inject@s5cmd | ||
| if: ${{ inputs.cache_mounts != '' }} | ||
| with: | ||
| bucket: ${{ inputs.bucket }} | ||
| mounts: ${{ inputs.cache_mounts }} | ||
|  | ||
| - name: Set Docker tags and labels from image tag | ||
| id: docker_meta | ||
| uses: docker/metadata-action@v5 | ||
|  | @@ -90,16 +80,83 @@ runs: | |
| id: layer_cache_settings | ||
| with: | ||
| name: ${{ inputs.image_name }} | ||
| region: ${{ inputs.region }} | ||
| bucket: ${{ inputs.bucket }} | ||
| cache_to_name: ${{ inputs.cache_to_name }} | ||
|  | ||
| - name: Set HOME variable to github context | ||
| shell: bash | ||
| run: echo "HOME=$HOME" >> $GITHUB_ENV | ||
|  | ||
| - name: Cargo cache for Docker | ||
| uses: actions/cache@v4 | ||
| id: cargo-cache | ||
| with: | ||
| path: | | ||
| ${{ env.HOME }}/cargo-cache-registry-index | ||
| ${{ env.HOME }}/cargo-cache-registry-cache | ||
| ${{ env.HOME }}/cargo-cache-git-db | ||
| key: ${{ runner.os }}-cargo-${{ hashFiles('Cargo.lock') }} | ||
| restore-keys: | | ||
| ${{ runner.os }}-cargo- | ||
|         
                  lklimek marked this conversation as resolved.
              Show resolved
            Hide resolved | ||
|  | ||
| - name: Inject cargo cache into docker | ||
| uses: reproducible-containers/[email protected] | ||
| with: | ||
| cache-map: | | ||
| { | ||
| "${{ env.HOME }}/cargo-cache-registry-index": { | ||
| "target": "/root/.cargo/registry/index", | ||
| "id": "cargo_registry_index" | ||
| }, | ||
| "${{ env.HOME }}/cargo-cache-registry-cache": { | ||
| "target": "/root/.cargo/registry/cache", | ||
| "id": "cargo_registry_cache" | ||
| }, | ||
| "${{ env.HOME }}/cargo-cache-git-db": { | ||
| "target": "/root/.cargo/git/db", | ||
| "id": "cargo_git" | ||
| } | ||
| } | ||
| skip-extraction: ${{ steps.cargo-cache.outputs.cache-hit }} | ||
|  | ||
| - name: Yarn unplugged cache for Docker | ||
| uses: actions/cache@v4 | ||
| id: yarn-cache | ||
| with: | ||
| path: ${{ env.HOME }}/yarn-unplugged-cache | ||
| key: ${{ inputs.platform }}-yarn-unplugged-${{ hashFiles('yarn.lock') }} | ||
| restore-keys: | | ||
| ${{ inputs.platform }}-yarn-unplugged- | ||
|  | ||
| - name: Set arch | ||
| id: arch | ||
| uses: actions/github-script@v6 | ||
| with: | ||
| result-encoding: 'string' | ||
| script: return '${{ inputs.platform }}'.replace('linux/', ''); | ||
|  | ||
| - name: Inject cargo cache into docker | ||
| uses: reproducible-containers/[email protected] | ||
| with: | ||
| cache-map: | | ||
| { | ||
| "${{ env.HOME }}/yarn-unplugged-cache": { | ||
| "target": "/tmp/unplugged", | ||
| "id": "unplugged_${{ steps.arch.outputs.result }}" | ||
| } | ||
| } | ||
| skip-extraction: ${{ steps.yarn-cache.outputs.cache-hit }} | ||
|  | ||
| - name: Build and push Docker image ${{ inputs.image }} | ||
| id: docker_build | ||
| uses: docker/build-push-action@v5 | ||
| uses: docker/build-push-action@v6 | ||
| with: | ||
| context: . | ||
| builder: ${{ steps.buildx.outputs.name }} | ||
| target: ${{ inputs.target }} | ||
| labels: ${{ steps.docker_meta.outputs.labels }} | ||
| push: ${{ inputs.push_tags }} | ||
| tags: ${{ inputs.push_tags == 'true' && steps.docker_meta.outputs.tags || '' }} | ||
| platforms: ${{ inputs.platform }} | ||
| build-args: | | ||
|  | @@ -110,15 +167,6 @@ runs: | |
| SCCACHE_S3_KEY_PREFIX=${{ runner.os }}/sccache | ||
| AWS_ACCESS_KEY_ID=${{ inputs.aws_access_key_id }} | ||
| AWS_SECRET_ACCESS_KEY=${{ inputs.aws_secret_access_key }} | ||
| AWS_REGION=${{ inputs.region }} | ||
| cache-from: ${{ steps.layer_cache_settings.outputs.cache_from }} | ||
| cache-to: ${{ steps.layer_cache_settings.outputs.cache_to }} | ||
| outputs: type=image,name=${{ inputs.image_org }}/${{ inputs.image_name }},push-by-digest=${{ inputs.push_tags != 'true' }},name-canonical=true,push=true | ||
|  | ||
| # TODO: This is doesn't work | ||
| # - name: Save Docker mount cache | ||
| # uses: dcginfra/buildkit-cache-dance/extract@s5cmd | ||
| # if: ${{ inputs.cache_mounts != '' }} | ||
| # with: | ||
| # bucket: ${{ inputs.bucket }} | ||
| # mounts: ${{ inputs.cache_mounts }} | ||
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
|  | @@ -17,6 +17,7 @@ inputs: | |
| required: false | ||
| default: "true" | ||
|  | ||
| # TODO: Cache deps here to save 1 minute | ||
| runs: | ||
| using: composite | ||
| steps: | ||
|  | @@ -32,10 +33,8 @@ runs: | |
| echo "TOOLCHAIN_VERSION=$TOOLCHAIN_VERSION" >> $GITHUB_ENV | ||
| echo "::set-output name=version::$TOOLCHAIN_VERSION" | ||
|  | ||
| # TODO: Move to AMI and build every day | ||
| - uses: dtolnay/rust-toolchain@master | ||
| name: Install Rust toolchain | ||
| id: install_rust | ||
| with: | ||
| toolchain: ${{ steps.rust_toolchain.outputs.version }} | ||
| target: ${{ inputs.target }} | ||
|  | @@ -60,7 +59,6 @@ runs: | |
| ;; | ||
| esac | ||
|  | ||
| # TODO: Move to AMI and build every day | ||
| - name: Check if protoc is installed | ||
| id: check-protoc | ||
| shell: bash | ||
|  | @@ -84,27 +82,20 @@ runs: | |
| echo "PROTOC=${HOME}/.local/bin/protoc" >> $GITHUB_ENV | ||
| export PATH="${PATH}:${HOME}/.local/bin" | ||
|  | ||
| - name: Run sccache-cache | ||
| - name: Install sccache-cache | ||
| uses: mozilla-actions/[email protected] | ||
| with: | ||
| version: "v0.8.2" # Must be the same as in Dockerfile | ||
| if: inputs.cache == 'true' | ||
|  | ||
| - name: Hash ref_name | ||
| id: hashed-ref-name | ||
| shell: bash | ||
| run: echo "key=$(echo '${{ github.ref_name }}' | sha256sum | cut -d ' ' -f1)" >> $GITHUB_OUTPUT | ||
|  | ||
| - name: Set HOME variable to github context | ||
| shell: bash | ||
| run: echo "HOME=$HOME" >> $GITHUB_ENV | ||
|  | ||
| - name: Cache cargo registry (S3 bucket cache) | ||
| uses: strophy/actions-cache@opendal-update | ||
| - name: Cache cargo registry | ||
| uses: actions/cache@v4 | ||
| if: inputs.cache == 'true' | ||
| with: | ||
| bucket: multi-runner-cache-x1xibo9c | ||
| root: actions-cache | ||
| path: | | ||
| ${{ env.HOME }}/.cargo/registry/index | ||
| ${{ env.HOME }}/.cargo/registry/cache | ||
|  | @@ -114,7 +105,6 @@ runs: | |
| ${{ runner.os }}/cargo/registry/${{ hashFiles('**/Cargo.lock') }} | ||
| ${{ runner.os }}/cargo/registry/ | ||
|  | ||
| # TODO: Move to AMI and build every day | ||
| - name: Install clang | ||
| id: deps-clang | ||
| shell: bash | ||
|  | ||
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              This file was deleted.
      
      Oops, something went wrong.
      
    
  
      
      Oops, something went wrong.
        
    
  
      
      Oops, something went wrong.
        
    
  
  Add this suggestion to a batch that can be applied as a single commit.
  This suggestion is invalid because no changes were made to the code.
  Suggestions cannot be applied while the pull request is closed.
  Suggestions cannot be applied while viewing a subset of changes.
  Only one suggestion per line can be applied in a batch.
  Add this suggestion to a batch that can be applied as a single commit.
  Applying suggestions on deleted lines is not supported.
  You must change the existing code in this line in order to create a valid suggestion.
  Outdated suggestions cannot be applied.
  This suggestion has been applied or marked resolved.
  Suggestions cannot be applied from pending reviews.
  Suggestions cannot be applied on multi-line comments.
  Suggestions cannot be applied while the pull request is queued to merge.
  Suggestion cannot be applied right now. Please check back later.
  
    
  
    
Uh oh!
There was an error while loading. Please reload this page.