Skip to content
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
96 changes: 50 additions & 46 deletions .github/workflows/analyse.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,50 +10,54 @@ jobs:
name: Build and analyze
runs-on: windows-latest
steps:
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: 17
distribution: 'zulu' # Alternative distribution options are available.
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: 17
distribution: 'zulu' # Alternative distribution options are available.

- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 9.0.x

- uses: actions/checkout@v3
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis

- name: Cache SonarCloud packages
uses: actions/cache@v3
with:
path: ~\sonar\cache
key: ${{ runner.os }}-sonar
restore-keys: ${{ runner.os }}-sonar

- name: Cache SonarCloud scanner
id: cache-sonar-scanner
uses: actions/cache@v3
with:
path: .\.sonar\scanner
key: ${{ runner.os }}-sonar-scanner
restore-keys: ${{ runner.os }}-sonar-scanner

- name: Install SonarCloud scanner
if: steps.cache-sonar-scanner.outputs.cache-hit != 'true'
shell: powershell
run: |
New-Item -Path .\.sonar\scanner -ItemType Directory
dotnet tool update dotnet-sonarscanner --tool-path .\.sonar\scanner

- name: Build and analyze
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
shell: powershell
run: |
.\.sonar\scanner\dotnet-sonarscanner begin /k:"Top2000app_features" /o:"top2000app" /d:sonar.token="${{ secrets.SONAR_TOKEN }}" /d:sonar.host.url="https://sonarcloud.io"
dotnet build
dotnet test --no-build --verbosity normal
.\.sonar\scanner\dotnet-sonarscanner end /d:sonar.token="${{ secrets.SONAR_TOKEN }}"
- uses: actions/checkout@v3
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis

- name: Cache SonarCloud packages
uses: actions/cache@v3
with:
path: ~\sonar\cache
key: ${{ runner.os }}-sonar
restore-keys: ${{ runner.os }}-sonar

- name: Cache SonarCloud scanner
id: cache-sonar-scanner
uses: actions/cache@v3
with:
path: .\.sonar\scanner
key: ${{ runner.os }}-sonar-scanner
restore-keys: ${{ runner.os }}-sonar-scanner

- name: Install SonarCloud scanner
if: steps.cache-sonar-scanner.outputs.cache-hit != 'true'
shell: powershell
run: |
New-Item -Path .\.sonar\scanner -ItemType Directory
dotnet tool update dotnet-sonarscanner --tool-path .\.sonar\scanner

- name: Install dotnet coverage
shell: powershell
run: dotnet tool install dotnet-coverage --global

- name: Build and analyze
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
shell: powershell
run: |
.\.sonar\scanner\dotnet-sonarscanner begin /k:"Top2000app_features" /o:"top2000app" /d:sonar.token="${{ secrets.SONAR_TOKEN }}" /d:sonar.host.url="https://sonarcloud.io" /d:sonar.cs.vscoveragexml.reportsPaths=coverage.xml
dotnet build
dotnet-coverage collect "dotnet test" -f xml -o "coverage.xml"
.\.sonar\scanner\dotnet-sonarscanner end /d:sonar.token="${{ secrets.SONAR_TOKEN }}"
48 changes: 48 additions & 0 deletions .github/workflows/dotnet.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: .NET

permissions:
contents: read
pages: write
id-token: write

on:
push:
branches:
- main
workflow_dispatch:

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 9.0.x

- name: Restore dependencies
run: dotnet restore

- name: Build
run: dotnet build --no-restore

- name: Test
run: dotnet test --no-build --verbosity normal

- name: Pack
run: dotnet pack -o '${{github.workspace}}/nupkg'

- name: Publish App disk artifact
uses: actions/upload-artifact@v3
with:
name: Code
path: nupkg
if: github.event_name != 'pull_request'

- name: Publish Nuget
run: dotnet nuget push '${{github.workspace}}/nupkg/*.nupkg' -k ${{ secrets.NUGET_API_KEY }} -s https://api.nuget.org/v3/index.json --skip-duplicate
if: github.event_name != 'pull_request'

1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -396,3 +396,4 @@ FodyWeavers.xsd

# JetBrains Rider
*.sln.iml
.idea/*
7 changes: 4 additions & 3 deletions src/SQLite/Top2000.Features.SQLite/ConfigureServices.cs
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
using Microsoft.Extensions.DependencyInjection;
using Top2000.Data.ClientDatabase;
using Top2000.Features.Searching;
using Top2000.Features.SQLite.AllListingsOfEdition;

namespace Top2000.Features.SQLite;

public static class ConfigureServices
{
public static IServiceCollection AddFeaturesWithSQLite(this IServiceCollection services)
public static IServiceCollection AddTop2000Features(this IServiceCollection services, Action<Top2000ServiceBuilder>? configure = null)
{
return services
.AddTop2000(configure)
.AddMediatR(config =>
{
config.RegisterServicesFromAssemblyContaining<TrackCountHolder>();
Expand All @@ -19,7 +21,6 @@ public static IServiceCollection AddFeaturesWithSQLite(this IServiceCollection s
.AddSingleton<ISort, SortByRecordedYear>()
.AddSingleton<IGroup, GroupByNothing>()
.AddSingleton<IGroup, GroupByArtist>()
.AddSingleton<IGroup, GroupByRecordedYear>()
;
.AddSingleton<IGroup, GroupByRecordedYear>();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,21 +23,21 @@ public async Task<List<IGrouping<string, SearchedTrack>>> Handle(SearchTrackRequ
{
var sql = "SELECT Id, Title, Artist, RecordedYear, Listing.Position AS Position " +
"FROM Track " +
"LEFT JOIN Listing ON Track.Id = Listing.TrackId AND Listing.Edition = 2023 " +
"LEFT JOIN Listing ON Track.Id = Listing.TrackId AND Listing.Edition = ? " +
"WHERE RecordedYear = ?" +
"LIMIT 100";

results = await connection.QueryAsync<SearchedTrack>(sql, year);
results = await connection.QueryAsync<SearchedTrack>(sql, request.LatestYear, year);
}
else
{
var sql = "SELECT Id, Title, Artist, RecordedYear, Listing.Position AS Position " +
"FROM Track " +
"LEFT JOIN Listing ON Track.Id = Listing.TrackId AND Listing.Edition = 2023 " +
"WHERE (Title LIKE ?) OR (Artist LIKE ?)" +
"LEFT JOIN Listing ON Track.Id = Listing.TrackId AND Listing.Edition = ? " +
"WHERE (Title LIKE ?) OR (Artist LIKE ?) OR (SearchTitle LIKE ?) OR (SearchArtist LIKE ?)" +
"LIMIT 100";

results = await connection.QueryAsync<SearchedTrack>(sql, $"%{request.QueryString}%", $"%{request.QueryString}%");
results = await connection.QueryAsync<SearchedTrack>(sql,request.LatestYear, $"%{request.QueryString}%", $"%{request.QueryString}%", $"%{request.QueryString}%", $"%{request.QueryString}%");
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>

<IsPackable>true</IsPackable>
<Deterministic>true</Deterministic>
<PackageId>RickNeeftDevelopment.Top2000App.Features.SQLite</PackageId>
<Description>Top 2000 Features package using the SQLite package </Description>
<Description>Top 2000 Features package using the SQLite database</Description>
<Copyright>Copyright (c) Rick Neeft Development 2024</Copyright>
<PackageProjectUrl>https://github.com/Top2000app/data</PackageProjectUrl>
<Version>1.1.1</Version>
<Version>2.0.0</Version>
<Authors>Rick Neeft</Authors>
<Product>Top2000App</Product>
<PackageIcon>nugeticon.png</PackageIcon>
Expand All @@ -28,7 +28,7 @@

<ItemGroup>
<PackageReference Include="MediatR" Version="12.4.1" />
<PackageReference Include="RickNeeftDevelopment.Top2000App.Data" Version="1.3.1" />
<PackageReference Include="RickNeeftDevelopment.Top2000App.Data" Version="2.0.0" />
<PackageReference Include="RickNeeftDevelopment.Top2000App.Features" Version="1.1.0" />
</ItemGroup>

Expand Down
2 changes: 1 addition & 1 deletion src/Top2000.Features/Top2000.Features.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>

Expand All @@ -14,11 +14,11 @@
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="FluentAssertions" Version="6.12.1" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.11.1" />
<PackageReference Include="FluentAssertions" Version="6.12.2" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.12.0" />
<PackageReference Include="Moq" Version="4.20.72" />
<PackageReference Include="MSTest.TestAdapter" Version="3.6.1" />
<PackageReference Include="MSTest.TestFramework" Version="3.6.1" />
<PackageReference Include="MSTest.TestAdapter" Version="3.6.3" />
<PackageReference Include="MSTest.TestFramework" Version="3.6.3" />
</ItemGroup>

<ItemGroup>
Expand Down
10 changes: 7 additions & 3 deletions tests/Top2000.Features.Specs/App.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,13 @@ public static class App
public static void BeforeTestRun()
{
var services = new ServiceCollection()
.AddClientDatabase(new DirectoryInfo(Directory.GetCurrentDirectory()), "top2000_unittest.db")
.AddFeaturesWithSQLite()
;
.AddTop2000Features(builder =>
{
builder
.DatabaseDirectory(Directory.GetCurrentDirectory())
.DatabaseName("top2000_unittest.db")
.EnableOnlineUpdates();
});

ServiceProvider = services.BuildServiceProvider();
}
Expand Down
20 changes: 11 additions & 9 deletions tests/Top2000.Features.Specs/Features/AllEditions.feature.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading