Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Workflow use prebuilt vcpkg packages #82

Merged
merged 16 commits into from
Feb 14, 2024
68 changes: 28 additions & 40 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ on:
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

env:
OMP_NUM_THREADS: 2

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
Expand All @@ -32,56 +35,41 @@ jobs:
with:
entrypoint: /bin/bash
args: -c "cmake -B build -S . -DCMAKE_BUILD_TYPE:STRING=Debug -DENABLE_OpenMP=${{ matrix.openmp }} && cmake --build build --config Debug && ctest --test-dir build --output-on-failure"

windows-prepare:
runs-on: windows-latest
steps:
- name: Cache Dependencies
id: cache-dep
uses: actions/cache@v3
with:
path: |
C:/vcpkg
C:/vcpkg/build/vcpkg_installed
!C:/vcpkg/.git
!C:/vcpkg/buildtrees
!C:/vcpkg/packages
!C:/vcpkg/downloads
key: |
${{ runner.os }}-cache-key-v1
- name: Install Vcpkg Dependencies
if: steps.cache-dep.outputs.cache-hit != 'true'
run: |
git pull --rebase
./bootstrap-vcpkg.bat
./vcpkg.exe update
./vcpkg.exe install gsl:x64-windows openblas[threads]:x64-windows armadillo:x64-windows catch2:x64-windows
working-directory: C:/vcpkg

windows-test:
runs-on: windows-latest
needs: [windows-prepare]
strategy:
matrix:
openmp: [TRUE, FALSE]
env:
USERNAME: GWmodel-Lab
FEED_URL: https://nuget.pkg.github.com/GWmodel-Lab/index.json
VCPKG_BINARY_SOURCES: "clear;nuget,github,readwrite"
VCPKG_USE_NUGET_CACHE: 1
permissions:
contents: read
packages: write
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Cache Dependencies
id: cache-dep
uses: actions/cache/restore@v3
with:
path: |
C:/vcpkg
C:/vcpkg/build/vcpkg_installed
!C:/vcpkg/.git
!C:/vcpkg/buildtrees
!C:/vcpkg/packages
!C:/vcpkg/downloads
key: |
${{ runner.os }}-cache-key-v1
- name: Scrollback Vcpkg
shell: pwsh
run: |
cd "$env:VCPKG_INSTALLATION_ROOT"
git switch 2023.12.12 --detach
- name: Setup NuGet Credentials
shell: pwsh
run: |
$VCPKG_EXE="$env:VCPKG_INSTALLATION_ROOT/vcpkg.exe"
$NUGET_EXE="$(.$VCPKG_EXE fetch nuget)"
.$NUGET_EXE sources add -Source ${{ env.FEED_URL }} -Name github -UserName ${{ env.USERNAME }} -Password ${{ secrets.GITHUB_TOKEN }} -StorePasswordInClearText
.$NUGET_EXE setapikey ${{ secrets.GITHUB_TOKEN }} -Source "${{ env.FEED_URL }}"
- name: Vcpkg Package Restore
shell: pwsh
run: |
$VCPKG_EXE="$env:VCPKG_INSTALLATION_ROOT/vcpkg.exe"
.$VCPKG_EXE install armadillo gsl catch2 openblas[threads] --triplet x64-windows
- name: CMake build and test
if: steps.cache-dep.outputs.cache-hit == 'true'
run: |
mkdir build
cmake -B build -S . "-DCMAKE_TOOLCHAIN_FILE=$env:VCPKG_INSTALLATION_ROOT\scripts\buildsystems\vcpkg.cmake" -DCMAKE_BUILD_TYPE=Debug -DENABLE_OpenMP=${{ matrix.openmp }}
Expand Down
Loading