@@ -16,9 +16,7 @@ concurrency:
1616
1717env :
1818 CARGO_TERM_COLOR : always
19- SCCACHE_DIR : ${{github.workspace}}/sccache/
20- SCCACHE_CACHE_SIZE : 1G
21- ACTIONS_CACHE_KEY_DATE : 2023-04-19
19+ ACTIONS_CACHE_KEY_DATE : 2023-06-19
2220 CI : true
2321
2422jobs :
@@ -54,10 +52,12 @@ jobs:
5452 - name : Get Rust version & build version
5553 shell : bash
5654 run : |
55+ set -x
5756 echo "RUST_VERSION=$(rustc --version)" >> $GITHUB_OUTPUT
5857 VERSION=$(src/ci/get-version.sh)
59- # it's a release build if version doesn't have a hyphen in it
60- IS_RELEASE_BUILD=$(if [[ "$VERSION" =~ '-' ]]; then echo 'false'; else echo 'true'; fi)
58+ # it's a release build if version doesn't have a plus in it
59+ # NB: this should stay in sync with version generation in get-version.sh
60+ IS_RELEASE_BUILD=$(if [[ "$VERSION" =~ '+' ]]; then echo 'false'; else echo 'true'; fi)
6161 echo "RELEASE_BUILD=$IS_RELEASE_BUILD" >> $GITHUB_OUTPUT
6262 id : rust-version
6363 - name : Rust artifact cache
@@ -71,35 +71,22 @@ jobs:
7171 path : artifacts
7272 key : agent-artifacts|${{ join(matrix.os, ':') }}|${{steps.rust-version.outputs.RUST_VERSION}}|${{ env.ACTIONS_CACHE_KEY_DATE }}|${{ hashFiles('src/agent/**/*') }}|${{hashFiles('src/ci/agent.sh')}}
7373 # note: also including the ACTIONS_CACHE_KEY_DATE to rebuild if the Prereq Cache is invalidated
74+ - name : Rust build cache
75+ id : rust-build-cache
76+ uses : Swatinem/rust-cache@v2
77+ if : steps.cache-agent-artifacts.outputs.cache-hit != 'true'
78+ with :
79+ key : ${{env.ACTIONS_CACHE_KEY_DATE}} # additional key for cache-busting
80+ workspaces : src/agent
7481 - name : Linux Prereqs
7582 if : runner.os == 'Linux' && steps.cache-agent-artifacts.outputs.cache-hit != 'true'
7683 run : |
7784 sudo apt-get -y update
7885 sudo apt-get -y install libssl-dev libunwind-dev build-essential pkg-config
79- - name : Rust Prereq Cache
80- if : steps.cache-agent-artifacts.outputs.cache-hit != 'true'
81- uses : actions/cache@v3
82- id : cache-rust-prereqs
83- with :
84- path : |
85- ~/.cargo/registry
86- ~/.cargo/git
87- ~/.cargo/bin
88- key : rust|${{ join(matrix.os, ':') }}|${{steps.rust-version.outputs.RUST_VERSION}}|${{ env.ACTIONS_CACHE_KEY_DATE }}
8986 - name : Install Rust Prereqs
90- if : steps.cache- rust-prereqs .outputs.cache-hit != 'true' && steps.cache-agent-artifacts.outputs.cache-hit != 'true'
87+ if : steps.rust-build-cache .outputs.cache-hit != 'true' && steps.cache-agent-artifacts.outputs.cache-hit != 'true'
9188 shell : bash
9289 run : src/ci/rust-prereqs.sh
93- - name : Rust Compile Cache
94- if : steps.cache-agent-artifacts.outputs.cache-hit != 'true'
95- uses : actions/cache@v3
96- with :
97- path : |
98- sccache
99- src/agent/target
100- key : agent|${{ join(matrix.os, ':') }}|${{steps.rust-version.outputs.RUST_VERSION}}|${{ env.ACTIONS_CACHE_KEY_DATE }}|${{ hashFiles('src/agent/Cargo.lock') }}
101- restore-keys : |
102- agent|${{ join(matrix.os, ':') }}|${{steps.rust-version.outputs.RUST_VERSION}}|${{ env.ACTIONS_CACHE_KEY_DATE }}|
10390 - run : src/ci/agent.sh
10491 if : steps.cache-agent-artifacts.outputs.cache-hit != 'true'
10592 shell : bash
@@ -237,29 +224,16 @@ jobs:
237224 runs-on : ubuntu-20.04
238225 steps :
239226 - uses : actions/checkout@v3
240- - name : Rust Prereq Cache
241- uses : actions/ cache@v3
242- id : cache- rust-prereqs
227+ - name : Rust build cache
228+ id : rust-build- cache
229+ uses : Swatinem/ rust-cache@v2
243230 with :
244- path : |
245- ~/.cargo/registry
246- ~/.cargo/git
247- ~/.cargo/bin
248- key : rust-${{ runner.os }}-${{ env.ACTIONS_CACHE_KEY_DATE }}
231+ key : ${{env.ACTIONS_CACHE_KEY_DATE}} # additional key for cache-busting
232+ workspaces : src/proxy-manager
249233 - name : Install Rust Prereqs
250- if : steps.cache- rust-prereqs .outputs.cache-hit != 'true'
234+ if : steps.rust-build-cache .outputs.cache-hit != 'true'
251235 shell : bash
252236 run : src/ci/rust-prereqs.sh
253- - name : Rust Compile Cache
254- uses : actions/cache@v3
255- with :
256- path : |
257- sccache
258- src/proxy-manager/target
259- key : proxy-${{ runner.os }}-${{ hashFiles('src/proxy-manager/Cargo.lock') }}-${{ env.ACTIONS_CACHE_KEY_DATE }}
260- restore-keys : |
261- proxy-${{ runner.os }}-${{ hashFiles('src/proxy-manager/Cargo.lock') }}-
262- proxy-${{ runner.os }}-
263237 - run : src/ci/proxy.sh
264238 - uses : actions/upload-artifact@v3
265239 with :
@@ -301,6 +275,7 @@ jobs:
301275
302276 - name : Build Service
303277 run : |
278+ set -x
304279 version=$(./src/ci/get-version.sh)
305280
306281 cd src/ApiService/
@@ -310,10 +285,12 @@ jobs:
310285 echo ${GITHUB_SHA} | tee ApiService/onefuzzlib/git.version
311286
312287 # stamp the build with version
313- # note that version might have a suffix of '-{sha}' from get-version.sh
314- if [[ "$version" =~ '-' ]]; then
288+ # note that version might have a suffix of '+{sha}' from get-version.sh
289+
290+ # NB: ensure this stays in sync with get-version.sh
291+ if [[ "$version" =~ '+' ]]; then
315292 # if it has a suffix, split it into two parts
316- dotnet build -warnaserror --configuration Release /p:VersionPrefix=${version%- *} /p:VersionSuffix=${version#*- }
293+ dotnet build -warnaserror --configuration Release /p:VersionPrefix=${version%+ *} /p:VersionSuffix=${version#*+ }
317294 else
318295 dotnet build -warnaserror --configuration Release /p:VersionPrefix=${version}
319296 fi
0 commit comments