Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
tsutomi committed Feb 21, 2024
2 parents a3fa119 + 59486e1 commit 6484e76
Show file tree
Hide file tree
Showing 26 changed files with 195 additions and 75 deletions.
56 changes: 38 additions & 18 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,51 +1,71 @@
name: Repository CI/CD

permissions:
contents: read
packages: write

on:
push:
branches: [ "main" ]

jobs:
build:

runs-on: ubuntu-latest
strategy:
matrix:
dotnet: [ '6.0.x', '7.0.x', '8.0.x' ]

steps:
- uses: actions/checkout@v3

- name: Setup .NET Framework
uses: actions/setup-dotnet@v3
- uses: actions/checkout@v4

- name: Emit .NET 6.0 Framework Version
if: matrix.dotnet == '6.0.x'
run: echo "DOTNET_FX_VERSION=net6.0" >> $GITHUB_ENV

- name: Emit .NET 7.0 Framework Version
if: matrix.dotnet == '7.0.x'
run: echo "DOTNET_FX_VERSION=net7.0" >> $GITHUB_ENV

- name: Emit .NET 8.0 Framework Version
if: matrix.dotnet == '8.0.x'
run: echo "DOTNET_FX_VERSION=net8.0" >> $GITHUB_ENV

- name: Setup .NET ${{ matrix.dotnet }} Framework
uses: actions/setup-dotnet@v4
with:
dotnet-version: |
6.0.x
7.0.x
dotnet-version: ${{ matrix.dotnet }}

- name: Install SQLite Spatial
run: sudo apt-get install -y libsqlite3-mod-spatialite

- name: Add Deveel GitHub NuGet Source
run: dotnet nuget add source "https://nuget.pkg.github.com/deveel/index.json" -n "Deveel GitHub" -u ${{ secrets.DEVEEL_NUGET_USER }} -p ${{ secrets.DEVEEL_NUGET_TOKEN }} --store-password-in-clear-text
# - name: Add Deveel GitHub NuGet Source
# run: dotnet nuget add source "https://nuget.pkg.github.com/deveel/index.json" -n "Deveel GitHub" -u ${{ secrets.DEVEEL_NUGET_USER }} -p ${{ secrets.DEVEEL_NUGET_TOKEN }} --store-password-in-clear-text

- name: Restore dependencies
run: dotnet restore

- name: Build
run: dotnet build --no-restore --version-suffix $GITHUB_RUN_ID -c Release
run: dotnet build --no-restore --version-suffix $GITHUB_RUN_ID -c Release -f ${{ env.DOTNET_FX_VERSION }}

- name: Test
run: dotnet test --no-build --verbosity normal -c Release /p:CollectCoverage=true /p:CoverletOutputFormat=opencover
run: dotnet test --no-build --verbosity normal -c Release -f ${{ env.DOTNET_FX_VERSION }} /p:CollectCoverage=true /p:CoverletOutputFormat=opencover

- name: Collect to Codecov
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
# - name: Collect to Codecov
# uses: codecov/codecov-action@v3
# with:
# token: ${{ secrets.CODECOV_TOKEN }}

pack:
needs: build
runs-on: ubuntu-latest
steps:
- name: Pack NuGet
run: dotnet pack --version-suffix $GITHUB_RUN_ID -c Release --no-build --no-restore --include-symbols -o ./nuget

- name: Push NutGet
run: dotnet nuget push ./nuget/*.nupkg -s "Deveel GitHub" --skip-duplicate --api-key ${{secrets.DEVEEL_NUGET_TOKEN}}
run: dotnet nuget push ./nuget/*.nupkg -s "https://nuget.pkg.github.com/deveel/index.json" --skip-duplicate --api-key ${{secrets.GITHUB_TOKEN}}

clean:
name: "Clean Old Packages"
needs: build
needs: pack
uses: ./.github/workflows/clean-packages.yml
33 changes: 21 additions & 12 deletions .github/workflows/pr-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,31 +6,40 @@ on:

jobs:
build:

runs-on: ubuntu-latest
strategy:
matrix:
dotnet: [ '6.0.x', '7.0.x', '8.0.x' ]

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Emit .NET 6.0 Framework Version
if: matrix.dotnet == '6.0.x'
run: echo "DOTNET_FX_VERSION=net6.0" >> $GITHUB_ENV

- name: Emit .NET 7.0 Framework Version
if: matrix.dotnet == '7.0.x'
run: echo "DOTNET_FX_VERSION=net7.0" >> $GITHUB_ENV

- name: Emit .NET 8.0 Framework Version
if: matrix.dotnet == '8.0.x'
run: echo "DOTNET_FX_VERSION=net8.0" >> $GITHUB_ENV

- name: Setup .NET Framework
uses: actions/setup-dotnet@v3
- name: Setup .NET ${{ matrix.dotnet }} Framework
uses: actions/setup-dotnet@v4
with:
dotnet-version: |
6.0.x
7.0.x
dotnet-version: ${{ matrix.dotnet }}

- name: Install SQLite Spatial
run: sudo apt-get install -y libsqlite3-mod-spatialite

- name: Add Deveel GitHub NuGet Source
run: dotnet nuget add source "https://nuget.pkg.github.com/deveel/index.json" -n "Deveel GitHub" -u ${{ secrets.DEVEEL_NUGET_USER }} -p ${{ secrets.DEVEEL_NUGET_TOKEN }} --store-password-in-clear-text

- name: Restore dependencies
run: dotnet restore

- name: Build
run: dotnet build --no-restore --version-suffix $GITHUB_RUN_ID -c Release
run: dotnet build --no-restore --version-suffix $GITHUB_RUN_ID -c Release -f ${{ env.DOTNET_FX_VERSION }}

- name: Test
run: dotnet test --no-build --verbosity normal -c Release
run: dotnet test --no-build --no-restore -c Release -f ${{ env.DOTNET_FX_VERSION }} --verbosity normal

40 changes: 31 additions & 9 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
name: Repository Release

permissions:
contents: read
packages: write

on:
push:
tags:
Expand All @@ -8,16 +12,30 @@ on:
jobs:
release:
runs-on: ubuntu-latest
strategy:
fail-fast: true
matrix:
dotnet-version: [ '6.0.x', '7.0.x', '8.0.x' ]

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Emit .NET 6.0 Framework Version
if: matrix.dotnet == '6.0.x'
run: echo "DOTNET_FX_VERSION=net6.0" >> $GITHUB_ENV

- name: Emit .NET 7.0 Framework Version
if: matrix.dotnet == '7.0.x'
run: echo "DOTNET_FX_VERSION=net7.0" >> $GITHUB_ENV

- name: Emit .NET 8.0 Framework Version
if: matrix.dotnet == '8.0.x'
run: echo "DOTNET_FX_VERSION=net8.0" >> $GITHUB_ENV

- name: Setup .NET Framework
uses: actions/setup-dotnet@v3
- name: Setup .NET ${{ matrix.dotnet-version }} Framework
uses: actions/setup-dotnet@v4
with:
dotnet-version: |
6.0.x
7.0.x
dotnet-version: ${{ matrix.dotnet-version }}

- name: Get tag
id: tag
Expand All @@ -28,8 +46,8 @@ jobs:
- name: Install SQLite Spatial
run: sudo apt-get install -y libsqlite3-mod-spatialite

- name: Add Deveel GitHub NuGet Source
run: dotnet nuget add source "https://nuget.pkg.github.com/deveel/index.json" -n "Deveel GitHub" -u ${{ secrets.DEVEEL_NUGET_USER }} -p ${{ secrets.DEVEEL_NUGET_TOKEN }} --store-password-in-clear-text
# - name: Add Deveel GitHub NuGet Source
# run: dotnet nuget add source "https://nuget.pkg.github.com/deveel/index.json" -n "Deveel GitHub" -u ${{ secrets.DEVEEL_NUGET_USER }} -p ${{ secrets.DEVEEL_NUGET_TOKEN }} --store-password-in-clear-text

- name: Restore dependencies
run: dotnet restore
Expand All @@ -45,11 +63,15 @@ jobs:
with:
token: ${{ secrets.DEVEEL_CODECOV_TOKEN }}

publish:
needs: release
runs-on: ubuntu-latest
steps:
- name: Pack NuGet
run: dotnet pack -p:PackageVersion=${{steps.tag.outputs.tag}} -c Release -o ./nuget

- name: Push Github Nuget
run: dotnet nuget push ./nuget/*.nupkg -s "Deveel GitHub" --skip-duplicate --api-key ${{secrets.DEVEEL_NUGET_TOKEN}}
run: dotnet nuget push ./nuget/*.nupkg -s "https://nuget.pkg.github.com/deveel/index.json" --skip-duplicate --api-key ${{secrets.GITHUB_TOKEN}}

- name: Push to Github.org
run: dotnet nuget push ./nuget/**/*.nupkg --skip-duplicate --api-key ${{secrets.NUGET_API_KEY}} --source https://api.nuget.org/v3/index.json
25 changes: 25 additions & 0 deletions .github/workflows/tfm.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: "Emit TFM"

on:
workflow_call:
inputs:
dotnet-version:
description: "The .NET Framework version to obtain the TFM"
required: true
type: string

jobs:
emit:
runs-on: ubuntu-latest
steps:
- name: Emit .NET 6.0 Framework Version
if: ${{ inputs.dotnet-version}} == '6.0.x'
run: echo "DOTNET_FX_VERSION=net6.0" >> $GITHUB_ENV

- name: Emit .NET 7.0 Framework Version
if: ${{ inputs.dotnet-version}} == '7.0.x'
run: echo "DOTNET_FX_VERSION=net7.0" >> $GITHUB_ENV

- name: Emit .NET 8.0 Framework Version
if: ${{ inputs.dotnet-version}} == '8.0.x'
run: echo "DOTNET_FX_VERSION=net8.0" >> $GITHUB_ENV
6 changes: 6 additions & 0 deletions src/Deveel.Repository.Core/Deveel.Repository.Core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="7.0.0" />
<PackageReference Include="Microsoft.Extensions.Options" Version="7.0.0" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'net8.0'">
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Options" Version="8.0.1" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="CommunityToolkit.Diagnostics" Version="8.2.1" />
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="System.Linq.Dynamic.Core" Version="1.3.5" />
<PackageReference Include="System.Linq.Dynamic.Core" Version="1.3.8" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,12 @@
<ItemGroup Condition="'$(TargetFramework)' == 'net7.0'">
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="7.0.12" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'net8.0'">
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="8.0.2" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Finbuckle.MultiTenant.EntityFrameworkCore" Version="6.12.0" />
<PackageReference Include="Finbuckle.MultiTenant.EntityFrameworkCore" Version="6.13.1" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Deveel.Repository.Core\Deveel.Repository.Core.csproj" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<Title>Deveel Repository Finbuckle Multi-Tenant Extension</Title>
Expand All @@ -7,7 +7,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Finbuckle.MultiTenant" Version="6.12.0" />
<PackageReference Include="Finbuckle.MultiTenant" Version="6.13.1" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="EasyCaching.Core" Version="1.9.1" />
<PackageReference Include="EasyCaching.Core" Version="1.9.2" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="6.0.1" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="6.0.1" Condition="'$(TargetFramework)' == 'net6.0'" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="7.0.0" Condition="'$(TargetFramework)' == 'net7.0'" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="8.0.0" Condition="'$(TargetFramework)' == 'net8.0'" />
<FrameworkReference Include="Microsoft.AspNetCore.App" />
</ItemGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,11 @@
<ItemGroup Condition="'$(TargetFramework)' == 'net7.0'">
<PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="7.0.0" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'net8.0'">
<PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="8.0.0" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Finbuckle.MultiTenant" Version="6.12.0" />
<PackageReference Include="MongoFramework" Version="0.29.0" />
</ItemGroup>

Expand Down
10 changes: 6 additions & 4 deletions src/Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
<Project>
<PropertyGroup>
<TargetFrameworks>net6.0;net7.0</TargetFrameworks>
<TargetFrameworks>net6.0;net7.0;net8.0</TargetFrameworks>
<RootNamespace>Deveel</RootNamespace>
<VersionPrefix>1.2.8</VersionPrefix>
<VersionPrefix>1.3.0</VersionPrefix>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>

<!-- NuGet Metadata and Commands -->
<Authors>Antonello Provenzano</Authors>
<Company>Deveel AS</Company>
<Copyright>(C) 2022-2023 Deveel AS</Copyright>
<Copyright>(C) 2022-2024 Antonello Provenzano</Copyright>
<PackageProjectUrl>https://github.com/deveel/deveel.repository</PackageProjectUrl>
<RepositoryUrl>https://github.com/deveel/deveel.repository</RepositoryUrl>
<RepositoryType>git</RepositoryType>
Expand All @@ -24,7 +24,9 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1" PrivateAssets="All"/>
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1" PrivateAssets="All" Condition="'$(TargetFramework)' != 'net8.0'"/>
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="8.0.0" PrivateAssets="All" Condition="'$(TargetFramework)' == 'net8.0'"/>

</ItemGroup>

<PropertyGroup Condition="'$(GITHUB_ACTIONS)' == 'true'">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,11 @@
<ItemGroup Condition="'$(TargetFramework)' == 'net7.0'">
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="7.0.0" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'net8.0'">
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="8.0.0" />
</ItemGroup>


<ItemGroup>
<ProjectReference Include="..\..\src\Deveel.Repository.Core\Deveel.Repository.Core.csproj" />
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public override async Task DisposeAsync() {

await dbContext.DisposeAsync();

await base.DisposeAsync();
// await base.DisposeAsync();
}
}
}
Loading

0 comments on commit 6484e76

Please sign in to comment.