-
Notifications
You must be signed in to change notification settings - Fork 5
172 lines (152 loc) · 6.58 KB
/
Copy pathtesting-cpp.yml
File metadata and controls
172 lines (152 loc) · 6.58 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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
name: Testing C++
# Trigger on pushes, PRs (excluding documentation changes), and nightly.
on:
push:
branches: [master, main]
pull_request:
schedule:
- cron: 0 0 * * * # daily at 00:00
workflow_dispatch:
permissions:
contents: read
jobs:
test:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest]
config:
# vcpkg-commit pins the `builtin-baseline` for each protobuf
# version. We use the baseline (not `overrides`) so that abseil /
# utf8-range / re2 are pulled from the same self-consistent vcpkg
# snapshot as protobuf — `overrides` alone would let those
# transitive deps drift forward and break ABI.
#
# The labels and SHAs below mirror .devcontainer/versions.env's
# MODERN_*/LEGACY_V3_* entries — keep them in sync when bumping.
# GitHub Actions matrices are evaluated at workflow parse time,
# so we can't read them from versions.env via the load-versions
# composite action; the duplication is intentional.
#
# CI passes the SHA explicitly via --vcpkg-baseline so the run is
# fully reproducible and independent of vcpkg's git history (which
# `lukka/run-vcpkg` checks out shallowly). For ad-hoc local runs
# `make.py` can auto-resolve the SHA from $VCPKG_ROOT instead — see
# `_resolve_vcpkg_baseline_for_protobuf`.
#
# To pin a new protobuf version, run on a full vcpkg checkout:
# git -C $VCPKG_ROOT log -S '"X.Y.Z"' -- versions/baseline.json
# then pick the newest commit whose baseline.json has
# default.protobuf.baseline == "X.Y.Z".
- label: modern
protobuf-version: "6.33.4"
vcpkg-commit: "56bb2411609227288b70117ead2c47585ba07713"
- label: legacy-v3
protobuf-version: "3.21.12"
vcpkg-commit: "6245ce44a03f04d19be125ab1bbab578d0933e85"
include:
- os: ubuntu-latest
triplet: x64-linux
- os: windows-latest
triplet: x64-windows-static
exclude:
# The 2023-01-15 vcpkg snapshot pinned by legacy-v3 references
# MSYS2 distfiles that have since been pruned from repo.msys2.org;
# the protobuf:x64-windows port pulls them in via vcpkg_acquire_msys
# → vcpkg_fixup_pkgconfig and fails the download. Linux uses the
# system pkg-config so it isn't affected. Keep legacy-v3 as a
# Linux-only smoke test for the protobuf-3 ABI; modern still
# exercises the Windows build path.
- os: windows-latest
config:
label: legacy-v3
protobuf-version: "3.21.12"
vcpkg-commit: "6245ce44a03f04d19be125ab1bbab578d0933e85"
name: test (${{ matrix.os }}, ${{ matrix.config.label }})
runs-on: ${{ matrix.os }}
timeout-minutes: 45
env:
VCPKG_INSTALLED_DIR: ${{ github.workspace }}/vcpkg_installed
VCPKG_DEFAULT_TRIPLET: ${{ matrix.triplet }}
steps:
- name: Checkout Code
uses: actions/checkout@v6
- name: Read pinned versions
uses: ./.github/actions/load-versions
- name: Install Go
uses: actions/setup-go@v6
with:
go-version-file: go.mod
cache-dependency-path: go.sum
cache: true
- name: Install Ninja (Ubuntu)
if: runner.os == 'Linux'
run: sudo apt-get update && sudo apt-get install -y ninja-build
- name: Setup MSVC (Windows)
if: runner.os == 'Windows'
uses: ilammy/msvc-dev-cmd@v1
- name: Setup Python
uses: actions/setup-python@v6
with:
python-version: "3.12"
- name: Render vcpkg.json
# `lukka/run-vcpkg` runs `vcpkg install` before `make.py test`, so
# the manifest must exist beforehand. We render the same shape
# `make.py` would (baseline-only, no `overrides`) keyed on the same
# SHA, so the cache key and the eventual build see one manifest.
working-directory: test/cpp-tableau-loader
shell: bash
run: |
cat > vcpkg.json <<EOF
{
"name": "loader-cpp-test",
"version": "0.1.0",
"dependencies": ["protobuf"],
"builtin-baseline": "${{ matrix.config.vcpkg-commit }}"
}
EOF
- name: Compute vcpkg cache tag
id: vcpkg_tag
shell: bash
run: echo "image=${ImageVersion:-noimg}" >> "$GITHUB_OUTPUT"
- name: Cache vcpkg_installed
id: cache-vcpkg-installed
uses: actions/cache@v4
with:
path: ${{ env.VCPKG_INSTALLED_DIR }}
key: vcpkg-installed-${{ runner.os }}-${{ steps.vcpkg_tag.outputs.image }}-${{ matrix.triplet }}-${{ matrix.config.vcpkg-commit }}-${{ hashFiles('test/cpp-tableau-loader/vcpkg.json') }}
- name: Export GitHub Actions cache env (for vcpkg x-gha)
if: matrix.config.label == 'modern'
uses: actions/github-script@v7
with:
script: |
core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || '');
core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || '');
- name: Setup vcpkg & install protobuf
env:
VCPKG_BINARY_SOURCES: ${{ matrix.config.label == 'legacy-v3' && 'clear' || 'clear;x-gha,readwrite' }}
uses: lukka/run-vcpkg@v11
with:
vcpkgGitCommitId: ${{ matrix.config.vcpkg-commit }}
vcpkgJsonGlob: "test/cpp-tableau-loader/vcpkg.json"
runVcpkgInstall: true
- name: Add vcpkg-installed protoc to PATH (Linux)
if: runner.os == 'Linux'
run: echo "$VCPKG_INSTALLED_DIR/${{ matrix.triplet }}/tools/protobuf" >> "$GITHUB_PATH"
- name: Add vcpkg-installed protoc to PATH (Windows)
if: runner.os == 'Windows'
shell: pwsh
run: Add-Content -Path $env:GITHUB_PATH -Value "$env:VCPKG_INSTALLED_DIR\${{ matrix.triplet }}\tools\protobuf"
- name: Install Buf
run: python3 make.py setup --lang go
- name: Test
# Pass --vcpkg-baseline explicitly so make.py reuses the SHA we
# already rendered into vcpkg.json above, instead of auto-resolving
# from the vcpkg checkout (which is shallow on the CI runner).
run: >
python3 make.py test --lang cpp
--protobuf-version ${{ matrix.config.protobuf-version }}
--vcpkg-baseline ${{ matrix.config.vcpkg-commit }}
--triplet ${{ matrix.triplet }}
--no-clean
--no-vcpkg-install