Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

spell correction #38

Open
wants to merge 19 commits into
base: main
Choose a base branch
from
Open
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
92 changes: 71 additions & 21 deletions .github/workflows/dotnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,27 +11,77 @@ on:

jobs:
build:

runs-on: ubuntu-latest

services:
postgres:
image: postgres:latest
env:
POSTGRES_DB: your-lab-dev-db
POSTGRES_USER: your-lab-dev
POSTGRES_PASSWORD: SuperSecurePassw0rd
ports:
- 5432:5432
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5

steps:
- uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
- name: Restore dependencies
run: dotnet restore
- name: Build
run: dotnet build --no-restore
- name: Test
run: dotnet test --no-build --verbosity normal --collect:"XPlat Code Coverage"
- name: Find coverage reports
id: find-reports
run: |
echo "::set-output name=paths::$(find ${{ github.workspace }} -name "coverage.cobertura.xml")"
- name: Send coverage-reports to Codacy
uses: codacy/[email protected]
with:
project-token: ${{ secrets.CODACY_PROJECT_TOKEN }}
coverage-reports: ${{ steps.find-reports.outputs.paths }}
- uses: actions/checkout@v4

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

- name: Restore dependencies
run: dotnet restore

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

- name: Test
run: dotnet test --no-build --verbosity normal --collect:"XPlat Code Coverage"

- name: Find coverage reports
id: find-reports
run: |
echo "::set-output name=paths::$(find ${{ github.workspace }} -name "coverage.cobertura.xml")"

- name: Send coverage-reports to Codacy
uses: codacy/[email protected]
with:
project-token: ${{ secrets.CODACY_PROJECT_TOKEN }}
coverage-reports: ${{ steps.find-reports.outputs.paths }}

- name: Configure PostgreSQL Credentials
run: |
echo "YOUR_LAB__DB__HOST=localhost" >> $GITHUB_ENV
echo "YOUR_LAB__DB__PORT=5432" >> $GITHUB_ENV
echo "YOUR_LAB__DB__DATABASE=your-lab-dev-db" >> $GITHUB_ENV
echo "YOUR_LAB__DB__USER=your-lab-dev" >> $GITHUB_ENV
echo "YOUR_LAB__DB__PASSWORD=SuperSecurePassw0rd" >> $GITHUB_ENV

- name: Run application
run: dotnet run --project /home/runner/work/Your-Lab/Your-Lab/API/API.csproj &

- name: Wait for application startup
run: sleep 10

- name: ZAP Scan
uses: zaproxy/[email protected]
with:
format: openapi
target: 'http://localhost:5209/swagger/v1/swagger.json'
cmd_options: '-a' # Aggressive scanning enabled
allow_issue_writing: false

- name: Upload ZAP Report to Codacy
run: |
curl -X POST https://app.codacy.com/api/v3/organizations/gh/Hutch79/security/tools/dast/ZAP/reports \
-H "api-token: ${{ secrets.CODACY_ACOUNT_TOKEN }}" \
-H "Content-Type: multipart/form-data" \
-H "Accept: application/json" \
-F "file=report_json.json" \
-F "reportFormat=json"

- name: Stop application
run: pkill dotnet
6 changes: 0 additions & 6 deletions API/Controllers/WeatherForecastController.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
using System.Collections;
using Microsoft.AspNetCore.Mvc;

namespace Your_Lab.Controllers;
Expand Down Expand Up @@ -30,9 +29,4 @@ public IEnumerable<WeatherForecast> Get()
})
.ToArray();
}

public IDictionary Test()
{
return Environment.GetEnvironmentVariables();
}
}
2 changes: 1 addition & 1 deletion API/appsettings.Development.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"HOST": "localhost",
"PORT": "5432",
"DATABASE": "your-labs-db",
"USER": "user",
"USER": "user-dev",
"PASSWORD": "password"
}
},
Expand Down
8 changes: 4 additions & 4 deletions Test/UnitTest1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ public class UnitTest1
[Fact]
public void Test1()
{
// Well, that's my testing .-.
// What did you expect, im lazy!
// Ok, jokes aside. There will be unit tests which will be (hopefully) better than this.
// But currently there are none.
// Well, that's my testing...
// What did you expect? I'm lazy!
// Ok, jokes aside, there will be unit tests which will (hopefully) be better than this.
// But currently, there are none.

var user = new User
{
Expand Down
2 changes: 2 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
services:
your-lab:
image: your-lab
ports:
- 8080:8080
build:
context: .
dockerfile: API/Dockerfile
Expand Down
Loading