Skip to content

Commit

Permalink
Workflow use prebuilt vcpkg packages (#82)
Browse files Browse the repository at this point in the history
* edit: workflow use prebuilt vcpkg packages

* fix: VCPKG_EXE env

* fix: token permissions

* fix: export VCPKG_EXE from script

* fix: call vcpkg and nuget from env

* edit: do not store VCPKG_EXE as ENV

* fix: env syntax

* fix: syntax error when getting NUGET_EXE

* edit: nuget options

* eidt: enable package write

* edit: install openblas with feature threads

* edit: use only binary caching

* edit: separate setup nuget and package resotre

* edit: remove cache hit condition

* edit: specific openmp threads in CI

* edit: specific vcpkg version

To fix prebuilt cache and use openblas 0.3.25
  • Loading branch information
HPDell authored Feb 14, 2024
1 parent 3a7354f commit f706ca3
Showing 1 changed file with 28 additions and 40 deletions.
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

0 comments on commit f706ca3

Please sign in to comment.