Expand interface modified van mises distance #26
This file contains hidden or 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 and Deploy | |
| on: | |
| push: | |
| branches: | |
| - "main" | |
| tags: | |
| - "v*" | |
| pull_request: | |
| branches: | |
| - main | |
| env: | |
| BUILD_DIR: build | |
| ARTIFACT_DIR: artifacts | |
| jobs: | |
| build-windows: | |
| runs-on: windows-latest | |
| env: | |
| CC: C:/ProgramData/mingw64/mingw64/bin/gcc.exe | |
| CXX: C:/ProgramData/mingw64/mingw64/bin/g++.exe | |
| steps: | |
| # checkout code | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| # install MinGW via Chocolatey | |
| - name: Install MinGW | |
| run: choco install mingw -y --no-progress | |
| # add MinGW to PATH | |
| - name: Add MinGW to PATH | |
| run: echo "C:\ProgramData\mingw64\mingw64\bin" >> $GITHUB_PATH | |
| # cache vcpkg packages | |
| - name: Cache vcpkg | |
| id: cache-vcpkg | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| vcpkg/installed | |
| vcpkg/packages | |
| key: vcpkg-${{ runner.os }}-cache | |
| restore-keys: | | |
| vcpkg-${{ runner.os }}- | |
| # install vcpkg for dependencies | |
| - name: Install dependencies | |
| if: steps.cache-vcpkg.outputs.cache-hit != 'true' | |
| run: | | |
| if (-not (Test-Path vcpkg)) { | |
| git clone https://github.com/microsoft/vcpkg.git | |
| .\vcpkg\bootstrap-vcpkg.bat | |
| } | |
| .\vcpkg\vcpkg install gsl:x64-mingw-static gsl:x64-mingw-dynamic gtest:x64-mingw-static benchmark:x64-mingw-static | |
| # configure CMake and build | |
| - name: configure and build application | |
| shell: pwsh | |
| run: | | |
| # create the build directory | |
| if (-not (Test-Path $env:BUILD_DIR)) { | |
| New-Item -ItemType Directory -Path $env:BUILD_DIR | |
| } | |
| # change to build directory | |
| Set-Location $env:BUILD_DIR | |
| # get libgomp path | |
| $GOMP_LIB = & "$env:CC" -print-file-name=libgomp.a | |
| # CMake Configuration | |
| cmake .. -G "MinGW Makefiles" ` | |
| -DCMAKE_BUILD_TYPE=Release ` | |
| -DCMAKE_PREFIX_PATH="../vcpkg/installed/x64-mingw-static;../vcpkg/installed/x64-mingw-dynamic" ` | |
| -DOpenMP_C_FLAGS="-fopenmp" ` | |
| -DOpenMP_C_LIB_NAMES="gomp" ` | |
| -DOpenMP_CXX_FLAGS="-fopenmp" ` | |
| -DOpenMP_CXX_LIB_NAMES="gomp" ` | |
| -DOpenMP_gomp_LIBRARY="$GOMP_LIB" ` | |
| -DCMAKE_INSTALL_PREFIX=install | |
| # build | |
| cmake --build . --target install -j $env:NUMBER_OF_PROCESSORS | |
| # run tests | |
| - name: run Tests | |
| shell: pwsh | |
| run: | | |
| & "$env:BUILD_DIR/lib/unit.exe" | |
| # prepare and upload artifacts | |
| - name: prepare artifact folder | |
| shell: pwsh | |
| run: | | |
| # create artifact folder | |
| New-Item -ItemType Directory -Force -Path $env:ARTIFACT_DIR | |
| New-Item -ItemType Directory -Force -Path "$env:ARTIFACT_DIR/windows" | |
| # copy installed artifacts | |
| Copy-Item -Recurse -Force "$env:BUILD_DIR/install/*" "$env:ARTIFACT_DIR/windows" | |
| # copy executables | |
| Copy-Item -Force "$env:BUILD_DIR/lib/unit.exe" "$env:ARTIFACT_DIR/windows" | |
| Copy-Item -Force "$env:BUILD_DIR/lib/benchmark.exe" "$env:ARTIFACT_DIR/windows" | |
| Copy-Item -Force "$env:BUILD_DIR/src/main.exe" "$env:ARTIFACT_DIR/windows" | |
| - name: upload artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: windows | |
| path: ${{ env.ARTIFACT_DIR }}/windows | |
| build-linux: | |
| runs-on: ubuntu-22.04 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: build Docker image | |
| run: docker build -f Dockerfile.linux -t libapproxlcd-builder . | |
| - name: run Docker container | |
| run: | | |
| mkdir -p ${{ env.ARTIFACT_DIR }} | |
| docker run --rm -e BUILD_DIR="/work/${{ env.BUILD_DIR }}" -e ARTIFACT_DIR="/work/${{ env.ARTIFACT_DIR }}" -v "$PWD:/work" libapproxlcd-builder | |
| - name: upload artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: linux | |
| path: ${{ env.ARTIFACT_DIR }}/linux | |
| release: | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| runs-on: ubuntu-latest | |
| needs: [build-windows, build-linux] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: download Linux artifact | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: linux | |
| path: release/linux | |
| - name: download Windows artifact | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: windows | |
| path: release/windows | |
| - name: create Linux ZIP | |
| run: | | |
| cd release/linux | |
| zip -r ../linux.zip . | |
| - name: create Windows ZIP | |
| run: | | |
| cd release/windows | |
| zip -r ../windows.zip . | |
| - name: create GitHub Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| tag_name: ${{ github.ref_name }} | |
| name: Release ${{ github.ref_name }} | |
| files: | | |
| release/linux.zip | |
| release/windows.zip | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |