116 lines
3.2 KiB
YAML
116 lines
3.2 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 (Windows)
|
|
if: matrix.os == 'windows-latest'
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: C:\vcpkg
|
|
key: ${{ runner.os }}-vcpkg-openssl
|
|
restore-keys: |
|
|
${{ runner.os }}-vcpkg-
|
|
|
|
- name: Install OpenSSL (Windows)
|
|
if: matrix.os == 'windows-latest'
|
|
run: |
|
|
if (!(Test-Path "C:\vcpkg")) {
|
|
git clone https://github.com/Microsoft/vcpkg.git C:\vcpkg
|
|
cd C:\vcpkg
|
|
.\bootstrap-vcpkg.bat
|
|
.\vcpkg.exe integrate install
|
|
}
|
|
cd C:\vcpkg
|
|
$installed = .\vcpkg.exe list | Select-String "openssl:x64-windows-static-md"
|
|
if (!$installed) {
|
|
Write-Host "Installing OpenSSL..."
|
|
.\vcpkg.exe install openssl:x64-windows-static-md
|
|
} else {
|
|
Write-Host "OpenSSL already installed: $installed"
|
|
}
|
|
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
|