Skip to content

Commit

Permalink
Add .NET 9 to CI
Browse files Browse the repository at this point in the history
Test the in-development .NET 9 RPM as a way to find out how well
dotnet-regular-tests are working against .NET 9.

Also update templates-test to support a new set of templates that
require an existing project before `dotnet new $template` will work.
This includes a template new to .NET 9 (mstest-class) but also a
template that didn't behave this way in .NET 8 (nunit-test).

Also update tools-in-path to be more flexible with versions during
preview/rc release phase.

Also fix distribution-packages to find/use the ASP.NET Core version
correctly.
  • Loading branch information
omajid committed Jun 21, 2024
1 parent aae405c commit bbfd8e5
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 5 deletions.
7 changes: 7 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ jobs:
dotnet_version:
- "6.0"
- "8.0"
include:
- container_image: registry.fedoraproject.org/fedora:40
dotnet_version: "9.0"

container:
image: ${{ matrix.container_image }}
Expand All @@ -44,6 +47,10 @@ jobs:
set -euo pipefail
cat /etc/os-release
if grep fedora /etc/os-release ; then
if [[ ${{ matrix.dotnet_version }} == 9.* ]]; then
dnf install 'dnf-command(copr)' -y
dnf copr enable @dotnet-sig/dotnet-preview -y
fi
dnf install -y dotnet-sdk-${{ matrix.dotnet_version }}
if [[ ! ${{ matrix.dotnet_version }} == *6* ]]; then
dnf install -y \
Expand Down
4 changes: 3 additions & 1 deletion distribution-packages/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,14 @@ set -x

sdk_version="$(dotnet --version)"
runtime_version="$(dotnet --list-runtimes | grep Microsoft.NETCore.App | awk '{ print $2 }')"
aspnetcore_runtime_version="$(dotnet --list-runtimes | grep Microsoft.AspNetCore.App | awk '{ print $2 }')"
runtime_id=$(../runtime-id)
# This might be the final/only netstandard version from now on
netstandard_version=2.1

./test-standard-packages \
"${runtime_id}" \
"${runtime_version}" "${runtime_version}" \
"${runtime_version}" \
"${aspnetcore_runtime_version}" \
"${sdk_version}" \
"${netstandard_version}"
29 changes: 26 additions & 3 deletions template-test/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ set -euo pipefail
IFS=$'\n\t'
set -x

IFS='.-' read -ra VERSION_SPLIT <<< "$1"
declare -a allTemplates
major_version="${VERSION_SPLIT[0]}"

# The list of templates in each version of .NET that we want to test.
# If additional templates are found via `dotnet new --list`, this test
# will fail unless they are added here.
Expand Down Expand Up @@ -210,6 +214,7 @@ dotnet3Templates=(
# format: <template> <action>
# actions:
# new - just create template ( using dotnet new <template> )
# project,new - create a project, and then create this template ( using dotnet new <template> )
# build - create template and run build on it ( dotnet build )
# run - create template and run it ( dotnet run )
# test - create template and run its tests ( dotnet test )
Expand All @@ -234,8 +239,10 @@ gitignore new
globaljson new
global.json new
mstest test
mstest-class project,new
mvc build
nunit test
nunit-test new
page new
razor build
razorclasslib build
Expand All @@ -249,6 +256,9 @@ webapp build
worker build
xunit test"

template9Actions=\
"nunit-test project,new"

# Templates that can be ignored. They may be present in the dotnet new
# --list output but are safe to ignore. We we don't want to test these
# because they are known to not work on the platforms we care about.
Expand All @@ -273,6 +283,17 @@ for line in "${templateLines[@]}"; do
knownTemplateActions["$templateName"]="$action"
done

templateActions="template${major_version}Actions"
templateActions="${!templateActions:-}"
if [[ $templateActions != "" ]]; then
readarray -t templateLines <<< "${templateActions}"
for line in "${templateLines[@]}"; do
templateName="${line%% *}"
action="${line##* }"
knownTemplateActions["$templateName"]="$action"
done
fi

dotnet help > /dev/null 2>/dev/null

dotnet new --list
Expand Down Expand Up @@ -302,9 +323,6 @@ for template in "${allAutoTemplates[@]}"; do
fi
done

IFS='.-' read -ra VERSION_SPLIT <<< "$1"
declare -a allTemplates
major_version="${VERSION_SPLIT[0]}"
template_names="dotnet${major_version}Templates[@]"
allTemplates=( "${!template_names}" )
if [[ -z "$allTemplates" ]] ; then
Expand Down Expand Up @@ -359,6 +377,11 @@ function testTemplate {
return
fi

if [[ ${action} = project,* ]] ; then
dotnet new console 2>&1 | tee "${templateName}.log"
action=$(echo "${action}" | sed -E "s|project,||")
fi

dotnet new "${templateName}" 2>&1 | tee "${templateName}.log"
if grep -i failed "${templateName}.log"; then
echo "error: ${templateName} failed."
Expand Down
8 changes: 7 additions & 1 deletion tools-in-path/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,12 @@ else
fi

framework_dir=$(../dotnet-directory --framework "$1")
dotnet tool update -g dotnet-ef --version "${framework_dir#*App/}.*"
runtime_version=${framework_dir#*App/}
if [[ $runtime_version = *preview* ]] || [[ $runtime_version = *rc* ]]; then
# delete the last digit (which is the build version)
runtime_version=$(echo $runtime_version | sed -E 's|.[[:digit:]]+$||')
fi
tool_version="$runtime_version.*"
dotnet tool update -g dotnet-ef --version "$tool_version"

dotnet ef --version

0 comments on commit bbfd8e5

Please sign in to comment.