Skip to content

Commit

Permalink
ci: disable rust cache
Browse files Browse the repository at this point in the history
  • Loading branch information
shumkov committed Nov 7, 2023
1 parent 12bd828 commit e0a0753
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 42 deletions.
82 changes: 46 additions & 36 deletions .github/actions/rust/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,24 @@ inputs:
description: Enable Rust cache
required: false
default: 'true'
# bucket:
# description: S3 bucket to use for caching, must match runner define in `runs-on`
# default: multi-runner-linux-x64-platform-cache-ui535z23

runs:
using: composite
steps:
# TODO: Move to AMI and build every day
- uses: dtolnay/rust-toolchain@master
name: Install Rust toolchain
with:
toolchain: ${{ inputs.toolchain }}
target: ${{ inputs.target }}
components: ${{ inputs.components }}
env:
CARGO_INCREMENTAL: "1"
# env:
# CARGO_INCREMENTAL: "1"

# TODO: Move to AMI and build every day
- name: Install protoc
id: deps-protoc
shell: bash
Expand All @@ -40,34 +45,39 @@ runs:
echo "PROTOC=${HOME}/.local/bin/protoc" >> $GITHUB_ENV
export PATH="${PATH}:${HOME}/.local/bin"
# - name: Run sccache-cache
# uses: mozilla-actions/[email protected]
# with:
# version: "v0.7.0"

- name: Hash ref_name
id: hashed-ref-name
shell: bash
run: echo "key=$(echo '${{ github.ref_name }}' | sha256sum | cut -d ' ' -f1)" >> $GITHUB_OUTPUT

- id: build-cache-start
shell: bash
run: echo "start_time=$(date +%s)" >> $GITHUB_OUTPUT

- name: Cache Rust build artifacts (S3 bucket cache)
uses: strophy/actions-cache@opendal-update
if: contains(runner.name, 'ubuntu-platform') && inputs.cache == 'true'
with:
bucket: multi-runner-linux-x64-platform-cache-ui535z23
root: actions-cache
path: |
target
retimer-state
key: ${{ runner.os }}/cargo/build/${{ inputs.target }}/${{ hashFiles('**/Cargo.lock') }}/${{ steps.hashed-ref-name.outputs.key }}/${{ github.sha }}
restore-keys: |
${{ runner.os }}/cargo/build/${{ inputs.target }}/${{ hashFiles('**/Cargo.lock') }}/${{ steps.hashed-ref-name.outputs.key }}/${{ github.sha }}
${{ runner.os }}/cargo/build/${{ inputs.target }}/${{ hashFiles('**/Cargo.lock') }}/${{ steps.hashed-ref-name.outputs.key }}/
${{ runner.os }}/cargo/build/${{ inputs.target }}/${{ hashFiles('**/Cargo.lock') }}/
${{ runner.os }}/cargo/build/${{ inputs.target }}/
# - id: build-cache-start
# shell: bash
# run: echo "start_time=$(date +%s)" >> $GITHUB_OUTPUT
#
# - name: Cache Rust build artifacts (S3 bucket cache)
# uses: strophy/actions-cache@opendal-update
# if: contains(runner.name, 'ubuntu-platform') && inputs.cache == 'true'
# with:
# bucket: multi-runner-linux-x64-platform-cache-ui535z23
# root: actions-cache
# path: |
# target
# retimer-state
# key: ${{ runner.os }}/cargo/build/${{ inputs.target }}/${{ hashFiles('**/Cargo.lock') }}/${{ steps.hashed-ref-name.outputs.key }}/${{ github.sha }}
# restore-keys: |
# ${{ runner.os }}/cargo/build/${{ inputs.target }}/${{ hashFiles('**/Cargo.lock') }}/${{ steps.hashed-ref-name.outputs.key }}/${{ github.sha }}
# ${{ runner.os }}/cargo/build/${{ inputs.target }}/${{ hashFiles('**/Cargo.lock') }}/${{ steps.hashed-ref-name.outputs.key }}/
# ${{ runner.os }}/cargo/build/${{ inputs.target }}/${{ hashFiles('**/Cargo.lock') }}/
# ${{ runner.os }}/cargo/build/${{ inputs.target }}/

- shell: bash
run: |
echo "Elapsed time: $(($(date +%s) - ${{ steps.build-cache-start.outputs.start_time }})) seconds"
# - shell: bash
# run: |
# echo "Elapsed time: $(($(date +%s) - ${{ steps.build-cache-start.outputs.start_time }})) seconds"

- id: registry-cache-start
shell: bash
Expand Down Expand Up @@ -125,16 +135,16 @@ runs:
if: runner.os == 'Linux'
run: |
sudo apt update -qq
sudo apt install -qq --yes clang llvm b3sum
sudo apt install -qq --yes clang llvm
sudo update-alternatives --set cc /usr/bin/clang
- id: retimer-start
shell: bash
run: echo "start_time=$(date +%s)" >> $GITHUB_OUTPUT

- name: Run retimer to adjust source files mtime for cargo build cache
uses: dcginfra/retimer@master

- shell: bash
run: |
echo "Elapsed time: $(($(date +%s) - ${{ steps.retimer-start.outputs.start_time }})) seconds"
# b3sum
# - id: retimer-start
# shell: bash
# run: echo "start_time=$(date +%s)" >> $GITHUB_OUTPUT
#
# - name: Run retimer to adjust source files mtime for cargo build cache
# uses: dcginfra/retimer@master
#
# - shell: bash
# run: |
# echo "Elapsed time: $(($(date +%s) - ${{ steps.retimer-start.outputs.start_time }})) seconds"
12 changes: 6 additions & 6 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,17 +50,17 @@ jobs:
secrets: inherit
uses: ./.github/workflows/tests-build-images.yml

build-rust:
name: Build Rust packages
if: ${{ github.event_name == 'push' || github.event_name == 'workflow_dispatch' || github.event_name == 'schedule' || !github.event.pull_request.draft }}
secrets: inherit
uses: ./.github/workflows/tests-build-rust.yml
# build-rust:
# name: Build Rust packages
# if: ${{ github.event_name == 'push' || github.event_name == 'workflow_dispatch' || github.event_name == 'schedule' || !github.event.pull_request.draft }}
# secrets: inherit
# uses: ./.github/workflows/tests-build-rust.yml

rs-package:
name: Rust package
needs:
- changes
- build-rust
# - build-rust
secrets: inherit
strategy:
fail-fast: false
Expand Down

0 comments on commit e0a0753

Please sign in to comment.