Skip to content

Commit

Permalink
feat: add .NET 9 Support (#914)
Browse files Browse the repository at this point in the history
* feat: add .NET 9 Support

Signed-off-by: Nathan Mittelette <[email protected]>

* chore: remove .NET 6/7 support

---------

Signed-off-by: Nathan Mittelette <[email protected]>
Signed-off-by: Michael Tsfoni <[email protected]>
Co-authored-by: Michael Tsfoni <[email protected]>
  • Loading branch information
nathan-mittelette and mtsfoni authored Feb 1, 2025
1 parent 1825b64 commit 76fc687
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 26 deletions.
2 changes: 1 addition & 1 deletion .devcontainer/Ubuntu22.04/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ RUN apt-get install -y --no-install-recommends wget=2.0.1
RUN apt-get install -y --no-install-recommends apt-transport-https=2.5.6
RUN curl -o ./packages-microsoft-prod.deb https://packages.microsoft.com/config/ubuntu/22.04/packages-microsoft-prod.deb
RUN dpkg -i packages-microsoft-prod.deb
RUN apt-get install -y --no-install-recommends dotnet-sdk-8.0=8.0
RUN apt-get install -y --no-install-recommends dotnet-sdk-9.0=9.0
RUN rm -rf /var/lib/apt/lists/*
18 changes: 7 additions & 11 deletions .github/workflows/dotnetcore.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
uses: actions/setup-dotnet@v4
with:
dotnet-version: |
8.x
9.x
- name: Build
run: dotnet build /WarnAsError

Expand All @@ -43,23 +43,19 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
framework: ['net6.0','net7.0', 'net8.0']
framework: ['net8.0', 'net9.0']
timeout-minutes: 30

steps:
- uses: actions/[email protected]
- name: Setup dotnet 9
uses: actions/[email protected]
with:
dotnet-version: '9.x'
- name: Setup dotnet 8
uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.x'
- name: Setup dotnet 7
uses: actions/setup-dotnet@v4
with:
dotnet-version: '7.x'
- name: Setup dotnet 6
uses: actions/setup-dotnet@v4
with:
dotnet-version: '6.x'
- name: Tests
run: dotnet test --framework ${{ matrix.framework }} --collect:"XPlat Code Coverage;Format=cobertura" --results-directory "TestResults"
# see https://github.com/danielpalme/ReportGenerator/blob/main/.github/workflows/ci.yml
Expand All @@ -80,7 +76,7 @@ jobs:
run: cat ./coveragereport/SummaryGithub.md >> $GITHUB_STEP_SUMMARY
shell: bash
- name: Upload coverage report artifact
if: ${{ matrix.os == 'ubuntu-latest' && matrix.framework == 'net8.0' }}
if: ${{ matrix.os == 'ubuntu-latest' && matrix.framework == 'net9.0' }}
uses: actions/upload-artifact@v4
with:
name: CoverageReport_${{ matrix.framework }}_${{ matrix.os }}
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@ jobs:
uses: actions/setup-dotnet@v4
with:
dotnet-version: |
8.x
9.x
# The tests should have already been run during the PR workflow, so this is really just a sanity check
- name: Tests
run: dotnet test --framework net8.0
run: dotnet test --framework net9.0

# Build and package everything, including the Docker image
- name: Package release
Expand Down Expand Up @@ -66,8 +66,8 @@ jobs:

# Generate the JSON with the docker container as additional smoke test
- name: Generate JSON SBOM
run: docker run --rm -v ${GITHUB_WORKSPACE}:/usr/src/project cyclonedx/cyclonedx-dotnet:${{ steps.package_release.outputs.version }} /usr/src/project/CycloneDX.sln -j -o /usr/src/project
run: docker run --rm -v ${GITHUB_WORKSPACE}:/usr/src/project cyclonedx/cyclonedx-dotnet:${{ steps.package_release.outputs.version }} /usr/src/project/CycloneDX.sln -j -o /usr/src/project

- name: Publish package to NuGet
env:
NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }}
Expand Down
5 changes: 2 additions & 3 deletions .gitpod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,11 @@ tasks:
wget --output-document="$DOTNET_ROOT/dotnet-install.sh" https://dot.net/v1/dotnet-install.sh
chmod +x "$DOTNET_ROOT/dotnet-install.sh"
"$DOTNET_ROOT/dotnet-install.sh" --channel 2.1 --install-dir "$DOTNET_ROOT"
"$DOTNET_ROOT/dotnet-install.sh" --channel 6.0 --install-dir "$DOTNET_ROOT"
"$DOTNET_ROOT/dotnet-install.sh" --channel 7.0 --install-dir "$DOTNET_ROOT"
"$DOTNET_ROOT/dotnet-install.sh" --channel 8.0 --install-dir "$DOTNET_ROOT"
"$DOTNET_ROOT/dotnet-install.sh" --channel 9.0 --install-dir "$DOTNET_ROOT"
dotnet tool install --global dotnet-reportgenerator-globaltool
dotnet restore
vscode:
extensions:
- muhammad-sammy.csharp
- muhammad-sammy.csharp
2 changes: 1 addition & 1 deletion CycloneDX.Tests/CycloneDX.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<IsTestProject>true</IsTestProject>
<IsPackable>false</IsPackable>
<TargetFrameworks>net8.0;net7.0;net6.0</TargetFrameworks>
<TargetFrameworks>net9.0;net8.0</TargetFrameworks>
<LangVersion>latest</LangVersion>
</PropertyGroup>

Expand Down
4 changes: 1 addition & 3 deletions CycloneDX/CycloneDX.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<ToolCommandName>dotnet-CycloneDX</ToolCommandName>
<_SkipUpgradeNetAnalyzersNuGetWarning>true</_SkipUpgradeNetAnalyzersNuGetWarning>
<TargetFrameworks>net8.0;net7.0;net6.0</TargetFrameworks>

<!-- Always run on the latest runtime installed. -->
<TargetFrameworks>net9.0;net8.0</TargetFrameworks>
<RollForward>Major</RollForward>
</PropertyGroup>

Expand Down
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,16 @@
The CycloneDX module for .NET creates a valid CycloneDX bill-of-material document containing an aggregate of all project dependencies. CycloneDX is a lightweight BOM specification that is easily created, human readable, and simple to parse.

This module runs on
* .NET 6.0
* .NET 7.0
* .NET 8.0
* .NET 9.0

This module no longer runs on

* .NET Core 2.1
* .NET Core 3.1
* .NET 5.0
* .NET 6.0
* .NET 7.0
* see https://dotnet.microsoft.com/en-us/platform/support/policy/dotnet-core for more information

## Usage
Expand Down
2 changes: 1 addition & 1 deletion semver.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
4.2.0
4.2.0

0 comments on commit 76fc687

Please sign in to comment.