-
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
36 changed files
with
1,469 additions
and
251 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 |
---|---|---|
|
@@ -8,58 +8,98 @@ on: | |
pull_request: | ||
branches: [ main ] | ||
|
||
# defaults: | ||
# run: | ||
# shell: bash | ||
|
||
env: | ||
# https://github.com/bazelbuild/bazel/issues/3001 | ||
# MSYS2_ARG_CONV_EXCL: "*" | ||
# MSYS_NO_PATHCONV: 1 | ||
RUSTFLAGS: -Dwarnings | ||
|
||
jobs: | ||
build_and_test: | ||
name: Build and test | ||
|
||
version: | ||
name: Current proxydetox version | ||
runs-on: ubuntu-latest | ||
outputs: | ||
version: ${{ steps.version.outputs.version }} | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 1 | ||
- name: Run version | ||
id: version | ||
run: | | ||
bazel build --config=ci //:version | ||
printf 'version=%s-%s\n' "$(cat bazel-bin/version.txt)" "$(git rev-parse --short=10 HEAD)" >> "${GITHUB_OUTPUT}" | ||
bazel_build_and_test: | ||
name: Bazel build and test | ||
runs-on: ${{ matrix.os }} | ||
|
||
needs: version | ||
|
||
strategy: | ||
matrix: | ||
build: | ||
- macos-aarch64 | ||
- macos-x86_64 | ||
- ubuntu-20.04 | ||
- ubuntu-22.04 | ||
- windows | ||
# - windows | ||
include: | ||
- build: ubuntu-20.04 | ||
os: ubuntu-20.04 | ||
mkcmd: ./tools/mkdeb.sh -d focal | ||
- build: ubuntu-22.04 | ||
os: ubuntu-22.04 | ||
mkcmd: ./tools/mkdeb.sh -d jammy | ||
- build: macos-aarch64 | ||
os: macos-latest | ||
mkcmd: ./tools/mkpkg.sh -a aarch64 -t aarch64-apple-darwin | ||
buildflags: --features=negotiate --config=aarch64_apple_darwin | ||
dotest: false | ||
pkgfile: proxydetox-${{ needs.version.outputs.version }}-aarch64-apple-darwin.pkg | ||
- build: macos-x86_64 | ||
os: macos-latest | ||
mkcmd: ./tools/mkpkg.sh | ||
- build: windows | ||
os: windows-latest | ||
mkcmd: ./tools/mkzip.ps1 | ||
buildflags: --features=negotiate --config=x86_64_apple_darwin | ||
dotest: true | ||
pkgfile: proxydetox-${{ needs.version.outputs.version }}-x86_64-apple-darwin.pkg | ||
- build: ubuntu-20.04 | ||
os: ubuntu-20.04 | ||
buildflags: --features=negotiate | ||
dotest: true | ||
pkgfile: proxydetox-${{ needs.version.outputs.version }}-x86_64-focal.deb | ||
- build: ubuntu-22.04 | ||
os: ubuntu-22.04 | ||
buildflags: --features=negotiate | ||
dotest: true | ||
pkgfile: proxydetox-${{ needs.version.outputs.version }}-x86_64-jammy.deb | ||
# - build: windows | ||
# os: windows-latest | ||
# buildflags: --features=negotiate | ||
# dotest: true | ||
# pkgfile: proxydetox-${{ needs.version.outputs.version }}-x86_64-linux.zip | ||
|
||
steps: | ||
- name: Git checkout with LF | ||
run: | | ||
git config --global core.autocrlf false | ||
git config --global core.eol lf | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 1 | ||
- name: Install Rust | ||
uses: actions-rs/toolchain@v1 | ||
with: | ||
toolchain: stable | ||
profile: minimal | ||
override: true | ||
- name: Install Rust (macos-aarach64) | ||
if: ${{ matrix.build == 'macos-aarch64' }} | ||
uses: actions-rs/toolchain@v1 | ||
- name: Bazel cache | ||
uses: actions/cache@v3 | ||
with: | ||
toolchain: stable | ||
target: aarch64-apple-darwin | ||
profile: minimal | ||
- uses: Swatinem/rust-cache@v2 | ||
path: | | ||
~/.cache/bazel_build_cache | ||
~/.cache/bazel_repo_cache | ||
key: ${{ runner.os }}-bazel-${{ hashFiles('Cargo.Bazel.lock', 'WORKSPACE') }} | ||
restore-keys: | | ||
${{ runner.os }}-bazel- | ||
- name: Setup Windows Bazelrc | ||
# https://bazel.build/configure/windows | ||
run: | | ||
echo "startup --output_user_root=C:/tmp" > ${{ github.workspace }}/user.bazelrc | ||
if: startswith(matrix.os, 'windows') | ||
- name: Install Linux dependency | ||
run: sudo apt-get install libkrb5-dev | ||
if: startswith(matrix.os, 'ubuntu') | ||
|
@@ -73,44 +113,69 @@ jobs: | |
- name: Set LIBCLANG_PATH | ||
run: echo "LIBCLANG_PATH=$((gcm clang).source -replace "clang.exe")" >> $env:GITHUB_ENV | ||
if: startswith(matrix.os, 'windows') | ||
- name: Run cargo test | ||
run: cargo test | ||
- name: Build Release Package | ||
id: buildpkg | ||
run: ${{ matrix.mkcmd }} | ||
- name: Run tests | ||
run: 'bazel test --config=ci ${{ matrix.buildflags }} "//..."' | ||
if: ${{ matrix.dotest }} | ||
- name: Build package | ||
run: bazel build -c opt --config=ci ${{ matrix.buildflags }} //pkg | ||
- name: Query package file | ||
id: querypkg | ||
run: | | ||
BAZEL_OUT=$(bazel info --config=ci output_path) | ||
PKGFILE=$(bazel cquery --config=ci ${{ matrix.buildflags }} --output=files //pkg) | ||
printf 'bazel_output_path=%s\n' "${BAZEL_OUT}" | tee -a "${GITHUB_OUTPUT}" | ||
printf 'pkgfile=%s/%s\n' "${BAZEL_OUT}" "${PKGFILE#bazel-out/}" | tee -a "${GITHUB_OUTPUT}" | ||
- name: Upload package artifact | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: ${{ steps.buildpkg.outputs.pkgfile }} | ||
path: ./${{ steps.buildpkg.outputs.pkgfile }} | ||
name: ${{ matrix.pkgfile }} | ||
path: ./${{ steps.querypkg.outputs.pkgfile }} | ||
|
||
bazel_build: | ||
name: Bazel build | ||
cargo_build_and_test: | ||
name: Cargo build and test | ||
runs-on: ${{ matrix.os }} | ||
|
||
strategy: | ||
matrix: | ||
build: [macos] | ||
build: | ||
- windows | ||
include: | ||
- build: macos | ||
os: macos-latest | ||
- build: windows | ||
os: windows-latest | ||
mkcmd: ./tools/mkzip.ps1 | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 1 | ||
- name: Bazel cache | ||
uses: actions/cache@v3 | ||
- name: Install Rust | ||
uses: actions-rs/toolchain@v1 | ||
with: | ||
path: | | ||
~/.cache/bazel_build_cache | ||
~/.cache/bazel_repo_cache | ||
key: ${{ runner.os }}-bazel-${{ hashFiles('Cargo.Bazel.lock', 'WORKSPACE') }} | ||
restore-keys: | | ||
${{ runner.os }}-bazel- | ||
- name: Bazel build | ||
run: bazel build --disk_cache=~/.cache/bazel_build_cache --repository_cache=~/.cache/bazel_repo_cache //macos/app:ProxydetoxApp | ||
toolchain: stable | ||
profile: minimal | ||
override: true | ||
- uses: Swatinem/rust-cache@v2 | ||
# 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 | ||
if: startswith(matrix.os, 'windows') | ||
- name: Run cargo test | ||
run: cargo test | ||
- name: Build Release Package | ||
id: buildpkg | ||
run: ${{ matrix.mkcmd }} | ||
- name: Upload package artifact | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: ${{ steps.buildpkg.outputs.pkgfile }} | ||
path: ./${{ steps.buildpkg.outputs.pkgfile }} | ||
|
||
format_check: | ||
name: Rust lint | ||
|
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.