Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade to .NET 9 #964

Merged
merged 8 commits into from
Nov 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions .config/dotnet-tools.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,18 @@
"isRoot": true,
"tools": {
"strawberryshake.tools": {
"version": "13.7.0",
"version": "14.1.0",
"commands": [
"dotnet-graphql"
]
],
"rollForward": false
},
"dotnet-ef": {
"version": "8.0.0",
"version": "9.0.0",
"commands": [
"dotnet-ef"
]
],
"rollForward": false
}
}
}
125 changes: 68 additions & 57 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,77 +3,88 @@
#
# You may wish to alter this file to override the set of languages analyzed,
# or to provide custom queries or build logic.
name: "CodeQL"
#

name: "CodeQL Advanced"

on:
push:
branches: [vnext]
branches: [ "vnext" ]
pull_request:
# The branches below must be a subset of the branches above
branches: [vnext]
branches: [ "vnext" ]
schedule:
- cron: '0 19 * * 3'
- cron: '36 10 * * 0'

jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
name: Analyze (${{ matrix.language }})
# Runner size impacts CodeQL analysis time. To learn more, please see:
# - https://gh.io/recommended-hardware-resources-for-running-codeql
# - https://gh.io/supported-runners-and-hardware-resources
# - https://gh.io/using-larger-runners (GitHub.com only)
# Consider using larger runners or machines with greater resources for possible analysis time improvements.
runs-on: ${{ (matrix.language == 'swift' && 'macos-latest') || 'ubuntu-latest' }}
permissions:
# required for all workflows
security-events: write

# required to fetch internal or private CodeQL packs
packages: read

# only required for workflows in private repositories
actions: read
contents: read

strategy:
fail-fast: false
matrix:
# Override automatic language detection by changing the below list
# Supported options are ['csharp', 'cpp', 'go', 'java', 'javascript', 'python']
language: ['csharp']
# Learn more...
# https://docs.github.com/en/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#overriding-automatic-language-detection
include:
- language: csharp
build-mode: manual
# CodeQL supports the following values keywords for 'language': 'c-cpp', 'csharp', 'go', 'java-kotlin', 'javascript-typescript', 'python', 'ruby', 'swift'
# Use `c-cpp` to analyze code written in C, C++ or both
# Use 'java-kotlin' to analyze code written in Java, Kotlin or both
# Use 'javascript-typescript' to analyze code written in JavaScript, TypeScript or both
# To learn more about changing the languages that are analyzed or customizing the build mode for your analysis,
# see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/customizing-your-advanced-setup-for-code-scanning.
# If you are analyzing a compiled language, you can modify the 'build-mode' for that language to customize how
# your codebase is analyzed, see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/codeql-code-scanning-for-compiled-languages

steps:
- name: Update dotnet
uses: actions/setup-dotnet@v1
with:
dotnet-version: '8.0.x'

- name: Checkout repository
uses: actions/checkout@v2
with:
# We must fetch at least the immediate parents so that if this is
# a pull request then we can checkout the head.
fetch-depth: 2

# If this run was triggered by a pull request event, then checkout
# the head of the pull request instead of the merge commit.
- run: git checkout HEAD^2
if: ${{ github.event_name == 'pull_request' }}

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# queries: ./path/to/local/query, your-org/your-repo/queries@main

# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
#- name: Autobuild
# uses: github/codeql-action/autobuild@v1

- name: Build
run: dotnet build

# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl
- name: Update dotnet
uses: actions/setup-dotnet@v4
with:
dotnet-version: |
8.0.x
9.0.x

# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
# and modify them (or add more) to build your code if your project
# uses a compiled language
- name: Checkout repository
uses: actions/checkout@v4

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v3
with:
languages: ${{ matrix.language }}
build-mode: ${{ matrix.build-mode }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.

# For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
# queries: security-extended,security-and-quality

#- run: |
# make bootstrap
# make release
# If the analyze step fails for one of the languages you are analyzing with
# "We were unable to automatically build your code", modify the matrix above
# to set the build mode to "manual" for that language. Then modify this step
# to build your code.
# ℹ️ Command-line programs to run using the OS shell.
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
- if: matrix.build-mode == 'manual'
shell: bash
run: dotnet build

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
with:
category: "/language:${{matrix.language}}"
30 changes: 18 additions & 12 deletions .github/workflows/dotnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,13 @@ jobs:
runs-on: ubuntu-latest
name: "Run Tests"
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: update dotnet core sdk
uses: actions/setup-dotnet@v1
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
dotnet-version: |
8.0.x
9.0.x
- name: dotnet restore (first try)
run: dotnet restore --ignore-failed-sources
- name: dotnet restore (second try)
Expand All @@ -31,11 +33,13 @@ jobs:
runs-on: ubuntu-latest
name: "Build Release"
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: update dotnet core sdk
uses: actions/setup-dotnet@v1
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
dotnet-version: |
8.0.x
9.0.x
- name: dotnet restore (first try)
run: dotnet restore --ignore-failed-sources
- name: dotnet restore (second try)
Expand All @@ -62,15 +66,17 @@ jobs:
name: "Build Docker image"
if: (github.ref == 'refs/heads/master') && (needs.ConfigTest.outputs.docker-username == 'true')
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: "clean build artifacts"
run: git clean -dfx
- name: update dotnet core sdk
uses: actions/setup-dotnet@v1
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
dotnet-version: |
8.0.x
9.0.x
- name: dotnet restore (first try)
run: dotnet restore --ignore-failed-sources
- name: dotnet restore (second try)
Expand All @@ -80,9 +86,9 @@ jobs:
- name: dotnet build Release
run: dotnet build --no-restore --configuration Release
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
uses: docker/setup-buildx-action@v3
- name: Login to DockerHub
uses: docker/login-action@v1
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
Expand All @@ -91,7 +97,7 @@ jobs:
NUM: ${{ github.run_number }}
run: echo "GITHUB_RUN_NUMBER_WITH_OFFSET=$(($NUM+1050))" >> $GITHUB_ENV
- name: Build and push
uses: docker/build-push-action@v2
uses: docker/build-push-action@v6
with:
context: .
push: 'true'
Expand Down
5 changes: 0 additions & 5 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,3 @@ Recommended development setup
See [readme](README.md) for detailed requirement and recommended IDE setup.

**Note** that Docker image is currently experimental and wasn't tested in any way.

IntelliCode Model Link
======================
You can use [this link](https://prod.intellicode.vsengsaas.visualstudio.com/get?m=7127523297134326920E959DF01AF224) for the pre-trained IntelliCode model based on this project.
In Visual Code 2019.1 or later, you can do this by navigatin `View` → `Other Windows` → `IntelliCode Model Management` → `Add Model`.
34 changes: 17 additions & 17 deletions Clients/CirrusCiClient/CirrusCi.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,27 +37,27 @@ static CirrusCi()
queryResult.EnsureNoErrors();
if (queryResult.Data?.OwnerRepository?.Builds?.Edges is {Count: > 0} edgeList)
{
var node = edgeList.LastOrDefault(e => e?.Node?.ChangeIdInRepo == commit)?.Node;
var node = edgeList.LastOrDefault(e => e.Node.ChangeIdInRepo == commit)?.Node;
if (node is null)
return null;

var winTask = node.Tasks?.FirstOrDefault(t => t?.Name.Contains("Windows") ?? false);
var winArtifact = winTask?.Artifacts?
.Where(a => a?.Files is {Count: >0})
.SelectMany(a => a!.Files!)
.FirstOrDefault(f => f?.Path.EndsWith(".7z") ?? false);
var winTask = node.Tasks.FirstOrDefault(t => t.Name.Contains("Windows"));
var winArtifact = winTask?.Artifacts
.Where(a => a.Files is {Count: >0})
.SelectMany(a => a.Files)
.FirstOrDefault(f => f.Path.EndsWith(".7z"));

var linTask = node.Tasks?.FirstOrDefault(t => t is {} lt && lt.Name.Contains("Linux") && lt.Name.Contains("GCC"));
var linArtifact = linTask?.Artifacts?
.Where(a => a?.Files is {Count: >0})
.SelectMany(a => a!.Files!)
.FirstOrDefault(a => a?.Path.EndsWith(".AppImage") ?? false);
var linTask = node.Tasks.FirstOrDefault(t => t is {} lt && lt.Name.Contains("Linux") && lt.Name.Contains("GCC"));
var linArtifact = linTask?.Artifacts
.Where(a => a.Files is {Count: >0})
.SelectMany(a => a.Files)
.FirstOrDefault(a => a.Path.EndsWith(".AppImage"));

var macTask = node.Tasks?.FirstOrDefault(t => t?.Name.Contains("macOS") ?? false);
var macArtifact = macTask?.Artifacts?
.Where(a => a?.Files is { Count: > 0 })
.SelectMany(a => a!.Files!)
.FirstOrDefault(a => a?.Path.EndsWith(".dmg") ?? false);
var macTask = node.Tasks.FirstOrDefault(t => t.Name.Contains("macOS"));
var macArtifact = macTask?.Artifacts
.Where(a => a.Files is { Count: > 0 })
.SelectMany(a => a.Files)
.FirstOrDefault(a => a.Path.EndsWith(".dmg"));

var startTime = FromTimestamp(node.BuildCreatedTimestamp);
var finishTime = GetFinishTime(node);
Expand Down Expand Up @@ -142,7 +142,7 @@ select ts
? FromTimestamp(finalTimes.Max()!.Value)
: node.ClockDurationInSeconds > 0
? FromTimestamp(node.BuildCreatedTimestamp).AddSeconds(node.ClockDurationInSeconds.Value)
: (DateTime?)null;
: null;

[return: NotNullIfNotNull(nameof(DateTime))]
private static string? ToTimestamp(this DateTime? dateTime) => dateTime.HasValue ? (dateTime.Value.ToUniversalTime() - DateTime.UnixEpoch).TotalMilliseconds.ToString("0") : null;
Expand Down
10 changes: 5 additions & 5 deletions Clients/CirrusCiClient/CirrusCiClient.csproj
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
<Nullable>enable</Nullable>
<EmitCompilerGeneratedFiles>false</EmitCompilerGeneratedFiles>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\CompatApiClient\CompatApiClient.csproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Caching.Memory" Version="8.0.1" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="8.0.1" />
<PackageReference Include="Microsoft.Extensions.Http" Version="8.0.1" />
<PackageReference Include="StrawberryShake.Server" Version="13.9.14" />
<PackageReference Include="Microsoft.Extensions.Caching.Memory" Version="9.0.0" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="9.0.0" />
<PackageReference Include="Microsoft.Extensions.Http" Version="9.0.0" />
<PackageReference Include="StrawberryShake.Server" Version="14.1.0" />
</ItemGroup>
</Project>
Loading