-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
75 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -57,6 +57,8 @@ jobs: | |
build-release: | ||
name: build-release | ||
needs: [ "create-release" ] | ||
permissions: | ||
contents: write | ||
env: | ||
# For some builds, we use cross to test on 32-bit and big-endian | ||
# systems. | ||
|
@@ -67,8 +69,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 ] | ||
|
@@ -104,13 +104,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 | ||
|
@@ -126,11 +135,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 }}" | ||
|
@@ -146,53 +150,35 @@ jobs: | |
- name: Set release upload URL and release version | ||
shell: bash | ||
run: | | ||
release_upload_url="$(cat artifacts/release-upload-url)" | ||
echo "RELEASE_UPLOAD_URL=$release_upload_url" >> $GITHUB_ENV | ||
echo "release upload url: $RELEASE_UPLOAD_URL" | ||
release_version="$(cat artifacts/release-version)" | ||
echo "RELEASE_VERSION=$release_version" >> $GITHUB_ENV | ||
echo "release version: $RELEASE_VERSION" | ||
- 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 | ||
- name: Upload release archive | ||
uses: actions/[email protected] | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
uses: softprops/action-gh-release@v2 | ||
with: | ||
upload_url: ${{ env.RELEASE_UPLOAD_URL }} | ||
asset_path: ${{ env.ASSET }} | ||
asset_name: ${{ env.ASSET }} | ||
asset_content_type: application/octet-stream | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
files: ${{ env.ASSET }} | ||
tag_name: ${{ env.RELEASE_VERSION }} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
/target | ||
*.txt | ||
*.txt | ||
*.bin |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,4 +17,4 @@ futures = "0.3.30" | |
bytes = "1.6.0" | ||
|
||
[features] | ||
debug=[] | ||
debug=[] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,3 +14,4 @@ prost = "0.12.6" | |
|
||
[build-dependencies] | ||
tonic-build = "0.11.0" | ||
which = "6.0.1" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters