Skip to content

Commit

Permalink
[rust] Include checkbox in SM workflow to generate binaries with debu…
Browse files Browse the repository at this point in the history
…g symbols (#12974)

* [rust] Include flag in workflow to build SM in CI with debug info

* [rust] Use cross to build binaries in Windows and macOS

* Revert "[rust] Use cross to build binaries in Windows and macOS"

This reverts commit 05bef2a.

* [rust] Extend setup in dev profile

* [rust] Simplify dev profile

* [rust] Remove dev profile

* [rust] Include debug and split-debuginfo in dev profile

* [rust] Change windows target to stable-i686-pc-windows-gnu

* [rust] Restore rustflags in win32 and macos64

* [rust] Remove rustflags

* [rust] Remove dev profile

* [rust] Include full dev profile

* [rust] Restore dev profile

* [rust] Update Bazel lock file
  • Loading branch information
bonigarcia committed Oct 23, 2023
1 parent 6bee29a commit dd08d31
Show file tree
Hide file tree
Showing 3 changed files with 76 additions and 31 deletions.
99 changes: 70 additions & 29 deletions .github/workflows/build-selenium-manager.yml
@@ -1,32 +1,50 @@
name: Build selenium-manager

on: workflow_dispatch
on:
workflow_dispatch:
inputs:
debug:
description: 'Include debug symbols in binaries'
required: false
type: boolean

jobs:
win32:
name: "[Windows x32] Build selenium-manager"
runs-on: windows-latest
env:
RUSTFLAGS: '-Ctarget-feature=+crt-static'
steps:
- name: "Checkout project"
uses: actions/checkout@v4
- name: "Update Rust"
run: |
rustup update
rustup toolchain install stable-i686-pc-windows-msvc
rustup default stable-i686-pc-windows-msvc
rustup toolchain install stable-i686-pc-windows-gnu
rustup default stable-i686-pc-windows-gnu
rustc -vV
- name: "Build release"
- name: "Build release binary"
if: ${{ inputs.debug == false }}
run: |
cd rust
cargo build --release
- name: "Upload binary"
- name: "Upload release binary"
if: ${{ inputs.debug == false }}
uses: actions/upload-artifact@v3
with:
name: selenium-manager_windows-x32
path: rust/target/release/selenium-manager.exe
retention-days: 6
- name: "Build debug binary"
if: ${{ inputs.debug == true }}
run: |
cd rust
cargo build --profile dev
- name: "Upload debug binary"
if: ${{ inputs.debug == true }}
uses: actions/upload-artifact@v3
with:
name: selenium-manager_windows-x32-debug
path: rust/target/debug/selenium-manager.exe
retention-days: 6

linux64:
name: "[Linux x64] Build selenium-manager"
Expand All @@ -42,26 +60,38 @@ jobs:
run: |
cargo install cross --git https://github.com/cross-rs/cross
cross -V
- name: "Build release"
- name: "Build release binary"
if: ${{ inputs.debug == false }}
run: |
cd rust
cross build --target x86_64-unknown-linux-musl --release
- name: "Tar binary (to keep executable permission)"
run: |
cd rust/target/x86_64-unknown-linux-musl/release
cd target/x86_64-unknown-linux-musl/release
tar -cvf ../../../../selenium-manager.tar selenium-manager
- name: "Upload binary"
- name: "Upload release binary"
if: ${{ inputs.debug == false }}
uses: actions/upload-artifact@v3
with:
name: selenium-manager_linux-x64
path: selenium-manager.tar
retention-days: 6
- name: "Build debug binary"
if: ${{ inputs.debug == true }}
run: |
cd rust
cross build --target x86_64-unknown-linux-musl --profile dev
cd target/x86_64-unknown-linux-musl/debug
tar -cvf ../../../../selenium-manager.tar selenium-manager
- name: "Upload debug binary"
if: ${{ inputs.debug == true }}
uses: actions/upload-artifact@v3
with:
name: selenium-manager_linux-x64-debug
path: selenium-manager.tar
retention-days: 6

macos64:
name: "[macOS x64/arm64] Build selenium-manager"
runs-on: macos-latest
env:
RUSTFLAGS: '-Ctarget-feature=+crt-static'
steps:
- name: "Checkout project"
uses: actions/checkout@v4
Expand All @@ -70,28 +100,39 @@ jobs:
rustup update
rustup target add aarch64-apple-darwin
rustc -vV
- name: "Build x64"
run: |
cd rust
cargo build --release --target x86_64-apple-darwin
- name: "Build arm64"
- name: "Build release binary"
if: ${{ inputs.debug == false }}
run: |
cd rust
cargo build --release --target aarch64-apple-darwin
- name: "Build universal"
run: |
cd rust
lipo -create \
-output target/selenium-manager \
cargo build --target x86_64-apple-darwin --release
cargo build --target aarch64-apple-darwin --release
lipo -create -output target/selenium-manager \
target/aarch64-apple-darwin/release/selenium-manager \
target/x86_64-apple-darwin/release/selenium-manager
- name: "Tar binary (to keep executable permission)"
run: |
cd rust/target
cd target
tar -cvf ../../selenium-manager.tar selenium-manager
- name: "Upload binary"
- name: "Upload release binary"
if: ${{ inputs.debug == false }}
uses: actions/upload-artifact@v3
with:
name: selenium-manager_macos-universal
path: selenium-manager.tar
retention-days: 6
- name: "Build debug binary"
if: ${{ inputs.debug == true }}
run: |
cd rust
cargo build --target x86_64-apple-darwin --profile dev
cargo build --target aarch64-apple-darwin --profile dev
lipo -create -output target/selenium-manager \
target/aarch64-apple-darwin/debug/selenium-manager \
target/x86_64-apple-darwin/debug/selenium-manager
cd target
tar -cvf ../../selenium-manager.tar selenium-manager
- name: "Upload debug binary"
if: ${{ inputs.debug == true }}
uses: actions/upload-artifact@v3
with:
name: selenium-manager_macos-universal-debug
path: selenium-manager.tar
retention-days: 6
2 changes: 1 addition & 1 deletion rust/Cargo.Bazel.lock
@@ -1,5 +1,5 @@
{
"checksum": "baecbb6398eb38a71932eda885dd1343599c233b6c40d4e003fc35e853c53526",
"checksum": "a2e504e4740ef108e28e23990c45d6626cdcbedd415eaf4ab19d66855559e726",
"crates": {
"addr2line 0.19.0": {
"name": "addr2line",
Expand Down
6 changes: 5 additions & 1 deletion rust/Cargo.toml
Expand Up @@ -44,4 +44,8 @@ opt-level = 'z' # Optimize for size
lto = true # Enable Link Time Optimization
codegen-units = 1 # Reduce number of codegen units to increase optimizations
panic = 'abort' # Abort on panic
strip = true # Strip symbols from binary*
strip = true # Strip symbols from binary

[profile.dev]
debug = true # Full debug info
split-debuginfo = 'off' # Debug info in the final artifact

0 comments on commit dd08d31

Please sign in to comment.