Refactor oshd_clock #89
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
name: build | |
on: | |
push: | |
branches: [ '**' ] | |
pull_request: | |
branches: [ '**' ] | |
jobs: | |
build: | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- { os: ubuntu-latest, shell: 'bash' } | |
- { os: windows-latest, shell: 'msys2 {0}', msys_sys: mingw64, msys_env: x86_64 } | |
- { os: windows-latest, shell: 'msys2 {0}', msys_sys: mingw32, msys_env: i686 } | |
runs-on: ${{ matrix.os }} | |
defaults: | |
run: | |
shell: ${{ matrix.shell }} | |
steps: | |
- name: Install requirements (linux) | |
if: matrix.os == 'ubuntu-latest' | |
run: | | |
sudo apt-get update | |
sudo apt-get install -yq ninja-build git gcc pkg-config libssl-dev cmake libcriterion-dev python3 | |
- name: Install requirements (windows) | |
if: matrix.os == 'windows-latest' | |
uses: msys2/setup-msys2@v2 | |
with: | |
msystem: ${{ matrix.msys_sys }} | |
update: true | |
release: false | |
install: >- | |
base-devel | |
git | |
mingw-w64-${{ matrix.msys_env }}-toolchain | |
mingw-w64-${{ matrix.msys_env }}-pkgconf | |
mingw-w64-${{ matrix.msys_env }}-libwinpthread | |
mingw-w64-${{ matrix.msys_env }}-ninja | |
mingw-w64-${{ matrix.msys_env }}-cmake | |
mingw-w64-${{ matrix.msys_env }}-openssl | |
mingw-w64-${{ matrix.msys_env }}-python3 | |
mingw-w64-${{ matrix.msys_env }}-meson | |
mingw-w64-${{ matrix.msys_env }}-libffi | |
mingw-w64-${{ matrix.msys_env }}-libgit2 | |
- name: Clone main repository | |
uses: actions/checkout@v3 | |
with: | |
submodules: true | |
path: osh-vpn | |
- name: Clone mpreisler/mingw-bundledlls repository (windows) | |
if: matrix.os == 'windows-latest' | |
uses: actions/checkout@v3 | |
with: | |
repository: mpreisler/mingw-bundledlls | |
ref: master | |
path: mingw-bundledlls | |
- name: Clone Snaipe/Criterion repository (windows) | |
if: matrix.os == 'windows-latest' | |
uses: actions/checkout@v3 | |
with: | |
repository: Snaipe/Criterion | |
ref: v2.4.2 | |
submodules: recursive | |
path: Criterion | |
- name: Build and install Criterion (windows) | |
if: matrix.os == 'windows-latest' | |
run: | | |
cd "${GITHUB_WORKSPACE}/Criterion" | |
export BUILDDIR="build-${{ matrix.msys_sys }}" | |
meson --prefix=/${{ matrix.msys_sys }} "${BUILDDIR}" | |
ninja -C "${BUILDDIR}" | |
ninja -C "${BUILDDIR}" install | |
- name: Build project | |
run: | | |
cd "${GITHUB_WORKSPACE}/osh-vpn" | |
cmake -S . -B build -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_FLAGS="-Werror" -DENABLE_UNIT_TESTS=ON | |
cmake --build build | |
- name: Run unit tests | |
run: | | |
ctest --verbose --test-dir "${GITHUB_WORKSPACE}/osh-vpn/build" | |
- name: Copy linked DLLs (windows) | |
if: matrix.os == 'windows-latest' | |
continue-on-error: true | |
run: | | |
cd "${GITHUB_WORKSPACE}/osh-vpn/build" | |
export MINGW_BUNDLEDLLS_SEARCH_PATH="$PATH" | |
python3 "${GITHUB_WORKSPACE}/mingw-bundledlls/mingw-bundledlls" --copy oshd.exe | |
- name: Upload binaries (linux) | |
if: matrix.os == 'ubuntu-latest' | |
uses: actions/upload-artifact@v3 | |
with: | |
name: osh-vpn-linux | |
path: | | |
${{ github.workspace }}/osh-vpn/build/oshd | |
- name: Upload binaries (windows) | |
if: matrix.os == 'windows-latest' | |
uses: actions/upload-artifact@v3 | |
with: | |
name: osh-vpn-${{ matrix.msys_sys }} | |
path: | | |
${{ github.workspace }}/osh-vpn/build/*.exe | |
${{ github.workspace }}/osh-vpn/build/*.dll |