Skip to content

Commit c4cc238

Browse files
committed
ci: add testing of artifacts
Uses the cpu/rustls-ffi-test repo and the artifacts produced by earlier stages of the workflow to smoke-test the builds.
1 parent f297402 commit c4cc238

File tree

1 file changed

+119
-0
lines changed

1 file changed

+119
-0
lines changed

.github/workflows/artifacts.yaml

Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,3 +146,122 @@ jobs:
146146
with:
147147
name: rustls-ffi-x86_64-macos
148148
path: x86-dist
149+
150+
test-archives:
151+
name: "Test (${{ matrix.os }})"
152+
runs-on: ${{ matrix.os }}
153+
needs: [ windows-binaries, linux-binaries, macos-binaries ]
154+
strategy:
155+
matrix:
156+
include:
157+
- os: windows-latest
158+
artifact: rustls-ffi-x86_64-windows
159+
- os: ubuntu-latest
160+
artifact: rustls-ffi-x86_64-linux-gnu
161+
- os: macos-14
162+
artifact: rustls-ffi-arm64-macos
163+
- os: macos-13
164+
artifact: rustls-ffi-x86_64-macos
165+
steps:
166+
- name: Checkout rustls-ffi-test sources
167+
uses: actions/checkout@v4
168+
with:
169+
repository: 'cpu/rustls-ffi-test'
170+
- name: Download rustls-ffi artifact
171+
uses: actions/download-artifact@v4
172+
with:
173+
name: ${{ matrix.artifact }}
174+
path: ${{ matrix.artifact }}
175+
# .pc files aren't relocatable. We need to update the prefix to point to
176+
# the correct location that we extracted the archive. This seems more reliable
177+
# than using `--define-prefix` - it seems to tack an extra 'lib/' subcomponent
178+
# onto the include path that breaks the build.
179+
- name: Fix pkg-config prefix
180+
# We use bash shell explicitly to avoid PowerShell on Windows and to ensure we have 'sed'.
181+
shell: bash
182+
# For further fun, sed isn't consistent between macOS and Linux.
183+
run: |
184+
case "${{ runner.os }}" in
185+
"macOS")
186+
sed -i '' "s|prefix=.*|prefix=${{ matrix.artifact }}|" ${{ matrix.artifact }}/lib/pkgconfig/rustls.pc
187+
;;
188+
*)
189+
sed -i "s|prefix=.*|prefix=${{ matrix.artifact }}|" ${{ matrix.artifact }}/lib/pkgconfig/rustls.pc
190+
;;
191+
esac
192+
# Dump out what pkg-config says about the rustls package.
193+
- name: Debug pkg-config
194+
run: |
195+
pkg-config --cflags rustls
196+
pkg-config --libs rustls
197+
env:
198+
PKG_CONFIG_PATH: ${{ matrix.artifact }}/lib/pkgconfig
199+
# Set up the cmake build, overriding PKG_CONFIG_PATH to
200+
# point to the extracted rustls-ffi archive.
201+
- name: Setup cmake build (UNIX)
202+
if: matrix.os != 'windows-latest'
203+
env:
204+
PKG_CONFIG_PATH: ${{ matrix.artifact }}/lib/pkgconfig
205+
run: cmake -S . -B build -DCMAKE_BUILD_TYPE=Release
206+
# Set up the cmake build, overriding PKG_CONFIG_PATH to
207+
# point to the extracted rustls-ffi archive.
208+
#
209+
# For Windows cmake needs some help finding the strawberry perl pkg-config
210+
# that's installed in the runner's PATH.
211+
- name: Setup cmake build (Windows)
212+
if: matrix.os == 'windows-latest'
213+
env:
214+
PKG_CONFIG_PATH: ${{ matrix.artifact }}/lib/pkgconfig
215+
run: cmake -DPKG_CONFIG_EXECUTABLE=C:\Strawberry\perl\bin\pkg-config.bat -S . -B build
216+
# Build the rustls-ffi-test binary.
217+
- name: Build rustls-ffi-test (UNIX)
218+
if: matrix.os != 'windows-latest'
219+
run: cmake --build build -v
220+
# Build the rustls-ffi-test binary.
221+
# On Windows we need to specify a configuration to avoid a warning about using the default
222+
# debug MSCRT runtime with a lib built with the release MSCRT runtime.
223+
- name: Build rustls-ffi-test (Windows)
224+
if: matrix.os == 'windows-latest'
225+
run: cmake --build build --config Release -v
226+
# Run the rustls-ffi-test binary.
227+
- name: Run rustls-ffi-test (UNIX)
228+
if: matrix.os != 'windows-latest'
229+
run: ./build/rustls-ffi-test
230+
# Run the rustls-ffi-test binary.
231+
# On Windows it's in a different output location under build.
232+
- name: Run rustls-ffi-test (Windows)
233+
if: matrix.os == 'windows-latest'
234+
run: ./build/Release/rustls-ffi-test.exe
235+
236+
test-deb:
237+
name: "Test Linux Deb (${{ matrix.os }})"
238+
runs-on: ${{ matrix.os }}
239+
needs: [ linux-deb ]
240+
strategy:
241+
matrix:
242+
os: [ ubuntu-latest, ubuntu-20.04 ]
243+
steps:
244+
- name: Checkout rustls-ffi-test sources
245+
uses: actions/checkout@v4
246+
with:
247+
repository: 'cpu/rustls-ffi-test'
248+
- name: Download rustls-ffi deb artifact
249+
uses: actions/download-artifact@v4
250+
with:
251+
name: librustls_0.15.0_amd64.deb
252+
- name: Install deb
253+
run: sudo dpkg --install ./librustls_0.15.0_amd64.deb
254+
# Dump out what pkg-config says about the rustls package.
255+
- name: Debug pkg-config
256+
run: |
257+
pkg-config --cflags rustls
258+
pkg-config --libs rustls
259+
# Set up the cmake build, no pkg-config ENV overrides needed.
260+
- name: Setup cmake build
261+
run: cmake -S . -B build -DCMAKE_BUILD_TYPE=Release
262+
# Build the rustls-ffi-test binary.
263+
- name: Build rustls-ffi-test
264+
run: cmake --build build -v
265+
# Run the rustls-ffi-test binary.
266+
- name: Run rustls-ffi-test
267+
run: ./build/rustls-ffi-test

0 commit comments

Comments
 (0)