Skip to content

Commit

Permalink
add github workflows for build and integration-test
Browse files Browse the repository at this point in the history
  • Loading branch information
Nfactor26 committed Apr 24, 2022
1 parent 3d9bad4 commit 59e0a7c
Show file tree
Hide file tree
Showing 3 changed files with 138 additions and 1 deletion.
82 changes: 82 additions & 0 deletions .github/workflows/identity-build-and-test-docker.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
name: Identity build and test with docker image

on:
workflow_dispatch

jobs:

build-docker-image-and-push:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v3
- name: Login to Docker Hub
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v2
with:
context: .
file: ./src/Pixel.Identity.Provider/Dockerfile
push: true
tags: ${{ secrets.DOCKER_HUB_USERNAME }}/pixel-identity:latest

test-postgres:

needs: build-docker-image-and-push
runs-on: ubuntu-latest
strategy:
matrix:
dotnet-version: [ '6.0.x' ]

services:

postgres:
image: postgres:latest
env:
POSTGRES_USER: postgresadmin
POSTGRES_PASSWORD: postgrespass
POSTGRES_DB: pixel_identity_db
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432

pixel-identity:
image: ${{ secrets.DOCKER_HUB_USERNAME }}/pixel-identity:latest
env:
AllowedOrigins: http://localhost:5000
IdentityHost: http://localhost:5000/pauth
ASPNETCORE_URLS: http://+
Plugins__Collection__0__Type: EmailSender
Plugins__Collection__0__Path: Plugins/Messenger
Plugins__Collection__0__Name: Pixel.Identity.Messenger.Console
Plugins__Collection__1__Type: DbStore
Plugins__Collection__1__Path: Plugins/DbStore
Plugins__Collection__1__Name: Pixel.Identity.Store.PostgreSQL
IdentityOptions_SignIn_RequireConfirmedAccount: false
ConnectionStrings__PostgreServerConnection: User ID=postgresadmin;Password=postgrespass;Server=postgres;Port=5432;Database=pixel_identity_db;

- name: Setup dotnet ${{ matrix.dotnet-version }}
uses: actions/setup-dotnet@v2
with:
dotnet-version: ${{ matrix.dotnet-version }}
- name: Build test project
env:
BROWSER: Chromium
HEADED: 1
BaseUrl: http:\\localhost:5000\\pauth
UserEmail: [email protected]
UserSecret: Admi9@pixel
run: dotnet build src/Pixel.Identity.UI.Tests/Pixel.Identity.UI.Tests.csproj
- name: Install browsers
run: pwsh src/Pixel.Identity.UI.Tests/bin/Debug/net6.0/playwright.ps1 install
- name: Execute tests
run: dotnet test src/Pixel.Identity.UI.Tests/Pixel.Identity.UI.Tests.csproj

46 changes: 46 additions & 0 deletions .github/workflows/identity-build-only.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Identity Build Only

on:
push:
branches: [ main ]
paths:
- 'src/**'
pull_request:
branches: [ main ]
paths:
- 'src/**'

jobs:

build:
runs-on: ubuntu-latest
strategy:
matrix:
dotnet-version: [ '6.0.x' ]

steps:
- name: Checkout Repository
uses: actions/checkout@v3
- name: Setup dotnet ${{ matrix.dotnet-version }}
uses: actions/setup-dotnet@v2
with:
dotnet-version: ${{ matrix.dotnet-version }}
- name : Cache nuget packages
uses: actions/cache@v2
with:
path: ${{ github.workspace }}/.nuget/packages
key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }}
restore-keys: |
${{ runner.os }}-nuget-
- name: Display dotnet version
run: dotnet --version
- name: Install dependencies
run: dotnet restore Pixel.Identity.sln
- name: Build
run: dotnet build src/Pixel.Identity.Provider/Pixel.Identity.Provider.csproj -c Release --no-restore -o app/build
- name: Upload build artifacts
uses: actions/upload-artifact@v3
with:
name: Pixel Identity
path: app/build

11 changes: 10 additions & 1 deletion Pixel.Identity.sln
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,15 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Samples.Blazor.App.Host", "
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tests", "Tests", "{90291008-5EF2-4A1F-9B89-19216A3B017F}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Pixel.Identity.UI.Tests", "src\Pixel.Identity.UI.Tests\Pixel.Identity.UI.Tests.csproj", "{440B2ECE-5DCF-481D-9C18-0EC8F4F18E98}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Pixel.Identity.UI.Tests", "src\Pixel.Identity.UI.Tests\Pixel.Identity.UI.Tests.csproj", "{440B2ECE-5DCF-481D-9C18-0EC8F4F18E98}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".github", ".github", "{2454553A-208B-4D0F-A877-66F67C550DB4}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "workflows", "workflows", "{1872169C-F107-43FD-AE02-6DDF88241644}"
ProjectSection(SolutionItems) = preProject
.github\workflows\identity-build-and-test.yaml = .github\workflows\identity-build-and-test.yaml
.github\workflows\identity-build-docker.yaml = .github\workflows\identity-build-docker.yaml
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand Down Expand Up @@ -236,6 +244,7 @@ Global
{7D75919B-B900-4370-A9AB-913104AEA2F0} = {D1F9C105-5E1A-42B0-A47F-3DD3B223AD8C}
{535B958A-7CEF-43EC-9545-3CE999D74889} = {D1F9C105-5E1A-42B0-A47F-3DD3B223AD8C}
{440B2ECE-5DCF-481D-9C18-0EC8F4F18E98} = {90291008-5EF2-4A1F-9B89-19216A3B017F}
{1872169C-F107-43FD-AE02-6DDF88241644} = {2454553A-208B-4D0F-A877-66F67C550DB4}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {D2D4C886-7F44-4E77-9010-D9AB3C1B559C}
Expand Down

0 comments on commit 59e0a7c

Please sign in to comment.