Skip to content
This repository was archived by the owner on Jan 25, 2025. It is now read-only.

Commit 533c9b2

Browse files
authored
Added statically linked binaries (#51)
1 parent b0a6eea commit 533c9b2

File tree

5 files changed

+29
-17
lines changed

5 files changed

+29
-17
lines changed

.github/workflows/ci.yaml

Lines changed: 24 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ jobs:
2020
- x86_64-unknown-linux-gnu
2121
- aarch64-unknown-linux-gnu
2222
- armv7-unknown-linux-gnueabihf
23+
linker: [ static, dynamic ]
2324

2425
steps:
2526
- uses: actions/checkout@v3
@@ -40,7 +41,8 @@ jobs:
4041

4142
- run: cargo install --force cross --git https://github.com/cross-rs/cross
4243
- run: cargo install --force cargo-deb
43-
# - run: cargo install --force cargo-generate-rpm
44+
if: matrix.linker == 'dynamic'
45+
# - run: cargo install --force cargo-generate-rpm
4446

4547
- name: Find Version
4648
if: startsWith(github.ref, 'refs/tags/')
@@ -59,43 +61,53 @@ jobs:
5961
6062
sed -i'' "s/0\\.0\\.0-git/${{ steps.meta.outputs.version }}/" Cargo.lock
6163
64+
- name: Configure for static
65+
run: |
66+
if [[ '${{ matrix.linker }}' == 'static' ]]; then
67+
echo 'RUSTFLAGS=-C target-feature=+crt-static' >> $GITHUB_ENV
68+
echo 'NAME_PREFIX=_static' >> $GITHUB_ENV
69+
fi
70+
6271
- name: Build
6372
run: cross build --release --target ${{ matrix.target }}
6473

6574
- name: Build deb
75+
if: matrix.linker == 'dynamic'
6676
run: |
6777
cargo deb --no-build --no-strip --target ${{ matrix.target }} -p zia-client
6878
cargo deb --no-build --no-strip --target ${{ matrix.target }} -p zia-server
6979
70-
# - name: Build rpm
71-
# run: |
72-
# cargo generate-rpm --target ${{ matrix.target }} -p zia-client
73-
# cargo generate-rpm --target ${{ matrix.target }} -p zia-server
80+
# - name: Build rpm
81+
# run: |
82+
# cargo generate-rpm --target ${{ matrix.target }} -p zia-client
83+
# cargo generate-rpm --target ${{ matrix.target }} -p zia-server
7484

7585
- name: Rename binary
7686
run: |
77-
mv target/${{ matrix.target }}/release/zia-client zia-client_${{ matrix.target }}
78-
mv target/${{ matrix.target }}/release/zia-server zia-server_${{ matrix.target }}
87+
mv target/${{ matrix.target }}/release/zia-client zia-client_${{ matrix.target }}${{ env.NAME_PREFIX }}
88+
mv target/${{ matrix.target }}/release/zia-server zia-server_${{ matrix.target }}${{ env.NAME_PREFIX }}
7989
8090
- name: Upload Artifact (client)
8191
uses: actions/upload-artifact@v3
8292
with:
83-
name: zia-client_${{ matrix.target }}
84-
path: zia-client_${{ matrix.target }}*
93+
name: zia-client_${{ matrix.target }}${{ env.NAME_PREFIX }}
94+
path: zia-client_${{ matrix.target }}${{ env.NAME_PREFIX }}
8595

8696
- name: Upload Artifact (server)
8797
uses: actions/upload-artifact@v3
8898
with:
89-
name: zia-server_${{ matrix.target }}
90-
path: zia-server_${{ matrix.target }}*
99+
name: zia-server_${{ matrix.target }}${{ env.NAME_PREFIX }}
100+
path: zia-server_${{ matrix.target }}${{ env.NAME_PREFIX }}
91101

92102
- name: Upload Artifact deb (client)
103+
if: matrix.linker == 'dynamic'
93104
uses: actions/upload-artifact@v3
94105
with:
95106
name: zia-client_${{ matrix.target }}.deb
96107
path: target/${{ matrix.target }}/debian/zia-client_*.deb
97108

98109
- name: Upload Artifact deb (server)
110+
if: matrix.linker == 'dynamic'
99111
uses: actions/upload-artifact@v3
100112
with:
101113
name: zia-server_${{ matrix.target }}.deb
@@ -106,7 +118,7 @@ jobs:
106118
env:
107119
GITHUB_TOKEN: ${{ github.token }}
108120
with:
109-
asset_paths: '["zia-client_${{ matrix.target }}","zia-server_${{ matrix.target }}","target/${{ matrix.target }}/debian/zia-client_${{ steps.meta.outputs.version }}_*.deb","target/${{ matrix.target }}/debian/zia-server_${{ steps.meta.outputs.version }}_*.deb"]'
121+
asset_paths: '["zia-client_${{ matrix.target }}${{ env.NAME_PREFIX }}","zia-server_${{ matrix.target }}${{ env.NAME_PREFIX }}","target/${{ matrix.target }}/debian/zia-client_${{ steps.meta.outputs.version }}_*.deb","target/${{ matrix.target }}/debian/zia-server_${{ steps.meta.outputs.version }}_*.deb"]'
110122

111123
build-native:
112124
needs: [ build ]

Cargo.lock

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

zia-client/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ license = "AGPL-3.0"
77
description = "Proxy udp over websocket, useful to use Wireguard in restricted networks."
88

99
[dependencies]
10-
tokio = { version = "1.21", default-features = false, features = ["macros", "net", "rt-multi-thread", "signal", "sync"] }
10+
tokio = { version = "1.22", default-features = false, features = ["macros", "net", "rt-multi-thread", "signal", "sync"] }
1111
serde = { version = "1.0", default-features = false, features = ["derive"] }
1212
tracing-subscriber = { version = "0.3", features = ["tracing-log"] }
1313
tokio-tungstenite = { version = "0.17", default-features = false }

zia-common/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ edition = "2021"
55

66
[dependencies]
77
async-http-proxy = { version = "1.2", features = ["runtime-tokio", "basic-auth"] }
8-
tokio = { version = "1.21", default-features = false, features = ["net", "time"] }
8+
tokio = { version = "1.22", default-features = false, features = ["net", "time"] }
99
tokio-tungstenite = { version = "0.17", default-features = false }
1010
futures-util = { version = "0.3", default-features = false }
1111
tokio-rustls = "0.23"

zia-server/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ license = "AGPL-3.0"
77
description = "Proxy udp over websocket, useful to use Wireguard in restricted networks."
88

99
[dependencies]
10-
tokio = { version = "1.21", default-features = false, features = ["macros", "rt-multi-thread", "net", "signal", "sync"] }
10+
tokio = { version = "1.22", default-features = false, features = ["macros", "rt-multi-thread", "net", "signal", "sync"] }
1111
serde = { version = "1.0", default-features = false, features = ["derive"] }
1212
tracing-subscriber = { version = "0.3", features = ["tracing-log"] }
1313
tokio-tungstenite = { version = "0.17", default-features = false }

0 commit comments

Comments
 (0)