Skip to content

Commit 03170b6

Browse files
asfernandesDan Dees
authored andcommitted
Use GitHub nuget packages as vcpkg cache (asfernandes#21)
1 parent a3f731b commit 03170b6

2 files changed

Lines changed: 128 additions & 40 deletions

File tree

.github/workflows/main.yml

Lines changed: 63 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ permissions:
1010
contents: read
1111
pages: write
1212
id-token: write
13+
packages: write
1314

1415
concurrency:
1516
group: main
@@ -35,6 +36,11 @@ jobs:
3536
3637
build-linux:
3738
runs-on: ubuntu-latest
39+
env:
40+
USERNAME: asfernandes
41+
VCPKG_EXE: ${{ github.workspace }}/vcpkg/vcpkg
42+
FEED_URL: https://nuget.pkg.github.com/asfernandes/index.json
43+
VCPKG_BINARY_SOURCES: "clear;nuget,https://nuget.pkg.github.com/asfernandes/index.json,readwrite"
3844
steps:
3945
- name: Checkout repository
4046
uses: actions/checkout@v4
@@ -67,7 +73,8 @@ jobs:
6773
graphviz \
6874
ninja-build \
6975
libtommath1 \
70-
libtomcrypt1
76+
libtomcrypt1 \
77+
mono-complete
7178
7279
- name: Install Firebird
7380
run: |
@@ -87,6 +94,20 @@ jobs:
8794
run: |
8895
./vcpkg/bootstrap-vcpkg.sh -disableMetrics
8996
97+
- name: Configure vcpkg binary caching
98+
if: github.repository == 'asfernandes/fb-cpp'
99+
run: |
100+
mono `${{ env.VCPKG_EXE }} fetch nuget | tail -n 1` \
101+
sources add \
102+
-Source "${{ env.FEED_URL }}" \
103+
-StorePasswordInClearText \
104+
-Name GitHubPackages \
105+
-UserName "${{ env.USERNAME }}" \
106+
-Password "${{ secrets.GITHUB_TOKEN }}"
107+
mono `${{ env.VCPKG_EXE }} fetch nuget | tail -n 1` \
108+
setapikey "${{ secrets.GITHUB_TOKEN }}" \
109+
-Source "${{ env.FEED_URL }}"
110+
90111
- name: Configure CMake
91112
run: |
92113
cp CMakeUserPresets.json.posix.template CMakeUserPresets.json
@@ -119,6 +140,11 @@ jobs:
119140

120141
build-windows:
121142
runs-on: windows-latest
143+
env:
144+
USERNAME: asfernandes
145+
VCPKG_EXE: ${{ github.workspace }}/vcpkg/vcpkg
146+
FEED_URL: https://nuget.pkg.github.com/asfernandes/index.json
147+
VCPKG_BINARY_SOURCES: "clear;nuget,https://nuget.pkg.github.com/asfernandes/index.json,readwrite"
122148
steps:
123149
- name: Checkout repository
124150
uses: actions/checkout@v4
@@ -163,6 +189,21 @@ jobs:
163189
run: |
164190
vcpkg\bootstrap-vcpkg.bat -disableMetrics
165191
192+
- name: Configure vcpkg binary caching
193+
if: github.repository == 'asfernandes/fb-cpp'
194+
shell: pwsh
195+
run: |
196+
.$(${{ env.VCPKG_EXE }} fetch nuget) `
197+
sources add `
198+
-Source "${{ env.FEED_URL }}" `
199+
-StorePasswordInClearText `
200+
-Name GitHubPackages `
201+
-UserName "${{ env.USERNAME }}" `
202+
-Password "${{ secrets.GITHUB_TOKEN }}"
203+
.$(${{ env.VCPKG_EXE }} fetch nuget) `
204+
setapikey "${{ secrets.GITHUB_TOKEN }}" `
205+
-Source "${{ env.FEED_URL }}"
206+
166207
- name: Configure CMake
167208
shell: cmd
168209
run: |
@@ -189,6 +230,11 @@ jobs:
189230
190231
build-macos:
191232
runs-on: macos-latest
233+
env:
234+
USERNAME: asfernandes
235+
VCPKG_EXE: ${{ github.workspace }}/vcpkg/vcpkg
236+
FEED_URL: https://nuget.pkg.github.com/asfernandes/index.json
237+
VCPKG_BINARY_SOURCES: "clear;nuget,https://nuget.pkg.github.com/asfernandes/index.json,readwrite"
192238
steps:
193239
- name: Checkout repository
194240
uses: actions/checkout@v4
@@ -214,7 +260,8 @@ jobs:
214260
autoconf \
215261
autoconf-archive \
216262
automake \
217-
libtool
263+
libtool \
264+
mono
218265
219266
- name: Install Firebird
220267
run: |
@@ -233,6 +280,20 @@ jobs:
233280
run: |
234281
./vcpkg/bootstrap-vcpkg.sh -disableMetrics
235282
283+
- name: Configure vcpkg binary caching
284+
if: github.repository == 'asfernandes/fb-cpp'
285+
run: |
286+
mono `${{ env.VCPKG_EXE }} fetch nuget | tail -n 1` \
287+
sources add \
288+
-Source "${{ env.FEED_URL }}" \
289+
-StorePasswordInClearText \
290+
-Name GitHubPackages \
291+
-UserName "${{ env.USERNAME }}" \
292+
-Password "${{ secrets.GITHUB_TOKEN }}"
293+
mono `${{ env.VCPKG_EXE }} fetch nuget | tail -n 1` \
294+
setapikey "${{ secrets.GITHUB_TOKEN }}" \
295+
-Source "${{ env.FEED_URL }}"
296+
236297
- name: Configure CMake
237298
run: |
238299
cp CMakeUserPresets.json.posix.template CMakeUserPresets.json

.github/workflows/pull-request.yml

Lines changed: 65 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ on:
66
- main
77
workflow_dispatch:
88

9+
permissions:
10+
packages: write
11+
912
jobs:
1013
clang-format-check:
1114
runs-on: ubuntu-latest
@@ -27,25 +30,18 @@ jobs:
2730
2831
build-linux:
2932
runs-on: ubuntu-latest
33+
env:
34+
USERNAME: asfernandes
35+
VCPKG_EXE: ${{ github.workspace }}/vcpkg/vcpkg
36+
FEED_URL: https://nuget.pkg.github.com/asfernandes/index.json
37+
VCPKG_BINARY_SOURCES: "clear;nuget,https://nuget.pkg.github.com/asfernandes/index.json,readwrite"
3038
steps:
3139
- name: Checkout repository
3240
uses: actions/checkout@v4
3341
with:
3442
submodules: recursive
3543
fetch-depth: 0
3644

37-
- name: Cache vcpkg artifacts
38-
uses: actions/cache@v4
39-
with:
40-
path: |
41-
vcpkg/downloads
42-
vcpkg/buildtrees
43-
vcpkg/packages
44-
build/Release/vcpkg_installed
45-
key: ${{ runner.os }}-vcpkg-${{ hashFiles('vcpkg.json', 'vcpkg-configuration.json') }}
46-
restore-keys: |
47-
${{ runner.os }}-vcpkg-
48-
4945
- name: Install system dependencies
5046
run: |
5147
sudo apt-get update
@@ -59,7 +55,8 @@ jobs:
5955
graphviz \
6056
ninja-build \
6157
libtommath1 \
62-
libtomcrypt1
58+
libtomcrypt1 \
59+
mono-complete
6360
6461
- name: Install Firebird
6562
run: |
@@ -79,6 +76,20 @@ jobs:
7976
run: |
8077
./vcpkg/bootstrap-vcpkg.sh -disableMetrics
8178
79+
- name: Configure vcpkg binary caching
80+
if: github.repository == 'asfernandes/fb-cpp'
81+
run: |
82+
mono `${{ env.VCPKG_EXE }} fetch nuget | tail -n 1` \
83+
sources add \
84+
-Source "${{ env.FEED_URL }}" \
85+
-StorePasswordInClearText \
86+
-Name GitHubPackages \
87+
-UserName "${{ env.USERNAME }}" \
88+
-Password "${{ secrets.GITHUB_TOKEN }}"
89+
mono `${{ env.VCPKG_EXE }} fetch nuget | tail -n 1` \
90+
setapikey "${{ secrets.GITHUB_TOKEN }}" \
91+
-Source "${{ env.FEED_URL }}"
92+
8293
- name: Configure CMake
8394
run: |
8495
cp CMakeUserPresets.json.posix.template CMakeUserPresets.json
@@ -106,25 +117,18 @@ jobs:
106117
107118
build-windows:
108119
runs-on: windows-latest
120+
env:
121+
USERNAME: asfernandes
122+
VCPKG_EXE: ${{ github.workspace }}/vcpkg/vcpkg
123+
FEED_URL: https://nuget.pkg.github.com/asfernandes/index.json
124+
VCPKG_BINARY_SOURCES: "clear;nuget,https://nuget.pkg.github.com/asfernandes/index.json,readwrite"
109125
steps:
110126
- name: Checkout repository
111127
uses: actions/checkout@v4
112128
with:
113129
submodules: recursive
114130
fetch-depth: 0
115131

116-
- name: Cache vcpkg artifacts
117-
uses: actions/cache@v4
118-
with:
119-
path: |
120-
vcpkg/downloads
121-
vcpkg/buildtrees
122-
vcpkg/packages
123-
build/vcpkg_installed
124-
key: ${{ runner.os }}-vcpkg-${{ hashFiles('vcpkg.json', 'vcpkg-configuration.json') }}
125-
restore-keys: |
126-
${{ runner.os }}-vcpkg-
127-
128132
- name: Install Firebird
129133
shell: cmd
130134
run: |
@@ -150,6 +154,21 @@ jobs:
150154
run: |
151155
vcpkg\bootstrap-vcpkg.bat -disableMetrics
152156
157+
- name: Configure vcpkg binary caching
158+
if: github.repository == 'asfernandes/fb-cpp'
159+
shell: pwsh
160+
run: |
161+
.$(${{ env.VCPKG_EXE }} fetch nuget) `
162+
sources add `
163+
-Source "${{ env.FEED_URL }}" `
164+
-StorePasswordInClearText `
165+
-Name GitHubPackages `
166+
-UserName "${{ env.USERNAME }}" `
167+
-Password "${{ secrets.GITHUB_TOKEN }}"
168+
.$(${{ env.VCPKG_EXE }} fetch nuget) `
169+
setapikey "${{ secrets.GITHUB_TOKEN }}" `
170+
-Source "${{ env.FEED_URL }}"
171+
153172
- name: Configure CMake
154173
shell: cmd
155174
run: |
@@ -178,32 +197,26 @@ jobs:
178197
179198
build-macos:
180199
runs-on: macos-latest
200+
env:
201+
USERNAME: asfernandes
202+
VCPKG_EXE: ${{ github.workspace }}/vcpkg/vcpkg
203+
FEED_URL: https://nuget.pkg.github.com/asfernandes/index.json
204+
VCPKG_BINARY_SOURCES: "clear;nuget,https://nuget.pkg.github.com/asfernandes/index.json,readwrite"
181205
steps:
182206
- name: Checkout repository
183207
uses: actions/checkout@v4
184208
with:
185209
submodules: recursive
186210
fetch-depth: 0
187211

188-
- name: Cache vcpkg artifacts
189-
uses: actions/cache@v4
190-
with:
191-
path: |
192-
vcpkg/downloads
193-
vcpkg/buildtrees
194-
vcpkg/packages
195-
build/Release/vcpkg_installed
196-
key: ${{ runner.os }}-vcpkg-${{ hashFiles('vcpkg.json', 'vcpkg-configuration.json') }}
197-
restore-keys: |
198-
${{ runner.os }}-vcpkg-
199-
200212
- name: Install system dependencies
201213
run: |
202214
brew install \
203215
autoconf \
204216
autoconf-archive \
205217
automake \
206-
libtool
218+
libtool \
219+
mono
207220
208221
- name: Install Firebird
209222
run: |
@@ -222,6 +235,20 @@ jobs:
222235
run: |
223236
./vcpkg/bootstrap-vcpkg.sh -disableMetrics
224237
238+
- name: Configure vcpkg binary caching
239+
if: github.repository == 'asfernandes/fb-cpp'
240+
run: |
241+
mono `${{ env.VCPKG_EXE }} fetch nuget | tail -n 1` \
242+
sources add \
243+
-Source "${{ env.FEED_URL }}" \
244+
-StorePasswordInClearText \
245+
-Name GitHubPackages \
246+
-UserName "${{ env.USERNAME }}" \
247+
-Password "${{ secrets.GITHUB_TOKEN }}"
248+
mono `${{ env.VCPKG_EXE }} fetch nuget | tail -n 1` \
249+
setapikey "${{ secrets.GITHUB_TOKEN }}" \
250+
-Source "${{ env.FEED_URL }}"
251+
225252
- name: Configure CMake
226253
run: |
227254
cp CMakeUserPresets.json.posix.template CMakeUserPresets.json

0 commit comments

Comments
 (0)