Skip to content

Commit 0afe08e

Browse files
authored
Merge pull request #10644 from gitbutlerapp/copilot/update-publish-workflow-env-vars
Set LTO and codegen env vars only for release builds with separate Rust caches
2 parents d6f7d3c + 42b61b1 commit 0afe08e

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

.github/workflows/publish.yaml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ jobs:
137137
- name: Rust Cache
138138
uses: Swatinem/[email protected]
139139
with:
140-
shared-key: app-release-build
140+
shared-key: app-release-build-${{ github.event.inputs.channel || 'nightly' }}
141141
- name: Init Node Environment
142142
uses: ./.github/actions/init-env-node
143143

@@ -191,6 +191,13 @@ jobs:
191191
with:
192192
name: sveltekit-build
193193
path: ./apps/desktop/build/
194+
- name: Set release build optimization env vars
195+
shell: bash
196+
if: github.event.inputs.channel == 'release'
197+
run: |
198+
echo "CARGO_PROFILE_RELEASE_LTO=fat" >> $GITHUB_ENV
199+
echo "CARGO_PROFILE_RELEASE_CODEGEN_UNITS=1" >> $GITHUB_ENV
200+
echo "CARGO_PROFILE_RELEASE_OPT_LEVEL=s" >> $GITHUB_ENV
194201
- name: Build binary
195202
shell: bash
196203
run: |

Cargo.toml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,10 @@ rmcp = { version = "0.1.5" }
101101
serde_json_lenient = "0.2.3"
102102

103103
[profile.release]
104-
lto = "thin" # Enables link to optimizations, but don't go all out on compile time.
105-
opt-level = "s" # Optimize for binary size
104+
# There are no overrides here as we optimise for fast release builds,
105+
# which are used when building locally and when making Nightly builds.
106+
# The Stable release builds override the relevant settings at release time
107+
# to optimise for size.
106108

107109
[profile.bench]
108110
codegen-units = 256

0 commit comments

Comments
 (0)