Skip to content

Commit d0ee44e

Browse files
committed
Add .NET 9 to CI
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.
1 parent aae405c commit d0ee44e

File tree

3 files changed

+40
-4
lines changed

3 files changed

+40
-4
lines changed

.github/workflows/ci.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@ jobs:
2929
dotnet_version:
3030
- "6.0"
3131
- "8.0"
32+
include:
33+
- container_image: registry.fedoraproject.org/fedora:40
34+
dotnet_version: "9.0"
3235

3336
container:
3437
image: ${{ matrix.container_image }}
@@ -44,6 +47,10 @@ jobs:
4447
set -euo pipefail
4548
cat /etc/os-release
4649
if grep fedora /etc/os-release ; then
50+
if [[ ${{ matrix.dotnet_version }} == 9.* ]]; then
51+
dnf install 'dnf-command(copr)' -y
52+
dnf copr enable @dotnet-sig/dotnet-preview -y
53+
fi
4754
dnf install -y dotnet-sdk-${{ matrix.dotnet_version }}
4855
if [[ ! ${{ matrix.dotnet_version }} == *6* ]]; then
4956
dnf install -y \

template-test/test.sh

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ set -euo pipefail
77
IFS=$'\n\t'
88
set -x
99

10+
IFS='.-' read -ra VERSION_SPLIT <<< "$1"
11+
declare -a allTemplates
12+
major_version="${VERSION_SPLIT[0]}"
13+
1014
# The list of templates in each version of .NET that we want to test.
1115
# If additional templates are found via `dotnet new --list`, this test
1216
# will fail unless they are added here.
@@ -210,6 +214,7 @@ dotnet3Templates=(
210214
# format: <template> <action>
211215
# actions:
212216
# new - just create template ( using dotnet new <template> )
217+
# project,new - create a project, and then create this template ( using dotnet new <template> )
213218
# build - create template and run build on it ( dotnet build )
214219
# run - create template and run it ( dotnet run )
215220
# test - create template and run its tests ( dotnet test )
@@ -234,8 +239,10 @@ gitignore new
234239
globaljson new
235240
global.json new
236241
mstest test
242+
mstest-class project,new
237243
mvc build
238244
nunit test
245+
nunit-test new
239246
page new
240247
razor build
241248
razorclasslib build
@@ -249,6 +256,9 @@ webapp build
249256
worker build
250257
xunit test"
251258

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

286+
templateActions="template${major_version}Actions"
287+
templateActions="${!templateActions:-}"
288+
if [[ $templateActions != "" ]]; then
289+
readarray -t templateLines <<< "${templateActions}"
290+
for line in "${templateLines[@]}"; do
291+
templateName="${line%% *}"
292+
action="${line##* }"
293+
knownTemplateActions["$templateName"]="$action"
294+
done
295+
fi
296+
276297
dotnet help > /dev/null 2>/dev/null
277298

278299
dotnet new --list
@@ -302,9 +323,6 @@ for template in "${allAutoTemplates[@]}"; do
302323
fi
303324
done
304325

305-
IFS='.-' read -ra VERSION_SPLIT <<< "$1"
306-
declare -a allTemplates
307-
major_version="${VERSION_SPLIT[0]}"
308326
template_names="dotnet${major_version}Templates[@]"
309327
allTemplates=( "${!template_names}" )
310328
if [[ -z "$allTemplates" ]] ; then
@@ -359,6 +377,11 @@ function testTemplate {
359377
return
360378
fi
361379

380+
if [[ ${action} = project,* ]] ; then
381+
dotnet new console 2>&1 | tee "${templateName}.log"
382+
action=$(echo "${action}" | sed -E "s|project,||")
383+
fi
384+
362385
dotnet new "${templateName}" 2>&1 | tee "${templateName}.log"
363386
if grep -i failed "${templateName}.log"; then
364387
echo "error: ${templateName} failed."

tools-in-path/test.sh

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,12 @@ else
2020
fi
2121

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

2531
dotnet ef --version

0 commit comments

Comments
 (0)