Skip to content

Commit

Permalink
remove strip
Browse files Browse the repository at this point in the history
  • Loading branch information
sword-jin committed Jul 13, 2024
1 parent b729be7 commit 1273500
Show file tree
Hide file tree
Showing 7 changed files with 64 additions and 29 deletions.
35 changes: 12 additions & 23 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,6 @@ jobs:
TARGET_DIR: ./target
# Emit backtraces on panics.
RUST_BACKTRACE: 1
# The name of the executable to expect
EXE_NAME: ein
strategy:
matrix:
build: [ linux, linux-arm, macos, win-msvc, win-gnu, win32-msvc ]
Expand Down Expand Up @@ -104,13 +102,22 @@ jobs:
uses: actions/checkout@v4
with:
fetch-depth: 1

- name: Install Protoc
uses: arduino/setup-protoc@v3
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}

- name: Install packages (Ubuntu)
# Because openssl doesn't work on musl by default, we resort to max-pure. And that won't need any dependency, so we can skip this.continue-on-error
# Once we want to support better zlib performance, we might have to re-add it.
if: matrix.os == 'ubuntu-latest-disabled'
run: |
sudo apt-get update && sudo apt-get install -y --no-install-recommends xz-utils liblz4-tool musl-tools
- name: compile protobuf
run: |
protoc --descriptor_set_out=./tunneld-protocol/src/message.bin --proto_path=tunneld-protocol/src message.proto
- name: Install Rust
uses: dtolnay/rust-toolchain@master
Expand All @@ -126,11 +133,6 @@ jobs:
echo "TARGET_FLAGS=--target ${{ matrix.target }}" >> $GITHUB_ENV
echo "TARGET_DIR=./target/${{ matrix.target }}" >> $GITHUB_ENV
- name: Install Protoc
uses: arduino/setup-protoc@v3
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}

- name: Show command used for Cargo
run: |
echo "cargo command is: ${{ env.CARGO }}"
Expand All @@ -156,33 +158,20 @@ jobs:
- name: Build release binary
run: ${{ env.CARGO }} build --verbose --release ${{ env.TARGET_FLAGS }}

- name: Strip release binary (linux and macos)
if: matrix.build == 'linux' || matrix.build == 'macos'
run: strip target/${{ matrix.target }}/release/${{ env.EXE_NAME }} target/${{ matrix.target }}/release/gix

- name: Strip release binary (arm)
if: matrix.build == 'linux-arm'
run: |
docker run --rm -v \
"$PWD/target:/target:Z" \
rustembedded/cross:arm-unknown-linux-gnueabihf \
arm-linux-gnueabihf-strip \
/target/arm-unknown-linux-gnueabihf/release/${{ env.EXE_NAME }} \
/target/arm-unknown-linux-gnueabihf/release/gix
- name: Build archive
shell: bash
run: |
staging="tunneld-${{ env.RELEASE_VERSION }}-${{ matrix.target }}"
mkdir -p "$staging"
cp {README.md,LICENSE-*,CHANGELOG.md} "$staging/"
cp {README.md,LICENSE} "$staging/"
if [ "${{ matrix.os }}" = "windows-latest" ]; then
cp target/release/${{ env.EXE_NAME }}.exe target/release/gix.exe "$staging/"
cp target/${{ matrix.target }}/release/tunneld.exe target/${{ matrix.target }}/release/tunnel.exe "$staging/"
7z a "$staging.zip" "$staging"
echo "ASSET=$staging.zip" >> $GITHUB_ENV
else
cp target/${{ matrix.target }}/release/${{ env.EXE_NAME }} target/${{ matrix.target }}/release/gix "$staging/"
cp target/${{ matrix.target }}/release/tunneld target/${{ matrix.target }}/release/tunnel "$staging/"
tar czf "$staging.tar.gz" "$staging"
echo "ASSET=$staging.tar.gz" >> $GITHUB_ENV
fi
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
/target
*.txt
*.txt
*.bin
28 changes: 28 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion tunneld-pkg/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ futures = "0.3.30"
bytes = "1.6.0"

[features]
debug=[]
debug=[]
1 change: 1 addition & 0 deletions tunneld-protocol/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@ prost = "0.12.6"

[build-dependencies]
tonic-build = "0.11.0"
which = "6.0.1"
22 changes: 19 additions & 3 deletions tunneld-protocol/build.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,24 @@
use std::io::Result;

use which::which;

fn main() -> Result<()> {
tonic_build::configure()
.protoc_arg("--experimental_allow_proto3_optional")
.compile(&["src/message.proto"], &["src/"])?;
let builder = tonic_build::configure().protoc_arg("--experimental_allow_proto3_optional");

match which("protoc") {
Ok(_) => {
println!("found protoc");
builder.compile(&["src/message.proto"], &["src/"])?;
}
Err(_) => {
println!("since there is no protoc in the path, we skip the protoc run");
println!("protoc --descriptor_set_out=message.bin --proto_path=. message.proto");
builder
.skip_protoc_run()
.file_descriptor_set_path("src/message.bin")
.compile(&["src/message.bin"], &["src/"])?;
}
}

Ok(())
}
2 changes: 1 addition & 1 deletion tunneld-protocol/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
pub mod pb {
tonic::include_proto!("message");
tonic::include_proto!("message");
}

// before connectrpc releases rust version, we validate the message by ourselves
Expand Down

0 comments on commit 1273500

Please sign in to comment.