diff --git a/.github/workflows/package-linux.yml b/.github/workflows/package-linux.yml index 632b0578e9..82bbab8916 100644 --- a/.github/workflows/package-linux.yml +++ b/.github/workflows/package-linux.yml @@ -81,3 +81,69 @@ jobs: run: | chmod +x artifacts/bin/linux/${{ matrix.vec.arch }}_${{ matrix.vec.config }}_${{ matrix.vec.tls }}/msquictest artifacts/bin/linux/${{ matrix.vec.arch }}_${{ matrix.vec.config }}_${{ matrix.vec.tls }}/msquictest --gtest_filter=ParameterValidation.ValidateApi + test-packages-on-docker: + name: Test Linux Packages + needs: [build-packages] + strategy: + fail-fast: false + matrix: + vec: [ + # Ubuntu 24.04 + { friendlyName: "Ubuntu 24.04 x64", config: "Release", os: "ubuntu-24.04", arch: "x64", tls: "openssl3", image: "mcr.microsoft.com/dotnet/sdk:9.0-preview-noble-amd64", xdp: "-UseXdp", dotnetVersion: "9.0" }, + { friendlyName: "Ubuntu 24.04 ARM32", config: "Release", os: "ubuntu-24.04", arch: "arm", tls: "openssl3", image: "mcr.microsoft.com/dotnet/sdk:9.0-preview-noble-arm32v7", dotnetVersion: "9.0" }, + { friendlyName: "Ubuntu 24.04 ARM64", config: "Release", os: "ubuntu-24.04", arch: "arm64", tls: "openssl3", image: "mcr.microsoft.com/dotnet/sdk:9.0-preview-noble-arm64v8", dotnetVersion: "9.0" }, + # Ubuntu 22.04 + { friendlyName: "Ubuntu 22.04 x64", config: "Release", os: "ubuntu-22.04", arch: "x64", tls: "openssl3", image: "mcr.microsoft.com/dotnet/runtime:8.0-jammy-amd64", dotnetVersion: "8.0" }, + { friendlyName: "Ubuntu 22.04 ARM32", config: "Release", os: "ubuntu-22.04", arch: "arm", tls: "openssl3", image: "mcr.microsoft.com/dotnet/runtime:8.0-jammy-arm32v7", dotnetVersion: "8.0" }, + { friendlyName: "Ubuntu 22.04 ARM64", config: "Release", os: "ubuntu-22.04", arch: "arm64", tls: "openssl3", image: "mcr.microsoft.com/dotnet/runtime:8.0-jammy-arm64v8", dotnetVersion: "8.0" }, + # Ubuntu 20.04 + { friendlyName: "Ubuntu 20.04 x64", config: "Release", os: "ubuntu-20.04", arch: "x64", tls: "openssl", image: "mcr.microsoft.com/dotnet-buildtools/prereqs:ubuntu-20.04-helix-amd64", dotnetVersion: "9.0" }, + { friendlyName: "Ubuntu 20.04 ARM64", config: "Release", os: "ubuntu-20.04", arch: "arm64", tls: "openssl", image: "mcr.microsoft.com/dotnet-buildtools/prereqs:ubuntu-20.04-helix-arm64v8", dotnetVersion: "9.0" }, + # Debian 12 + { friendlyName: "Debian 12 x64", config: "Release", os: "ubuntu-22.04", arch: "x64", tls: "openssl3", image: "mcr.microsoft.com/dotnet/sdk:9.0-preview-bookworm-slim-amd64", dotnetVersion: "9.0" }, + { friendlyName: "Debian 12 ARM32", config: "Release", os: "ubuntu-22.04", arch: "arm", tls: "openssl3", image: "mcr.microsoft.com/dotnet/sdk:9.0-preview-bookworm-slim-arm32v7", dotnetVersion: "9.0" }, + { friendlyName: "Debian 12 ARM64", config: "Release", os: "ubuntu-22.04", arch: "arm64", tls: "openssl3", image: "mcr.microsoft.com/dotnet/sdk:9.0-preview-bookworm-slim-arm64v8", dotnetVersion: "9.0" }, + # CBL-Mariner 2.0 + { friendlyName: "CBL-Mariner 2.0 x64", config: "Release", os: "ubuntu-20.04", arch: "x64", tls: "openssl", image: "mcr.microsoft.com/dotnet/runtime:8.0-cbl-mariner2.0-amd64", dotnetVersion: "8.0" }, + { friendlyName: "CBL-Mariner 2.0 ARM64", config: "Release", os: "ubuntu-20.04", arch: "arm64", tls: "openssl", image: "mcr.microsoft.com/dotnet/runtime:8.0-cbl-mariner2.0-arm64v8", dotnetVersion: "8.0" }, + # Azure Linux 3.0 + { friendlyName: "AzureLinux 3.0 x64", config: "Release", os: "ubuntu-24.04", arch: "x64", tls: "openssl3", image: "mcr.microsoft.com/dotnet/sdk:9.0-preview-azurelinux3.0-amd64", dotnetVersion: "9.0", xdp: "-UseXdp" }, + { friendlyName: "AzureLinux 3.0 ARM64", config: "Release", os: "ubuntu-24.04", arch: "arm64", tls: "openssl3", image: "mcr.microsoft.com/dotnet/sdk:9.0-preview-azurelinux3.0-arm64v8", dotnetVersion: "9.0" }, + # Centos Stream 9 + { friendlyName: "CentOS Stream 9 x64", config: "Release", os: "ubuntu-22.04", arch: "x64", tls: "openssl3", image: "mcr.microsoft.com/dotnet-buildtools/prereqs:centos-stream9-helix", dotnetVersion: "9.0" }, + # Fedora 39 - 40 + { friendlyName: "Fedora 39 x64", config: "Release", os: "ubuntu-22.04", arch: "x64", tls: "openssl3", image: "mcr.microsoft.com/dotnet-buildtools/prereqs:fedora-39", dotnetVersion: "9.0" }, + { friendlyName: "Fedora 40 x64", config: "Release", os: "ubuntu-22.04", arch: "x64", tls: "openssl3", image: "mcr.microsoft.com/dotnet-buildtools/prereqs:fedora-40", dotnetVersion: "9.0" }, + # OpenSuse 15.4 + { friendlyName: "OpenSuse 15.4 x64", config: "Release", os: "ubuntu-20.04", arch: "x64", tls: "openssl", image: "mcr.microsoft.com/dotnet-buildtools/prereqs:opensuse-15.4-helix-amd64", dotnetVersion: "9.0" }, + # RHEL 8 - 9 + # { config: "Release", os: "ubuntu-24.04", arch: "x64", tls: "openssl3", image: "redhat/ubi8-minimal:latest" }, + # { config: "Release", os: "ubuntu-24.04", arch: "x64", tls: "openssl3", image: "redhat/ubi9-minimal:latest" }, + ] + runs-on: ${{ matrix.vec.os }} + steps: + - name: Checkout Repository + uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 + - name: Download Package + uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 + with: + name: Package-${{ matrix.vec.config }}-linux-${{ matrix.vec.os }}-${{ matrix.vec.arch }}-${{ matrix.vec.tls }}-UseSystemOpenSSLCrypto${{ matrix.vec.xdp }} + path: artifacts + - name: Download Build Artifacts + uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 + with: + name: ${{ matrix.vec.config }}-linux-${{ matrix.vec.os }}-${{ matrix.vec.arch }}-${{ matrix.vec.tls }}-UseSystemOpenSSLCrypto${{ matrix.vec.xdp }} + path: artifacts + - name: Set up QEMU + uses: docker/setup-qemu-action@49b3bc8e6bdd4a60e6116a5414239cba5943d3cf + - name: Set up .NET 9.0 + uses: actions/setup-dotnet@6bd8b7f7774af54e05809fcc5431931b3eb1ddee + with: + dotnet-version: ${{ matrix.vec.dotnetVersion }} + - name: Build .NET QUIC Test Project + run: | + pushd src/cs/QuicSimpleTest && dotnet build QuicHello.net${{ matrix.vec.dotnetVersion }}.csproj -a ${{ matrix.vec.arch }} -c ${{ matrix.vec.config }} -o artifacts/net${{ matrix.vec.dotnetVersion }} -f net${{ matrix.vec.dotnetVersion }} && popd + - name: Docker Run + run: | + docker run -v $(pwd):/main ${{ matrix.vec.image }} /main/scripts/docker-script.sh ${{ matrix.vec.arch }} ${{ matrix.vec.config }} ${{ matrix.vec.tls }} ${{ matrix.vec.dotnetVersion }} + \ No newline at end of file diff --git a/scripts/docker-script.sh b/scripts/docker-script.sh new file mode 100755 index 0000000000..5a10c48048 --- /dev/null +++ b/scripts/docker-script.sh @@ -0,0 +1,84 @@ +#! /bin/bash + +if [[ $(id -u) -ne 0 ]]; +then + #Beware of how you compose the command + echo "This script must be run as root. Running the script with sudo..." + printf -v cmd_str '%q ' "$0" "$@" + exec sudo su -c "$cmd_str" + exit $? +fi + +cd /main +. /etc/os-release +OS=$(echo $ID | xargs) +VERSION=$(echo $VERSION_ID | xargs) + +echo "${OS} ${VERSION} is detected." + +install_dependencies_apt() +{ + apt-get update + if ! [ -f /usr/bin/dotnet ]; then + apt-get install -y wget gzip tar + fi + apt-get install -y ./artifacts/libmsquic_*.deb +} + +install_dependencies_rpm() +{ + yum update -y + if ! [ -f /usr/bin/dotnet ]; then + yum install -y wget gzip tar # .NET installing requirements + yum install -y libicu # .NET dependencies + fi + find -name "libmsquic*.rpm" -exec yum localinstall -y {} \; +} + +install_dependencies_opensuse() +{ + zypper ref + if ! [ -f /usr/bin/dotnet ]; then + zypper install -y wget gzip + fi + find -name "libmsquic*.rpm" -exec zypper install --allow-unsigned-rpm -y {} \; +} + +# .NET is installed already on Azure Linux and Mariner images +install_libmsquic_azure_linux() +{ + if ! [ -f /usr/bin/dotnet ]; then + tdnf install -y wget gzip tar + fi + tdnf update + find -name "libmsquic*.rpm" -exec tdnf install -y {} \; +} + +if [[ "$OS" == "ubuntu" ]] || [[ "$OS" == "debian" ]]; then + install_dependencies_apt +elif [[ "$OS" == "centos" ]] || [[ "$OS" == "almalinux" ]] || [[ "$OS" == "rhel" ]] || [[ "$OS" == "fedora" ]]; then + install_dependencies_rpm +elif [[ "$OS" == 'opensuse-leap' ]]; then + install_dependencies_opensuse +elif [[ "$OS" == 'azurelinux' ]] || [[ "$OS" == 'mariner' ]]; then + install_libmsquic_azure_linux +else + echo "Unsupported OS: ${OS}" + exit 1 +fi + +set -e +chmod +x artifacts/bin/linux/${1}_${2}_${3}/msquictest +artifacts/bin/linux/${1}_${2}_${3}/msquictest --gtest_filter=ParameterValidation.ValidateApi + +# Install .NET if it is not installed +if ! [ -f /usr/bin/dotnet ]; then + wget https://dot.net/v1/dotnet-install.sh -O dotnet-install.sh + chmod +x dotnet-install.sh + ./dotnet-install.sh --channel $4 --shared-runtime + + export PATH=$PATH:$HOME/.dotnet + export DOTNET_ROOT=$HOME/.dotnet +fi + +dotnet /main/src/cs/QuicSimpleTest/artifacts/net$4/QuicHello.net$4.dll diff --git a/src/cs/QuicSimpleTest/Program.cs b/src/cs/QuicSimpleTest/Program.cs new file mode 100644 index 0000000000..8b82467bb9 --- /dev/null +++ b/src/cs/QuicSimpleTest/Program.cs @@ -0,0 +1,6 @@ +using System.Net.Quic; + +#pragma warning disable CA1416 + +Console.WriteLine($"QuicConnection.IsSupported = {QuicConnection.IsSupported}"); +return QuicConnection.IsSupported ? 0 : 1; diff --git a/src/cs/QuicSimpleTest/QuicHello.net8.0.csproj b/src/cs/QuicSimpleTest/QuicHello.net8.0.csproj new file mode 100644 index 0000000000..7d0dd78f52 --- /dev/null +++ b/src/cs/QuicSimpleTest/QuicHello.net8.0.csproj @@ -0,0 +1,9 @@ + + + Exe + net8.0 + enable + enable + true + + diff --git a/src/cs/QuicSimpleTest/QuicHello.net9.0.csproj b/src/cs/QuicSimpleTest/QuicHello.net9.0.csproj new file mode 100644 index 0000000000..736783f421 --- /dev/null +++ b/src/cs/QuicSimpleTest/QuicHello.net9.0.csproj @@ -0,0 +1,9 @@ + + + Exe + net9.0 + enable + enable + true + +