Skip to content

Commit

Permalink
Integrate Cross Platform Linux Packaging Tester (#4466)
Browse files Browse the repository at this point in the history
  • Loading branch information
liveans committed Aug 18, 2024
1 parent 69b589a commit ebc1248
Show file tree
Hide file tree
Showing 5 changed files with 174 additions and 0 deletions.
66 changes: 66 additions & 0 deletions .github/workflows/package-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
84 changes: 84 additions & 0 deletions scripts/docker-script.sh
Original file line number Diff line number Diff line change
@@ -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
6 changes: 6 additions & 0 deletions src/cs/QuicSimpleTest/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
using System.Net.Quic;

#pragma warning disable CA1416

Console.WriteLine($"QuicConnection.IsSupported = {QuicConnection.IsSupported}");
return QuicConnection.IsSupported ? 0 : 1;
9 changes: 9 additions & 0 deletions src/cs/QuicSimpleTest/QuicHello.net8.0.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<EnablePreviewFeatures>true</EnablePreviewFeatures>
</PropertyGroup>
</Project>
9 changes: 9 additions & 0 deletions src/cs/QuicSimpleTest/QuicHello.net9.0.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net9.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<EnablePreviewFeatures>true</EnablePreviewFeatures>
</PropertyGroup>
</Project>

0 comments on commit ebc1248

Please sign in to comment.