Files
leonwww/.github/workflows/build-gurtca.yml
2025-09-28 19:06:22 +03:00

125 lines
3.8 KiB
YAML

name: Build GurtCA
on:
push:
paths:
- 'protocol/gurtca/**'
- 'protocol/library/**'
- '.github/workflows/build-gurtca.yml'
pull_request:
paths:
- 'protocol/gurtca/**'
- 'protocol/library/**'
- '.github/workflows/build-gurtca.yml'
workflow_dispatch:
env:
CARGO_TERM_COLOR: always
jobs:
build-gurtca:
name: Build GurtCA
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
platform: linux
ext: ""
- os: windows-latest
target: x86_64-pc-windows-msvc
platform: windows
ext: ".exe"
steps:
- uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- name: Cache cargo dependencies
uses: actions/cache@v4
with:
path: |
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
protocol/target/
key: ${{ runner.os }}-gurtca-${{ hashFiles('protocol/gurtca/Cargo.lock', 'protocol/library/Cargo.toml') }}
restore-keys: |
${{ runner.os }}-gurtca-
${{ runner.os }}-cargo-
- name: Install OpenSSL (Ubuntu)
if: matrix.os == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install -y pkg-config libssl-dev
- name: Cache vcpkg and OpenSSL (Windows)
if: matrix.os == 'windows-latest'
uses: actions/cache@v4
with:
path: |
C:\vcpkg
C:\vcpkg\installed\x64-windows-static-md
key: ${{ runner.os }}-vcpkg-openssl-${{ hashFiles('.github/workflows/build-gurtca.yml') }}
restore-keys: |
${{ runner.os }}-vcpkg-openssl-
${{ runner.os }}-vcpkg-
- name: Install OpenSSL (Windows)
if: matrix.os == 'windows-latest'
run: |
if (!(Test-Path "C:\vcpkg")) {
Write-Host "Installing vcpkg..."
git clone https://github.com/Microsoft/vcpkg.git C:\vcpkg
cd C:\vcpkg
.\bootstrap-vcpkg.bat
.\vcpkg.exe integrate install
}
# Check if OpenSSL is properly installed
$opensslInstalled = (Test-Path "C:\vcpkg\installed\x64-windows-static-md\lib\libssl.lib") -and
(Test-Path "C:\vcpkg\installed\x64-windows-static-md\lib\libcrypto.lib") -and
(Test-Path "C:\vcpkg\installed\x64-windows-static-md\include\openssl\opensslv.h")
if ($opensslInstalled) {
Write-Host "OpenSSL already installed, skipping..."
} else {
Write-Host "Installing OpenSSL..."
cd C:\vcpkg
.\vcpkg.exe install openssl:x64-windows-static-md
}
shell: pwsh
- name: Set OpenSSL environment variables (Windows)
if: matrix.os == 'windows-latest'
shell: pwsh
run: |
echo "VCPKG_ROOT=C:\vcpkg" >> $env:GITHUB_ENV
echo "OPENSSL_DIR=C:\vcpkg\installed\x64-windows-static-md" >> $env:GITHUB_ENV
- name: Build GurtCA
run: |
cd protocol/gurtca
cargo build --release --target ${{ matrix.target }}
- name: Prepare artifacts
shell: bash
run: |
mkdir -p artifacts/${{ matrix.platform }}
cp protocol/gurtca/target/${{ matrix.target }}/release/gurtca${{ matrix.ext }} artifacts/${{ matrix.platform }}/
- name: Upload GurtCA artifacts
uses: actions/upload-artifact@v4
with:
name: gurtca-${{ matrix.platform }}
path: artifacts/${{ matrix.platform }}
retention-days: 30