Open
Description
The action
usually takes about more than 30mins for large project in every ci run.
Do we have cache
options to build from last action
?
The example actions is here,
name: build
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CARGO_TERM_COLOR: always
on:
workflow_call:
inputs:
path:
default: 'Cargo.toml'
required: true
type: string
target:
default: 'x86_64-unknown-linux-gnu'
required: true
type: string
platform:
default: 'ubuntu-latest'
required: true
type: string
jobs:
ready:
uses: ./.github/workflows/parse-info.yml
with:
path: ${{ inputs.path }}
cross-build:
name: publish - ${{ inputs.target }}
runs-on: ${{ inputs.platform }}
needs:
- ready
steps:
- uses: actions/checkout@v4
- name: Set LTO to true (Windows)
if: runner.os == 'Windows'
run: |
$fileContent = Get-Content ./Cargo.toml
$fileContent = $fileContent -replace 'lto = false', 'lto = true'
Set-Content ./Cargo.toml $fileContent
- name: Set LTO to true (Linux/macOS)
if: runner.os != 'Windows'
run: perl -pi -e 's/lto = false/lto = true/g' ./Cargo.toml
- uses: taiki-e/github-actions/install-rust@main
with:
toolchain: nightly
- name: Install cross-compilation tools
uses: taiki-e/[email protected]
with:
target: ${{ inputs.target }}
if: contains(inputs.target, 'linux-musl')
- run: echo "RUSTFLAGS=${RUSTFLAGS} -C target-feature=+crt-static" >> "${GITHUB_ENV}"
if: endsWith(inputs.target, 'windows-msvc')
- uses: taiki-e/[email protected]
with:
bin: ${{ needs.ready.outputs.name }}
target: ${{ inputs.target }}
ref: refs/tags/${{ needs.ready.outputs.version }}
tar: all
zip: windows
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CARGO_PROFILE_RELEASE_CODEGEN_UNITS: 1
CARGO_PROFILE_RELEASE_LTO: true
How to add cache
strategy to accelerate taiki-e/upload-rust-binary-action
🤗
Metadata
Metadata
Assignees
Labels
No labels