forked from alandtse/CommonLibSSE-NG
-
Notifications
You must be signed in to change notification settings - Fork 1
100 lines (88 loc) · 3.85 KB
/
Copy pathtest-consumer.yml
File metadata and controls
100 lines (88 loc) · 3.85 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
name: Consumer Integration Test
on:
push:
branches: [ ng ]
pull_request:
branches: [ ng ]
jobs:
test-as-dependency:
name: Test CommonLib as Dependency
runs-on: windows-latest
steps:
- name: Checkout
uses: actions/checkout@v5
with:
submodules: recursive
- name: Setup MSVC
uses: TheMrMilchmann/setup-msvc-dev@v4.0.0
with:
arch: x64
# Pin vcpkg's download cache to a stable, cacheable path. vcpkg checks
# this directory (by SHA512) before fetching any asset — port source
# tarballs AND tools acquired via vcpkg_find_acquire_program (e.g. the
# pinned PowerShell-core zip applocal.ps1 needs). Caching it (below)
# lets those downloads survive across runs, so a transient GitHub
# releases 504 on a cache-cold tool fetch can't fail the build.
- name: Pin vcpkg downloads directory
shell: bash
run: echo "VCPKG_DOWNLOADS=${{ github.workspace }}/vcpkg_downloads" >> "$GITHUB_ENV"
- name: Setup vcpkg
uses: lukka/run-vcpkg@v11
with:
# Only the root manifest — tests/ ship their own vcpkg.json (self-test consumers),
# and a '**/' glob would match multiple and fail baseline detection.
vcpkgJsonGlob: 'vcpkg.json'
# Bootstrap vcpkg only; do NOT install here. Manifest install runs
# later during the retry-wrapped step, so the flaky asset fetches
# happen inside the retry + with the downloads cache already restored.
runVcpkgInstall: false
# vcpkg download (asset) cache. Keyed on the manifest + baseline, NOT
# the compiler — the set of fetched assets only changes when deps or
# the baseline change, so this survives VS toolset drift.
- name: Cache vcpkg downloads (trusted, restore + save)
if: github.event_name != 'pull_request'
uses: actions/cache@v4
with:
path: ${{ github.workspace }}/vcpkg_downloads
key: ${{ runner.os }}-vcpkg-downloads-${{ hashFiles('vcpkg.json') }}
restore-keys: |
${{ runner.os }}-vcpkg-downloads-
- name: Restore vcpkg downloads (untrusted PR, restore-only)
if: github.event_name == 'pull_request'
uses: actions/cache/restore@v4
with:
path: ${{ github.workspace }}/vcpkg_downloads
key: ${{ runner.os }}-vcpkg-downloads-${{ hashFiles('vcpkg.json') }}
restore-keys: |
${{ runner.os }}-vcpkg-downloads-
# Wrap the vcpkg install in retry so a transient network error
# (e.g. GitHub-releases 504 when fetching the PowerShell-core zip)
# doesn't fail the job.
- name: Install vcpkg dependencies (retry)
uses: nick-fields/retry@v3
with:
timeout_minutes: 30
max_attempts: 3
retry_wait_seconds: 30
shell: pwsh
command: |
$env:VCPKG_ROOT = "${{ github.workspace }}/vcpkg"
& "$env:VCPKG_ROOT/vcpkg" install --triplet=x64-windows
- name: Configure Consumer Test
working-directory: test_consumer
run: |
cmake -B build -S . `
-DCMAKE_TOOLCHAIN_FILE="${{ github.workspace }}/vcpkg/scripts/buildsystems/vcpkg.cmake" `
-DVCPKG_INSTALLED_DIR="${{ github.workspace }}/vcpkg_installed" `
-DENABLE_SKYRIM_SE=ON `
-DENABLE_SKYRIM_AE=ON `
-DENABLE_SKYRIM_VR=ON
- name: Build Consumer Test
working-directory: test_consumer
run: cmake --build build --config Release
- name: Run Consumer Test
working-directory: test_consumer
run: |
Write-Host "Running consumer integration test..."
.\build\Release\ConsumerTest.exe
Write-Host "`n✓ Test passed: CommonLib headers compiled successfully when used as dependency"