From 8d1453d26fa5f3a26d4f244d58ffa955be4486ab Mon Sep 17 00:00:00 2001 From: Daniel McCarney Date: Mon, 10 Feb 2025 10:38:24 -0500 Subject: [PATCH] ci: standardize on runner.os Prev we used `matrix.os` for taking OS specific actions. It's more reliable to use `runner.os` for this, since action names can be changed and the `runner.os` is a true reflection of the OS of the runner instance. --- .github/workflows/artifacts.yaml | 16 ++++++++-------- .github/workflows/daily-tests.yml | 24 ++++++++++++------------ .github/workflows/test.yaml | 6 +++--- 3 files changed, 23 insertions(+), 23 deletions(-) diff --git a/.github/workflows/artifacts.yaml b/.github/workflows/artifacts.yaml index 2da01f54..d5e3b1c3 100644 --- a/.github/workflows/artifacts.yaml +++ b/.github/workflows/artifacts.yaml @@ -195,7 +195,7 @@ jobs: # 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 (UNIX) - if: matrix.os != 'windows-latest' + if: runner.os != 'Windows' shell: bash # For further fun, sed isn't consistent between macOS and Linux. run: | @@ -208,7 +208,7 @@ jobs: ;; esac - name: Fix pkg-config prefix (Windows) - if: matrix.os == 'windows-latest' + if: runner.os == 'Windows' shell: pwsh run: | $prefix = (Get-Location).Path + "/${{ matrix.artifact }}" @@ -227,7 +227,7 @@ jobs: # 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' + if: runner.os != 'Windows' env: PKG_CONFIG_PATH: ${{ matrix.artifact }}/lib/pkgconfig run: cmake -S librustls -B build -DCMAKE_BUILD_TYPE=Release -DFORCE_SYSTEM_RUSTLS=ON @@ -237,30 +237,30 @@ jobs: # 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' + if: runner.os == 'Windows' env: PKG_CONFIG_PATH: ${{ matrix.artifact }}/lib/pkgconfig run: cmake -DPKG_CONFIG_EXECUTABLE=C:\Strawberry\perl\bin\pkg-config.bat -DFORCE_SYSTEM_RUSTLS=ON -S librustls -B build # Build the client and server binaries - name: Build rustls-ffi client/server (UNIX) - if: matrix.os != 'windows-latest' + if: runner.os != 'Windows' run: cmake --build build -v # Build the client and server binaries # 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 client/server (Windows) - if: matrix.os == 'windows-latest' + if: runner.os == 'Windows' run: cmake --build build --config Release -v # Run the rustls-ffi client binary. - name: Run rustls-ffi client (UNIX) - if: matrix.os != 'windows-latest' + if: runner.os != 'Windows' env: RUSTLS_PLATFORM_VERIFIER: 1 run: ./build/tests/client example.com 443 / 1 # Run the rustls-ffi-test binary. # On Windows it's in a different output location under build. - name: Run rustls-ffi client (Windows) - if: matrix.os == 'windows-latest' + if: runner.os == 'Windows' env: RUSTLS_PLATFORM_VERIFIER: 1 run: .\build\tests\Release\client.exe example.com 443 / 1 diff --git a/.github/workflows/daily-tests.yml b/.github/workflows/daily-tests.yml index 9dc7bb65..7db247f0 100644 --- a/.github/workflows/daily-tests.yml +++ b/.github/workflows/daily-tests.yml @@ -29,7 +29,7 @@ jobs: uses: dtolnay/rust-toolchain@nightly - name: Install cargo-c (Ubuntu) - if: matrix.os == 'ubuntu-latest' + if: runner.os == 'Linux' env: LINK: https://github.com/lu-zero/cargo-c/releases/latest/download CARGO_C_FILE: cargo-c-x86_64-unknown-linux-musl.tar.gz @@ -37,7 +37,7 @@ jobs: curl -L $LINK/$CARGO_C_FILE | tar xz -C ~/.cargo/bin - name: Install cargo-c (macOS) - if: matrix.os == 'macos-latest' + if: runner.os == 'macOS' env: LINK: https://github.com/lu-zero/cargo-c/releases/latest/download CARGO_C_FILE: cargo-c-macos.zip @@ -46,7 +46,7 @@ jobs: unzip cargo-c-macos.zip -d ~/.cargo/bin - name: Install cargo-c (Windows) - if: matrix.os == 'windows-latest' + if: runner.os == 'Windows' env: LINK: https://github.com/lu-zero/cargo-c/releases/latest/download CARGO_C_FILE: cargo-c-windows-msvc.zip @@ -57,15 +57,15 @@ jobs: - name: Setup cmake build run: | cmake ${{ - matrix.os != 'windows-latest' && '-DCMAKE_BUILD_TYPE=Release \' || '' + runner.os != 'Windows' && '-DCMAKE_BUILD_TYPE=Release \' || '' }} ${{ - matrix.os == 'macos-latest' && '-DCMAKE_OSX_DEPLOYMENT_TARGET=14.5' || '' + runner.os == 'macOS' && '-DCMAKE_OSX_DEPLOYMENT_TARGET=14.5' || '' }} -S librustls -B build - name: Run platform-verifier connect test run: | cmake --build build --target connect-test ${{ - matrix.os == 'windows-latest' && '--config Release' || '' + runner.os == 'Windows' && '--config Release' || '' }} ech: @@ -85,7 +85,7 @@ jobs: uses: dtolnay/rust-toolchain@nightly - name: Install cargo-c (Ubuntu) - if: matrix.os == 'ubuntu-latest' + if: runner.os == 'Linux' env: LINK: https://github.com/lu-zero/cargo-c/releases/latest/download CARGO_C_FILE: cargo-c-x86_64-unknown-linux-musl.tar.gz @@ -93,7 +93,7 @@ jobs: curl -L $LINK/$CARGO_C_FILE | tar xz -C ~/.cargo/bin - name: Install cargo-c (macOS) - if: matrix.os == 'macos-latest' + if: runner.os == 'macOS' env: LINK: https://github.com/lu-zero/cargo-c/releases/latest/download CARGO_C_FILE: cargo-c-macos.zip @@ -102,7 +102,7 @@ jobs: unzip cargo-c-macos.zip -d ~/.cargo/bin - name: Install cargo-c (Windows) - if: matrix.os == 'windows-latest' + if: runner.os == 'Windows' env: LINK: https://github.com/lu-zero/cargo-c/releases/latest/download CARGO_C_FILE: cargo-c-windows-msvc.zip @@ -113,9 +113,9 @@ jobs: - name: Setup cmake build run: | cmake ${{ - matrix.os != 'windows-latest' && '-DCMAKE_BUILD_TYPE=Release \' || '' + runner.os != 'Windows' && '-DCMAKE_BUILD_TYPE=Release \' || '' }} ${{ - matrix.os == 'macos-latest' && '-DCMAKE_OSX_DEPLOYMENT_TARGET=14.5' || '' + runner.os == 'macOS' && '-DCMAKE_OSX_DEPLOYMENT_TARGET=14.5' || '' }} -S librustls -B build - name: Run ECH test @@ -123,7 +123,7 @@ jobs: shell: bash run: | cmake --build build --target ech-test ${{ - matrix.os == 'windows-latest' && '--config Release' || '' + runner.os == 'Windows' && '--config Release' || '' }} | tee ech-test.log - name: Verify ECH status diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index b78e50d5..c0d95f32 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -84,7 +84,7 @@ jobs: toolchain: ${{ matrix.rust }} - name: Install cargo-c (Ubuntu) - if: matrix.os == 'ubuntu-latest' + if: runner.os == 'Linux' env: # Version picked for MSRV compat. LINK: https://github.com/lu-zero/cargo-c/releases/download/v0.10.0 @@ -93,7 +93,7 @@ jobs: curl -L $LINK/$CARGO_C_FILE | tar xz -C ~/.cargo/bin - name: Install cargo-c (macOS) - if: matrix.os == 'macos-latest' + if: runner.os == 'macOS' env: # Version picked for MSRV compat. LINK: https://github.com/lu-zero/cargo-c/releases/download/v0.10.0 @@ -112,7 +112,7 @@ jobs: -DPREFER_POST_QUANTUM=${{matrix.prefer-pq}} \ -DDYN_LINK=${{matrix.dyn_link}} \ -DCMAKE_BUILD_TYPE=Debug \ - ${{ matrix.os == 'macos-latest' && '-DCMAKE_OSX_DEPLOYMENT_TARGET=14.5' || '' }} \ + ${{ runner.os == 'macOS' && '-DCMAKE_OSX_DEPLOYMENT_TARGET=14.5' || '' }} \ -S librustls -B build - name: Build