diff --git a/.github/workflows/artifacts.yaml b/.github/workflows/artifacts.yaml index 0cf179ff..23228e11 100644 --- a/.github/workflows/artifacts.yaml +++ b/.github/workflows/artifacts.yaml @@ -146,3 +146,122 @@ jobs: with: name: rustls-ffi-x86_64-macos path: x86-dist + + test-archives: + name: "Test (${{ matrix.os }})" + runs-on: ${{ matrix.os }} + needs: [ windows-binaries, linux-binaries, macos-binaries ] + strategy: + matrix: + include: + - os: windows-latest + artifact: rustls-ffi-x86_64-windows + - os: ubuntu-latest + artifact: rustls-ffi-x86_64-linux-gnu + - os: macos-14 + artifact: rustls-ffi-arm64-macos + - os: macos-13 + artifact: rustls-ffi-x86_64-macos + steps: + - name: Checkout rustls-ffi-test sources + uses: actions/checkout@v4 + with: + repository: 'cpu/rustls-ffi-test' + - name: Download rustls-ffi artifact + uses: actions/download-artifact@v4 + with: + name: ${{ matrix.artifact }} + path: ${{ matrix.artifact }} + # .pc files aren't relocatable. We need to update the prefix to point to + # the correct location that we extracted the archive. This seems more reliable + # than using `--define-prefix` - it seems to tack an extra 'lib/' subcomponent + # onto the include path that breaks the build. + - name: Fix pkg-config prefix + # We use bash shell explicitly to avoid PowerShell on Windows and to ensure we have 'sed'. + shell: bash + # For further fun, sed isn't consistent between macOS and Linux. + run: | + case "${{ runner.os }}" in + "macOS") + sed -i '' "s|prefix=.*|prefix=${{ matrix.artifact }}|" ${{ matrix.artifact }}/lib/pkgconfig/rustls.pc + ;; + *) + sed -i "s|prefix=.*|prefix=${{ matrix.artifact }}|" ${{ matrix.artifact }}/lib/pkgconfig/rustls.pc + ;; + esac + # Dump out what pkg-config says about the rustls package. + - name: Debug pkg-config + run: | + pkg-config --cflags rustls + pkg-config --libs rustls + env: + PKG_CONFIG_PATH: ${{ matrix.artifact }}/lib/pkgconfig + # Set up the cmake build, overriding PKG_CONFIG_PATH to + # point to the extracted rustls-ffi archive. + - name: Setup cmake build (UNIX) + if: matrix.os != 'windows-latest' + env: + PKG_CONFIG_PATH: ${{ matrix.artifact }}/lib/pkgconfig + run: cmake -S . -B build -DCMAKE_BUILD_TYPE=Release + # Set up the cmake build, overriding PKG_CONFIG_PATH to + # point to the extracted rustls-ffi archive. + # + # For Windows cmake needs some help finding the strawberry perl pkg-config + # that's installed in the runner's PATH. + - name: Setup cmake build (Windows) + if: matrix.os == 'windows-latest' + env: + PKG_CONFIG_PATH: ${{ matrix.artifact }}/lib/pkgconfig + run: cmake -DPKG_CONFIG_EXECUTABLE=C:\Strawberry\perl\bin\pkg-config.bat -S . -B build + # Build the rustls-ffi-test binary. + - name: Build rustls-ffi-test (UNIX) + if: matrix.os != 'windows-latest' + run: cmake --build build -v + # Build the rustls-ffi-test binary. + # On Windows we need to specify a configuration to avoid a warning about using the default + # debug MSCRT runtime with a lib built with the release MSCRT runtime. + - name: Build rustls-ffi-test (Windows) + if: matrix.os == 'windows-latest' + run: cmake --build build --config Release -v + # Run the rustls-ffi-test binary. + - name: Run rustls-ffi-test (UNIX) + if: matrix.os != 'windows-latest' + run: ./build/rustls-ffi-test + # Run the rustls-ffi-test binary. + # On Windows it's in a different output location under build. + - name: Run rustls-ffi-test (Windows) + if: matrix.os == 'windows-latest' + run: ./build/Release/rustls-ffi-test.exe + + test-deb: + name: "Test Linux Deb (${{ matrix.os }})" + runs-on: ${{ matrix.os }} + needs: [ linux-deb ] + strategy: + matrix: + os: [ ubuntu-latest, ubuntu-20.04 ] + steps: + - name: Checkout rustls-ffi-test sources + uses: actions/checkout@v4 + with: + repository: 'cpu/rustls-ffi-test' + - name: Download rustls-ffi deb artifact + uses: actions/download-artifact@v4 + with: + name: librustls_0.15.0_amd64.deb + - name: Install deb + run: sudo dpkg --install ./librustls_0.15.0_amd64.deb + # Dump out what pkg-config says about the rustls package. + - name: Debug pkg-config + run: | + pkg-config --cflags rustls + pkg-config --libs rustls + # Set up the cmake build, no pkg-config ENV overrides needed. + - name: Setup cmake build + run: cmake -S . -B build -DCMAKE_BUILD_TYPE=Release + # Build the rustls-ffi-test binary. + - name: Build rustls-ffi-test + run: cmake --build build -v + # Run the rustls-ffi-test binary. + - name: Run rustls-ffi-test + run: ./build/rustls-ffi-test