Skip to content

Commit

Permalink
Merge branch 'v0.6' into fix_PhoneNumber
Browse files Browse the repository at this point in the history
  • Loading branch information
csharpfritz committed Jan 30, 2025
2 parents d205815 + 413a05e commit 72d6118
Show file tree
Hide file tree
Showing 8 changed files with 100 additions and 87 deletions.
9 changes: 9 additions & 0 deletions .all-contributorsrc
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,15 @@
"design",
"code"
]
},
{
"login": "bsimser",
"name": "Occular Malice",
"avatar_url": "https://avatars.githubusercontent.com/u/301535?v=4",
"profile": "https://www.simstools.com",
"contributions": [
"code"
]
}
],
"contributorsPerLine": 7,
Expand Down
20 changes: 10 additions & 10 deletions .github/workflows/dotnet-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,13 +70,13 @@ jobs:
color: ${{ env.BADGE_COLOR }}
path: badge.svg

- name: Upload badge to Gist
# Upload only for master branch
if: >
github.event_name == 'workflow_run' && github.event.workflow_run.head_branch == 'main' ||
github.event_name != 'workflow_run' && github.ref == 'refs/heads/main'
uses: andymckay/append-gist-action@6e8d64427fe47cbacf4ab6b890411f1d67c07f3e
with:
token: ${{ secrets.GIST_TOKEN }}
gistURL: https://gist.github.com/csharpfritz/6487a1f9b940712e183109b2a3d92611
file: badge.svg
- name: Upload badge to Azure Blob Storage
if: always() && (github.ref == 'refs/heads/main' || github.base_ref == 'refs/heads/main')
shell: pwsh
env:
AZURE_STORAGE_ACCOUNT: ${{ secrets.AZURE_STORAGE_ACCOUNT }}
AZURE_STORAGE_KEY: ${{ secrets.AZURE_STORAGE_KEY }}
AZURE_STORAGE_CONTAINER: ${{ secrets.AZURE_STORAGE_CONTAINER }}
run: |
echo "Uploading badge to Azure Blob Storage in storage account $env:AZURE_STORAGE_ACCOUNT"
az storage blob upload --account-name $env:AZURE_STORAGE_ACCOUNT --account-key $env:AZURE_STORAGE_KEY --container-name $env:AZURE_STORAGE_CONTAINER --file badge.svg --name unittest-badge.svg --overwrite true
99 changes: 35 additions & 64 deletions .github/workflows/playwright.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,74 +10,45 @@ on:
paths-ignore:
- '**.md'
- 'tests/**'
workflow_dispatch:
types: [opened, synchronize, reopened]
workflow_dispatch:

jobs:
playwright:
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository
name: 'Playwright Tests'
timeout-minutes: 60
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-dotnet@v4
with:
global-json-file: global.json
- name: Install .NET HTTPS Development Certificate
# if: matrix.os == 'ubuntu-latest'
run: |
dotnet tool update -g linux-dev-certs
dotnet linux-dev-certs install
- name: Build .NET Solution
run: dotnet build

- name: Install Playwright Browsers
run: pwsh e2e/SharpSite.E2E/bin/Debug/net9.0/playwright.ps1 install chromium --with-deps

- name: Run your tests
run: pwsh ./build-and-test.ps1


- name: Publish Test Results
uses: EnricoMi/publish-unit-test-result-action@v2
id: test-results
if: always()
with:
files: |
playwright-test-results/**/*.trx
- name: Set badge color
if: always()
shell: bash
run: |
case ${{ fromJSON( steps.test-results.outputs.json ).conclusion }} in
success)
echo "BADGE_COLOR=31c653" >> $GITHUB_ENV
;;
failure)
echo "BADGE_COLOR=800000" >> $GITHUB_ENV
;;
neutral)
echo "BADGE_COLOR=696969" >> $GITHUB_ENV
;;
esac
- name: Create badge
uses: emibcn/badge-action@808173dd03e2f30c980d03ee49e181626088eee8
if: always()
with:
label: e2e Tests
status: '${{ fromJSON( steps.test-results.outputs.json ).formatted.stats.tests }} tests, ${{ fromJSON( steps.test-results.outputs.json ).formatted.stats.runs }} runs: ${{ fromJSON( steps.test-results.outputs.json ).conclusion }}'
color: ${{ env.BADGE_COLOR }}
path: badge.svg

- name: Upload badge to Gist
# Upload only for main branch
if: #>
always() #&& github.event_name == 'workflow_run' && github.event.workflow_run.head_branch == 'v0.6' ||
#github.event_name != 'workflow_run' && github.ref == 'refs/heads/v0.6'
uses: andymckay/append-gist-action@6e8d64427fe47cbacf4ab6b890411f1d67c07f3e
with:
token: ${{ secrets.GIST_TOKEN }}
gistURL: https://gist.github.com/csharpfritz/cc3efb24011bb97d8790afff96a1138d
file: badge.svg

- uses: actions/checkout@v4
- name: Setup dotnet
uses: actions/setup-dotnet@v4
with:
global-json-file: global.json
- name: Add .NET tools to PATH
run: echo "/github/home/.dotnet/tools" >> $GITHUB_PATH
- name: Install .NET HTTPS Development Certificate
run: |
dotnet tool update -g linux-dev-certs
dotnet linux-dev-certs install
- name: Build .NET Solution
run: dotnet build
- name: Install Playwright Browsers
run: pwsh e2e/SharpSite.E2E/bin/Debug/net9.0/playwright.ps1 install chromium --with-deps
- name: Pull Docker image for Database
run: docker pull postgres:17.2
- name: Run your tests
run: pwsh ./build-and-test.ps1
- name: Publish Test Results
uses: EnricoMi/publish-unit-test-result-action@v2
id: test-results
if: always()
- name: Upload badge to Azure Blob Storage
if: always() && (github.ref == 'refs/heads/main' || github.base_ref == 'refs/heads/main')
shell: pwsh
run: |
az storage blob upload --account-name $env:AZURE_STORAGE_ACCOUNT --account-key $env:AZURE_STORAGE_KEY --container-name $env:AZURE_STORAGE_CONTAINER --file badge.svg --name playwright-badge.svg
env:
AZURE_STORAGE_ACCOUNT: ${{ secrets.AZURE_STORAGE_ACCOUNT }}
AZURE_STORAGE_KEY: ${{ secrets.AZURE_STORAGE_KEY }}
AZURE_STORAGE_CONTAINER: ${{ secrets.AZURE_STORAGE_CONTAINER }}
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
[![All Contributors](https://img.shields.io/badge/all_contributors-10-orange.svg?style=flat-square)](#contributors-)
<!-- ALL-CONTRIBUTORS-BADGE:END -->
[![.NET Build + Test](https://github.com/FritzAndFriends/SharpSite/actions/workflows/dotnet-build.yml/badge.svg)](https://github.com/FritzAndFriends/SharpSite/actions/workflows/dotnet-build.yml)
[![Test Results](https://gist.githubusercontent.com/csharpfritz/6487a1f9b940712e183109b2a3d92611/raw/badge.svg)](https://gist.githubusercontent.com/csharpfritz/6487a1f9b940712e183109b2a3d92611/raw/badge.svg)
[![End-to-End Test Results](https://gist.githubusercontent.com/csharpfritz/cc3efb24011bb97d8790afff96a1138d/raw/badge.svg)](https://gist.githubusercontent.com/csharpfritz/cc3efb24011bb97d8790afff96a1138d/raw/badge.svg)
[![Test Results](https://fritzblog.blob.core.windows.net/githubartifacts/unittest-badge.svg)](https://fritzblog.blob.core.windows.net/githubartifacts/unittest-badge.svg)
[![End-to-End Test Results](https://fritzblog.blob.core.windows.net/githubartifacts/playwright-badge.svg)](https://fritzblog.blob.core.windows.net/githubartifacts/playwright-badge.svg)



Expand Down Expand Up @@ -81,6 +81,7 @@ There are three key personas that we would like SharpSite to support:
<td align="center" valign="top" width="14.28%"><a href="https://github.com/default-writer/c"><img src="https://avatars.githubusercontent.com/u/383256?v=4?s=100" width="100px;" alt="default-writer"/><br /><sub><b>default-writer</b></sub></a><br /><a href="https://github.com/FritzAndFriends/SharpSite/commits?author=default-writer" title="Documentation">📖</a> <a href="https://github.com/FritzAndFriends/SharpSite/commits?author=default-writer" title="Code">💻</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/degenone"><img src="https://avatars.githubusercontent.com/u/48437506?v=4?s=100" width="100px;" alt="Tero Kilpeläinen"/><br /><sub><b>Tero Kilpeläinen</b></sub></a><br /><a href="https://github.com/FritzAndFriends/SharpSite/commits?author=degenone" title="Code">💻</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/TheLankyScottishNerd"><img src="https://avatars.githubusercontent.com/u/8051530?v=4?s=100" width="100px;" alt="Declan McIlhatton"/><br /><sub><b>Declan McIlhatton</b></sub></a><br /><a href="#design-TheLankyScottishNerd" title="Design">🎨</a> <a href="https://github.com/FritzAndFriends/SharpSite/commits?author=TheLankyScottishNerd" title="Code">💻</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://www.simstools.com"><img src="https://avatars.githubusercontent.com/u/301535?v=4?s=100" width="100px;" alt="Occular Malice"/><br /><sub><b>Occular Malice</b></sub></a><br /><a href="https://github.com/FritzAndFriends/SharpSite/commits?author=bsimser" title="Code">💻</a></td>
</tr>
</tbody>
</table>
Expand Down
2 changes: 1 addition & 1 deletion build-and-test.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ $websiteUrl = "http://localhost:5020" # Adjust the URL as needed
$env:ASPIRE_ALLOW_UNSECURED_TRANSPORT="true"

# Run the .NET Aspire application in the background
$dotnetRunProcess = Start-Process -FilePath "dotnet" -ArgumentList "run -lp http --project src/SharpSite.AppHost/SharpSite.AppHost.csproj" -NoNewWindow -PassThru
$dotnetRunProcess = Start-Process -FilePath "dotnet" -ArgumentList "run -lp http --project src/SharpSite.AppHost/SharpSite.AppHost.csproj --testonly=true" -NoNewWindow -PassThru

# Function to check if the website is running
function Test-Website {
Expand Down
8 changes: 8 additions & 0 deletions scripts/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
## Scripts

This is a collection of scripts that help to build and run SharpSite.

### File list and purposes

| File | Purpose |
| --- | --- |
28 changes: 19 additions & 9 deletions src/SharpSite.AppHost/PostgresExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,28 @@ public static class VERSIONS
public static
(IResourceBuilder<PostgresDatabaseResource> db,
IResourceBuilder<ProjectResource> migrationSvc) AddPostgresServices(
this IDistributedApplicationBuilder builder)
this IDistributedApplicationBuilder builder,
bool testOnly = false)
{

var dbServer = builder.AddPostgres("database")
.WithImageTag(VERSIONS.POSTGRES)
.WithDataVolume($"{SharpSite.Data.Postgres.Constants.DBNAME}-data", false)
.WithLifetime(ContainerLifetime.Persistent)
.WithPgAdmin(config =>
{
config.WithImageTag(VERSIONS.PGADMIN);
config.WithLifetime(ContainerLifetime.Persistent);
});
.WithImageTag(VERSIONS.POSTGRES);

if (!testOnly)
{
dbServer.WithLifetime(ContainerLifetime.Persistent)
.WithDataVolume($"{SharpSite.Data.Postgres.Constants.DBNAME}-data", false)
.WithPgAdmin(config =>
{
config.WithImageTag(VERSIONS.PGADMIN);
config.WithLifetime(ContainerLifetime.Persistent);
});

}
else
{
dbServer.WithDataVolume();
}

var outdb = dbServer.AddDatabase(SharpSite.Data.Postgres.Constants.DBNAME);

Expand Down
16 changes: 15 additions & 1 deletion src/SharpSite.AppHost/Program.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,20 @@
var builder = DistributedApplication.CreateBuilder(args);

var (db, migrationSvc) = builder.AddPostgresServices();
var testOnly = false;

foreach (var arg in args)
{
if (arg.StartsWith("--testonly"))
{
var parts = arg.Split('=');
if (parts.Length == 2 && bool.TryParse(parts[1], out var result))
{
testOnly = result;
}
}
}

var (db, migrationSvc) = builder.AddPostgresServices(testOnly);

builder.AddProject<Projects.SharpSite_Web>("webfrontend")
.WithReference(db)
Expand Down

0 comments on commit 72d6118

Please sign in to comment.