Skip to content

Commit

Permalink
Merge pull request #27 from Kretchen001/24-pipelineaction-workflow-te…
Browse files Browse the repository at this point in the history
…st-api

24 pipelineaction workflow test api
  • Loading branch information
Kretchen001 authored Jan 23, 2024
2 parents 74cf5ab + 35af834 commit 1f345c2
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 7 deletions.
45 changes: 45 additions & 0 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: build and test

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
paths:
- '**.cs'
- '**.csproj'

env:
DOTNET_VERSION: '8.0.101' # The .NET SDK version to use
SLN_NAME: AmIVulnerable.sln

jobs:
build-and-test:

name: build-and-test-${{matrix.os}}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macOS-latest]

steps:
- uses: actions/checkout@v3
- name: Setup .NET Core
uses: actions/setup-dotnet@v3
with:
dotnet-version: ${{ env.DOTNET_VERSION }}

- name: cd & Install dependencies
run: |
cd code/AmIVulnerable
dotnet restore ${{ env.SLN_NAME }}
- name: Build
run: |
cd code/AmIVulnerable
dotnet build ${{ env.SLN_NAME }} --configuration Release --no-restore
- name: Test
run: |
cd code/AmIVulnerable
dotnet test ${{ env.SLN_NAME }} --no-restore --verbosity normal
Original file line number Diff line number Diff line change
Expand Up @@ -56,16 +56,21 @@ public ConvertCveToDbController(List<string> files) {
dbFiles = dbFiles.Order().ToList(); //.Distinct() because of line 45 not neccessary
}

public bool ConvertRawCve() {
try {
foreach (string file in files) {
public bool ConvertRawCve()
{
try
{
foreach (string file in files)
{
Console.WriteLine(file);
Match match = regexYear.Match(file);
int dbFile = dbFiles.FindIndex(x => x.Equals(match.Groups[1].Value));
dbFile = -1;
if (dbFile == -1) {
if (dbFile == -1)
{
continue; // if year was not found, continue convert and ignore file
}
using (LiteDatabase db = new LiteDatabase($"{saveDir}\\{dbFiles[dbFile]}.litedb")) {
using (LiteDatabase db = new LiteDatabase($"{saveDir}\\{dbFiles[dbFile]}.litedb"))
{
ILiteCollection<CVEcomp> col = db.GetCollection<CVEcomp>(tableName);

CVEcomp cve = JsonConvert.DeserializeObject<CVEcomp>(File.ReadAllText(file))!;
Expand All @@ -75,7 +80,8 @@ public bool ConvertRawCve() {
}
return true;
}
catch {
catch
{
return false;
}
}
Expand Down

0 comments on commit 1f345c2

Please sign in to comment.