-
Notifications
You must be signed in to change notification settings - Fork 247
52 lines (45 loc) · 1.55 KB
/
build-rust.yml
File metadata and controls
52 lines (45 loc) · 1.55 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
name: Build Rust Artifacts
on:
workflow_call:
inputs:
cache-key:
description: "Cache key suffix for rust cache"
required: true
type: string
artifact-name:
description: "Base name for the uploaded artifact"
required: true
type: string
outputs:
artifact-name:
description: "The actual artifact name with hash suffix"
value: ${{ jobs.build.outputs.artifact-name }}
jobs:
build:
name: Build Rust Artifacts
runs-on: ubuntu-latest
timeout-minutes: 15
outputs:
artifact-name: ${{ inputs.artifact-name }}-${{ steps.source-hash.outputs.hash }}
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
with:
shared-key: ${{ inputs.cache-key }}
- name: Calculate source files hash
id: source-hash
run: |
SOURCE_HASH=$(find crates tests Cargo.toml Cargo.lock Makefile makefiles -type f \( -name "*.rs" -o -name "*.toml" -o -name "Makefile" \) -exec sha256sum {} \; | sort | sha256sum | cut -d' ' -f1 | head -c 8)
echo "hash=$SOURCE_HASH" >> $GITHUB_OUTPUT
echo "Source files hash: $SOURCE_HASH"
- name: Build workspace
run: make build
- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ inputs.artifact-name }}-${{ steps.source-hash.outputs.hash }}
path: |
target/debug/kora
target/debug/test_runner
retention-days: 1