Skip to content

Commit 5f234ee

Browse files
committed
test-windows.yml: Make workflow much more like my other, working projects that use vcpkg
1 parent b101bc8 commit 5f234ee

1 file changed

Lines changed: 49 additions & 2 deletions

File tree

.github/workflows/test-windows.yml

Lines changed: 49 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,34 +11,81 @@ jobs:
1111
python-version: [3.7]
1212

1313
env:
14-
VCPKG_ROOT: ${{ github.workspace }}\vcpkg
14+
VCPKG_ROOT: '${{ github.workspace }}/vcpkg'
15+
VCPKG_ASSET_SOURCES: "${{ github.workspace }}/vcpkgAssets"
16+
X_VCPKG_ASSET_SOURCES: clear;x-azurl,file:///${{ github.workspace }}/vcpkgAssets,,readwrite
17+
VCPKG_BINARY_SOURCES: clear;files,${{ github.workspace }}/vcpkgBin,readwrite
18+
VCPKG_BUILD_TREES: "${{ github.workspace }}/vcpkgBuild"
19+
VCPKG_INSTALL_OPTIONS: "--x-buildtrees-root=${{ github.workspace }}/vcpkgBuild"
1520
VCPKG_DEFAULT_TRIPLET: 'x64-windows'
1621
VCPKG_DEFAULT_HOST_TRIPLET: 'x64-windows'
1722

1823
steps:
19-
- uses: actions/checkout@v5
24+
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7
25+
26+
- name: Restore vcpkg cache
27+
id: cache-vcpkg-restore
28+
uses: actions/cache/restore@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
29+
with:
30+
path: |
31+
"${{ github.workspace }}/vcpkgAssets"
32+
"${{ github.workspace }}/vcpkgBCache"
33+
"${{ github.workspace }}/vcpkgBin"
34+
"${{ github.workspace }}/vcpkgBuild"
35+
key: vcpkgCache-${{ github.repository_owner }}-${{ matrix.os }}-${{ matrix.triplet }}-${{ hashFiles('vcpkg.json') }}
36+
37+
- name: Create directories on cache miss
38+
run: |
39+
mkdir -p "${{ github.workspace }}/vcpkgAssets"
40+
mkdir -p "${{ github.workspace }}/vcpkgBCache"
41+
mkdir -p "${{ github.workspace }}/vcpkgBin"
42+
mkdir -p "${{ github.workspace }}/vcpkgBuild"
43+
if: steps.cache-vcpkg-restore.outputs.cache-hit != 'true'
44+
2045
- uses: actions/setup-python@v6
2146
with:
2247
python-version: ${{ matrix.python-version }}
48+
2349
- uses: microsoft/setup-msbuild@v2
50+
51+
- name: Install CMake
52+
uses: lukka/get-cmake@591817e96fcad43505fb4eae36172462abb3a42e # v4.3.3
53+
2454
- name: setup boost prerequisites
2555
uses: lukka/run-vcpkg@b1a0dd252f06b9e25b3c022a9a03bd7a427fb6a2 # v11.6
2656
with:
2757
vcpkgDirectory: '${{ github.workspace }}/vcpkg'
58+
binaryCachePath: "${{ github.workspace }}/vcpkgBCache"
2859
runVcpkgInstall: true
60+
2961
- name: List directory contents
3062
run: Get-ChildItem "${{ github.workspace }}\vcpkg" -Recurse -Force -File -Filter 'config.hpp'
3163
shell: pwsh
64+
3265
- name: setup faber
3366
run: |
3467
python -m pip install --upgrade pip
3568
python -m pip install setuptools faber numpy
3669
faber --info=tools cxx
70+
3771
- name: build
3872
shell: cmd
3973
run: |
4074
faber --builddir=build cxx.name=msvc --log=commands --log=output --with-boost-include="${{ github.workspace }}\vcpkg\installed\x64-windows\include" -j4
75+
4176
- name: test
4277
shell: cmd
4378
run: |
4479
faber --builddir=build cxx.name=msvc --with-boost-include="${{ github.workspace }}\vcpkg\installed\x64-windows\include" -j4 test.report
80+
81+
- name: Save vcpkg cache
82+
id: cache-vcpkg-save
83+
uses: actions/cache/save@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
84+
with:
85+
path: |
86+
"${{ github.workspace }}/vcpkgAssets"
87+
"${{ github.workspace }}/vcpkgBCache"
88+
"${{ github.workspace }}/vcpkgBin"
89+
"${{ github.workspace }}/vcpkgBuild"
90+
key: ${{ steps.cache-vcpkg-restore.outputs.cache-primary-key }}
91+
if: steps.cache-vcpkg-restore.outputs.cache-hit != 'true'

0 commit comments

Comments
 (0)