Skip to content

Commit

Permalink
resolve #1467: build sswinservice for Windows by default
Browse files Browse the repository at this point in the history
  • Loading branch information
amorphobia committed Mar 21, 2024
1 parent 8b2ff61 commit 7e57314
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,6 @@ jobs:
run: cargo build --verbose --features "local-http-rustls local-redir local-dns local-tun dns-over-tls dns-over-https stream-cipher aead-cipher-extra aead-cipher-2022 aead-cipher-2022-extra security-replay-attack-detect"
- name: Build with All Features Enabled (Windows)
if: ${{ runner.os == 'Windows' }}
run: cargo build --verbose --features "local-http-rustls local-dns dns-over-tls dns-over-https stream-cipher aead-cipher-extra aead-cipher-2022 aead-cipher-2022-extra security-replay-attack-detect"
run: cargo build --verbose --features "local-http-rustls local-dns dns-over-tls dns-over-https stream-cipher aead-cipher-extra aead-cipher-2022 aead-cipher-2022-extra security-replay-attack-detect winservice"
- name: Build with All Features Enabled - shadowsocks
run: cargo build --manifest-path ./crates/shadowsocks/Cargo.toml --verbose --features "stream-cipher aead-cipher-2022"
2 changes: 1 addition & 1 deletion .github/workflows/build-msrv.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,4 @@ jobs:
run: cargo build --verbose --features "local-http-rustls local-redir local-dns local-tun dns-over-tls dns-over-https stream-cipher aead-cipher-extra aead-cipher-2022 aead-cipher-2022-extra security-replay-attack-detect"
- name: Build with All Features Enabled (Windows)
if: ${{ runner.os == 'Windows' }}
run: cargo build --verbose --features "local-http-rustls local-dns dns-over-tls dns-over-https stream-cipher aead-cipher-extra aead-cipher-2022 aead-cipher-2022-extra security-replay-attack-detect"
run: cargo build --verbose --features "local-http-rustls local-dns dns-over-tls dns-over-https stream-cipher aead-cipher-extra aead-cipher-2022 aead-cipher-2022-extra security-replay-attack-detect winservice"
2 changes: 1 addition & 1 deletion .github/workflows/build-nightly-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ jobs:
- name: Build release
run: |
pwsh ./build/build-host-release.ps1
pwsh ./build/build-host-release.ps1 winservice
- name: Upload Artifacts
uses: actions/upload-artifact@v4
Expand Down
6 changes: 5 additions & 1 deletion .github/workflows/build-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,10 @@ jobs:
compile_features="-f local-redir -f local-tun"
fi
if [[ "$compile_target" == *"-windows-"* ]]; then
compile_features="-f winservice"
fi
if [[ "$compile_target" == "mips-"* || "$compile_target" == "mipsel-"* || "$compile_target" == "mips64-"* || "$compile_target" == "mips64el-"* ]]; then
sudo apt-get update -y && sudo apt-get install -y upx;
if [[ "$?" == "0" ]]; then
Expand Down Expand Up @@ -139,7 +143,7 @@ jobs:
- name: Build release
run: |
pwsh ./build/build-host-release.ps1
pwsh ./build/build-host-release.ps1 winservice
- name: Upload Github Assets
uses: softprops/action-gh-release@v1
Expand Down
4 changes: 4 additions & 0 deletions build/build-host-release
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,10 @@ fi

TARGETS=("sslocal${TARGET_SUFFIX}" "ssserver${TARGET_SUFFIX}" "ssurl${TARGET_SUFFIX}" "ssmanager${TARGET_SUFFIX}" "ssservice${TARGET_SUFFIX}")

if [[ "${BUILD_FEATURES}" == *"winservice"* ]]; then
TARGETS+=("sswinservice${TARGET_SUFFIX}")
fi

RELEASE_FOLDER="${ROOT_DIR}/release"
RELEASE_PACKAGE_NAME="shadowsocks-v${VERSION}.${BUILD_TARGET}"

Expand Down
3 changes: 3 additions & 0 deletions build/build-host-release.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ $CompressParam = @{
LiteralPath = "sslocal.exe", "ssserver.exe", "ssurl.exe", "ssmanager.exe", "ssservice.exe"
DestinationPath = "${PackagePath}"
}
if (${Features} -contains "winservice") {
$CompressParam.LiteralPath += "sswinservice.exe"
}
Compress-Archive @CompressParam

Write-Host "Created release packet ${PackagePath}"
Expand Down

0 comments on commit 7e57314

Please sign in to comment.