-
Notifications
You must be signed in to change notification settings - Fork 4
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
7 changed files
with
145 additions
and
149 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,6 +10,8 @@ on: | |
push: | ||
branches: | ||
- main | ||
tags: | ||
- 'v*' | ||
pull_request: | ||
branches: | ||
- main | ||
|
@@ -66,9 +68,9 @@ jobs: | |
- build: ubuntu-22.04 | ||
os: ubuntu-22.04 | ||
buildflags: --features=negotiate --//:version=${{ needs.version.outputs.version }} | ||
- build: windows | ||
os: windows-latest | ||
buildflags: --features=negotiate --//:version=${{ needs.version.outputs.version }} | ||
# - build: windows | ||
# os: windows-latest | ||
# buildflags: --features=negotiate --//:version=${{ needs.version.outputs.version }} | ||
|
||
steps: | ||
- name: Git checkout with LF | ||
|
@@ -85,25 +87,33 @@ jobs: | |
path: | | ||
~/.cache/bazel_build_cache | ||
~/.cache/bazel_repo_cache | ||
key: ${{ runner.os }}-bazel-test-${{ hashFiles('Cargo.Bazel.lock', 'WORKSPACE') }} | ||
key: ${{ matrix.build }}-bazel-test-${{ hashFiles('Cargo.Bazel.lock', 'WORKSPACE') }} | ||
restore-keys: | | ||
${{ runner.os }}-bazel-test- | ||
${{ matrix.build }}-bazel-test- | ||
- name: Setup Windows Bazelrc | ||
# https://bazel.build/configure/windows | ||
run: | | ||
echo "startup --output_user_root=C:/tmp" > ${{ github.workspace }}/user.bazelrc | ||
shell: cmd | ||
if: startswith(matrix.os, 'windows') | ||
- name: Install Linux dependency | ||
run: sudo apt-get install libkrb5-dev | ||
if: startswith(matrix.os, 'ubuntu') | ||
if: ${{ startswith(matrix.os, 'ubuntu') }} | ||
- name: Run tests | ||
run: 'bazel test --config=ci ${{ matrix.buildflags }} "//..."' | ||
shell: cmd | ||
if: ${{ startswith(matrix.os, 'windows') }} | ||
- name: Run tests | ||
run: 'bazel test --config=ci ${{ matrix.buildflags }} "//..."' | ||
if: ${{ ! startswith(matrix.os, 'windows') }} | ||
|
||
bazel_build: | ||
name: Bazel build and test | ||
name: Bazel build release package | ||
runs-on: ${{ matrix.os }} | ||
|
||
needs: version | ||
needs: | ||
- bazel_test | ||
- version | ||
|
||
strategy: | ||
matrix: | ||
|
@@ -130,10 +140,10 @@ jobs: | |
os: ubuntu-22.04 | ||
buildflags: --features=negotiate --//:version=${{ needs.version.outputs.version }} | ||
pkgfile: proxydetox-${{ needs.version.outputs.version }}-jammy_amd64.deb | ||
- build: windows | ||
os: windows-latest | ||
buildflags: --features=negotiate --//:version=${{ needs.version.outputs.version }} | ||
pkgfile: proxydetox-${{ needs.version.outputs.version }}-windows-x86_64.zip | ||
# - build: windows | ||
# os: windows-latest | ||
# buildflags: --features=negotiate --//:version=${{ needs.version.outputs.version }} | ||
# pkgfile: proxydetox-${{ needs.version.outputs.version }}-windows-x86_64.zip | ||
|
||
steps: | ||
- name: Git checkout with LF | ||
|
@@ -150,9 +160,9 @@ jobs: | |
path: | | ||
~/.cache/bazel_build_cache | ||
~/.cache/bazel_repo_cache | ||
key: ${{ runner.os }}-bazel-test-${{ hashFiles('Cargo.Bazel.lock', 'WORKSPACE') }} | ||
key: ${{ matrix.build }}-bazel-test-${{ hashFiles('Cargo.Bazel.lock', 'WORKSPACE') }} | ||
restore-keys: | | ||
${{ runner.os }}-bazel-test- | ||
${{ matrix.build }}-bazel-test- | ||
- name: Setup Windows Bazelrc | ||
# https://bazel.build/configure/windows | ||
run: | | ||
|
@@ -163,19 +173,84 @@ jobs: | |
run: sudo apt-get install libkrb5-dev | ||
if: startswith(matrix.os, 'ubuntu') | ||
- name: Build package | ||
run: bazel build -c opt --config=ci ${{ matrix.buildflags }} //pkg | ||
- name: Query package file | ||
id: querypkg | ||
run: | | ||
set -o pipefail | ||
BAZEL_OUT=$(bazel info --config=ci output_path) | ||
PKGFILE=$(bazel cquery --config=ci ${{ matrix.buildflags }} --output=files //pkg) | ||
printf 'pkgfile=%s/%s\n' "${BAZEL_OUT}" "${PKGFILE#bazel-out/}" | tee -a "${GITHUB_OUTPUT}" | ||
run: bazel build -c opt --config=ci ${{ matrix.buildflags }} "//pkg" | ||
- name: Copy package | ||
run: bazel run -c opt --config=ci ${{ matrix.buildflags }} "//pkg:copy" -- ${{ matrix.pkgfile }} | ||
- name: Upload package artifact | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: ${{ matrix.pkgfile }} | ||
path: ./${{ steps.querypkg.outputs.pkgfile }} | ||
name: pkg | ||
path: ./${{ matrix.pkgfile }} | ||
|
||
cargo_build_and_test: | ||
name: Cargo build and test | ||
runs-on: ${{ matrix.os }} | ||
|
||
strategy: | ||
matrix: | ||
build: | ||
- windows | ||
include: | ||
- build: windows | ||
os: windows-latest | ||
mkcmd: ./tools/mkzip.ps1 | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 1 | ||
- name: Install Rust | ||
uses: actions-rs/toolchain@v1 | ||
with: | ||
toolchain: stable | ||
profile: minimal | ||
override: true | ||
- uses: Swatinem/rust-cache@v2 | ||
with: | ||
key: ${{ matrix.os }} | ||
# see https://github.com/rust-lang/rust-bindgen/issues/1797 | ||
- name: Install Windows dependency (LLVM) | ||
uses: KyleMayes/[email protected] | ||
if: startswith(matrix.os, 'windows') | ||
with: | ||
version: "11.0" | ||
directory: ${{ runner.temp }}/llvm | ||
- name: Set LIBCLANG_PATH | ||
run: echo "LIBCLANG_PATH=$((gcm clang).source -replace "clang.exe")" >> $env:GITHUB_ENV | ||
shell: pwsh | ||
if: startswith(matrix.os, 'windows') | ||
- name: Run cargo test | ||
run: cargo test | ||
- name: Build Release Package | ||
id: buildpkg | ||
run: ${{ matrix.mkcmd }} | ||
shell: pwsh | ||
- name: Upload package artifact | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: pkg | ||
path: ./${{ steps.buildpkg.outputs.pkgfile }} | ||
|
||
mkrelease: | ||
name: Create Release | ||
runs-on: ubuntu-latest | ||
needs: | ||
- bazel_build | ||
- cargo_build_and_test | ||
if: github.event_name == 'push' && startswith(github.ref, 'refs/tags/') | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
- name: Download pkg artifact | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: pkg | ||
- name: Create Release | ||
run: | | ||
gh release create v${{ github.event.inputs.version }} --generate-notes *.deb *.pkg *.zip | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
format_check: | ||
name: Rust lint | ||
|
This file was deleted.
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
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 |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#!/usr/bin/env bash | ||
|
||
# --- begin runfiles.bash initialization v3 --- | ||
# Copy-pasted from the Bazel Bash runfiles library v3. | ||
set -uo pipefail; set +e; f=bazel_tools/tools/bash/runfiles/runfiles.bash | ||
source "${RUNFILES_DIR:-/dev/null}/$f" 2>/dev/null || \ | ||
source "$(grep -sm1 "^$f " "${RUNFILES_MANIFEST_FILE:-/dev/null}" | cut -f2- -d' ')" 2>/dev/null || \ | ||
source "$0.runfiles/$f" 2>/dev/null || \ | ||
source "$(grep -sm1 "^$f " "$0.runfiles_manifest" | cut -f2- -d' ')" 2>/dev/null || \ | ||
source "$(grep -sm1 "^$f " "$0.exe.runfiles_manifest" | cut -f2- -d' ')" 2>/dev/null || \ | ||
{ echo>&2 "ERROR: cannot find $f"; exit 1; }; f=; set -e | ||
# --- end runfiles.bash initialization v3 --- | ||
|
||
set -euo pipefail | ||
|
||
# When not arguemnt is given, copy to the workspace root directory. | ||
dst=${1:-${BUILD_WORKSPACE_DIRECTORY}} | ||
|
||
# Take care of relative path, since this scripts working directoy is | ||
# not the one where `bazel run ...` was called. | ||
case "${dst}" in | ||
/*) ;; | ||
*) dst=${BUILD_WORKING_DIRECTORY}/${dst} | ||
esac | ||
|
||
install -v "$(rlocation proxydetox/$PKG)" "${dst}" |
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
Oops, something went wrong.