Skip to content

Commit

Permalink
Configure build & test GitHub action for the abp-samples repository.
Browse files Browse the repository at this point in the history
  • Loading branch information
maliming committed May 16, 2020
1 parent eab99a7 commit f1e3822
Show file tree
Hide file tree
Showing 8 changed files with 87 additions and 3 deletions.
24 changes: 24 additions & 0 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: "build and test"
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
build-test:
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-dotnet@master
with:
dotnet-version: 3.1.100

- name: Build All
run: .\build-all.ps1
working-directory: .\build
shell: powershell

- name: Test All
run: .\test-all.ps1
working-directory: .\build
shell: powershell
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
using Shouldly;
using Volo.Abp.Application.Dtos;
using Volo.Abp.Validation;
using Microsoft.EntityFrameworkCore.Internal;

namespace Acme.BookStore
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,10 @@ private void ConfigureInMemorySqlite(IServiceCollection services)

services.Configure<AbpDbContextOptions>(options =>
{
options.Configure(context => { context.DbContextOptions.UseSqlite(_sqliteConnection); });
options.Configure(context =>
{
context.DbContextOptions.UseSqlite(_sqliteConnection, sqliteOptions => sqliteOptions.UseNetTopologySuite());
});
});
}

Expand All @@ -43,7 +46,10 @@ private static SqliteConnection CreateDatabaseAndGetConnection()
connection.Open();

var options = new DbContextOptionsBuilder<PostgeSqlDemoMigrationsDbContext>()
.UseSqlite(connection)
.UseSqlite(connection, sqliteOptions =>
{
sqliteOptions.UseNetTopologySuite();
})
.Options;

using (var context = new PostgeSqlDemoMigrationsDbContext(options))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.4.0" />
<PackageReference Include="Microsoft.Data.Sqlite" Version="3.1.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="3.1.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.NetTopologySuite" Version="3.1.0" />
</ItemGroup>

</Project>
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ Also see https://github.com/abpframework/abp/tree/dev/samples
### Pull Requests

* You can send PRs to this repository.
* When you create a new project, please update the [`common.ps1`](build/common.ps1) file.
16 changes: 16 additions & 0 deletions build/build-all.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
. ".\common.ps1"

# Build all solutions

foreach ($solutionPath in $solutionPaths) {
$solutionAbsPath = (Join-Path $rootFolder $solutionPath)
Set-Location $solutionAbsPath
dotnet build
if (-Not $?) {
Write-Host ("Build failed for the solution: " + $solutionPath)
Set-Location $rootFolder
exit $LASTEXITCODE
}
}

Set-Location $rootFolder
21 changes: 21 additions & 0 deletions build/common.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# COMMON PATHS

$rootFolder = (Get-Item -Path "./" -Verbose).FullName

# List of solutions

$solutionPaths = (
"../aspnet-core/Authentication-Customization",
"../BasicAspNetCoreApplication",
"../BasicConsoleApplication",
"../BookStore",
"../BookStore-Angular-MongoDb/aspnet-core",
"../BookStore-Modular/modules/book-management",
"../BookStore-Modular/application",
"../DashboardDemo",
"../EfCoreMigrationDemo",
"../PostgeSqlDemo",
"../RabbitMqEventBus",
"../SignalRDemo",
"../TextTemplateDemo"
)
16 changes: 16 additions & 0 deletions build/test-all.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
. ".\common.ps1"

# Test all solutions

foreach ($solutionPath in $solutionPaths) {
$solutionAbsPath = (Join-Path $rootFolder $solutionPath)
Set-Location $solutionAbsPath
dotnet test --no-build --no-restore
if (-Not $?) {
Write-Host ("Test failed for the solution: " + $solutionPath)
Set-Location $rootFolder
exit $LASTEXITCODE
}
}

Set-Location $rootFolder

0 comments on commit f1e3822

Please sign in to comment.