Skip to content
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
33 changes: 33 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
---
name: 👾 Bug Report
about: Report a bug or issue with the project.
title: ''
labels: 'bug'
assignees: ''

---

### Description
A clear and concise description of what the bug is.

### Steps To Reproduce
1. Log in...
2. Ensure that...
3. Allow a long period of inactivity to pass...
4. Observe that...
5. Attempt to log in...

### Current Behavior
- After the period of inactivity...
- When the user tries to log in using another method...
- This causes a bug due to...

### Expected Behavior
- After a long period of inactivity...
- When a user logs in successfully...
- This ensures that only...

### Environment
- Platform: PC
- Node: v18.18.0
- Browser: Chrome 126.0.6478.56
10 changes: 10 additions & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
blank_issues_enabled: false
issue_template:
- name: 👾 Bug Report
description: Report a bug or issue with the project.
labels: ["bug"]
template: bug_report.md
- name: 💡 Feature Request
description: Create a new ticket for a new feature request.
labels: ["enhancement"]
template: feature_request.md
27 changes: 27 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
---
name: 💡 Feature Request
about: Create a new ticket for a new feature request
title: ''
labels: 'enhancement'
assignees: ''

---

### Expected Behavior
Describe the expected behavior here.

### Specifications
As a `user`, I would like to `action` so that `reason`.

**Features:**
- describe feature details here.

**Development Tasks:**
- [ ] Task 1
- [ ] Task 2

### Dependencies
List any dependencies that are required for this feature by providing links to the issues or repositories.

### References
List any references that are related to this feature request.
23 changes: 23 additions & 0 deletions .github/workflows/security.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Security Review

permissions:
pull-requests: write
contents: read

on:
pull_request:

jobs:
security:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha || github.sha }}
fetch-depth: 2

- uses: Portkey-Wallet/claude-code-security-review@main
with:
comment-pr: true
claude-api-key: ${{ secrets.CLAUDE_API_KEY }}
run-every-commit: true
46 changes: 46 additions & 0 deletions .github/workflows/sonarqube.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
on:
pull_request:
types: [opened, synchronize, reopened]

name: PR Static Code Analysis
jobs:
static-code-analysis:
runs-on: ubuntu-latest
steps:
- name: Code Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-dotnet@v4
with:
dotnet-version: '7.0'
- name: Create temporary global.json
run: echo '{"sdk":{"version":"7.0.x"}}' > ./global.json
- name: Install protobuf
run: sudo apt-get update && sudo apt-get install -y protobuf-compiler
- name: Set up JDK 17
uses: actions/setup-java@v1
with:
java-version: 17
- name: Cache SonarQube packages
uses: actions/cache@v1
with:
path: ~/.sonar/cache
key: ${{ runner.os }}-sonar
restore-keys: ${{ runner.os }}-sonar
- name: Cache SonarQube scanner
id: cache-sonar-scanner
uses: actions/cache@v1
with:
path: ./.sonar/scanner
key: ${{ runner.os }}-sonar-scanner
restore-keys: ${{ runner.os }}-sonar-scanner
- name: Install SonarScanner for .NET
run: dotnet tool update dotnet-sonarscanner --tool-path ./.sonar/scanner
- name: Add .NET global tools to PATH
run: echo "$HOME/.dotnet/tools" >> $GITHUB_PATH
- name: Begin SonarQube analysis
run: |
./.sonar/scanner/dotnet-sonarscanner begin /k:"aelfscan-genesis-app" /d:sonar.host.url="${{ secrets.SONAR_HOST_URL }}" /d:sonar.token="${{ secrets.SONAR_TOKEN }}"
dotnet build
./.sonar/scanner/dotnet-sonarscanner end /d:sonar.token="${{ secrets.SONAR_TOKEN }}"
55 changes: 55 additions & 0 deletions .github/workflows/test-with-code-coverage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: Test with code coverage

on:
push:
branches:
- '**'

env:
DOTNET_INSTALL_DIR: "./.dotnet"

jobs:
test:
runs-on: ubuntu-latest
permissions:
pull-requests: write
contents: write
services:
elasticsearch:
image: elasticsearch:7.17.0
ports:
- 9200:9200
options: -e="discovery.type=single-node" -e="xpack.security.enabled=false" --health-cmd="curl http://localhost:9200/_cluster/health" --health-interval=10s --health-timeout=5s --health-retries=10
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup dotnet
uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.0'
- name: Verify Elasticsearch connection
env:
ELASTIC_SEARCH_URL: http://127.0.0.1:${{ job.services.elasticsearch.ports[9200] }}
run: |
echo $ELASTIC_SEARCH_URL
curl -fsSL "$ELASTIC_SEARCH_URL/_cat/health?h=status"
- name: Install dependencies
run: dotnet restore --verbosity quiet

- name: Build
run: dotnet build --no-restore /clp:ErrorsOnly /p:GeneratePackageOnBuild=false --verbosity quiet

- name: Test
run: |
for name in `ls ./test/*.Tests/*.csproj | awk '{print $NF}'`;
do
dotnet test ${name} --no-restore --no-build --logger trx --settings CodeCoverage.runsettings --results-directory coverage --collect:"XPlat Code Coverage"
done

- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v4
with:
fail_ci_if_error: true
files: coverage/*/coverage.cobertura.xml
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
13 changes: 13 additions & 0 deletions .idea/.idea.GenesisApp/.idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 17 additions & 0 deletions CodeCoverage.runsettings
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- File name extension must be .runsettings -->
<RunSettings>
<DataCollectionRunSettings>
<DataCollectors>
<DataCollector friendlyName="XPlat code coverage">
<Configuration>
<Format>cobertura</Format>
<Exclude>[xunit.*]*,[*Tests]*</Exclude> <!-- [Assembly-Filter]Type-Filter -->
<ExcludeByFile>**/test/**/*.cs,**/src/AElfScan.GenesisApp/Generated/*.*</ExcludeByFile>
<ExcludeByAttribute>Obsolete,GeneratedCodeAttribute</ExcludeByAttribute>
<SingleHit>false</SingleHit>
</Configuration>
</DataCollector>
</DataCollectors>
</DataCollectionRunSettings>
</RunSettings>
40 changes: 40 additions & 0 deletions GenesisApp.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.29020.237
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{CA9AC87F-097E-4F15-8393-4BC07735A5B0}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{04DBDB01-70F4-4E06-B468-8F87850B22BE}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AElfScan.GenesisApp", "src\AElfScan.GenesisApp\AElfScan.GenesisApp.csproj", "{EEC6D30D-2A9F-4757-8BE0-6E6105185383}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AElfScan.GenesisApp.Tests", "test\AElfScan.GenesisApp.Tests\AElfScan.GenesisApp.Tests.csproj", "{EEC35B8E-028E-4B1B-A9A0-FE1B0F5C0CAE}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{EEC6D30D-2A9F-4757-8BE0-6E6105185383}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{EEC6D30D-2A9F-4757-8BE0-6E6105185383}.Debug|Any CPU.Build.0 = Debug|Any CPU
{EEC6D30D-2A9F-4757-8BE0-6E6105185383}.Release|Any CPU.ActiveCfg = Release|Any CPU
{EEC6D30D-2A9F-4757-8BE0-6E6105185383}.Release|Any CPU.Build.0 = Release|Any CPU
{EEC35B8E-028E-4B1B-A9A0-FE1B0F5C0CAE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{EEC35B8E-028E-4B1B-A9A0-FE1B0F5C0CAE}.Debug|Any CPU.Build.0 = Debug|Any CPU
{EEC35B8E-028E-4B1B-A9A0-FE1B0F5C0CAE}.Release|Any CPU.ActiveCfg = Release|Any CPU
{EEC35B8E-028E-4B1B-A9A0-FE1B0F5C0CAE}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{EEC6D30D-2A9F-4757-8BE0-6E6105185383} = {CA9AC87F-097E-4F15-8393-4BC07735A5B0}
{EEC35B8E-028E-4B1B-A9A0-FE1B0F5C0CAE} = {04DBDB01-70F4-4E06-B468-8F87850B22BE}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {28315BFD-90E7-4E14-A2EA-F3D23AF4126F}
EndGlobalSection
EndGlobal

21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2024 AelfScanProject

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
8 changes: 8 additions & 0 deletions NuGet.Config
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<add key="BlazoriseMyGet" value="https://www.myget.org/F/blazorise/api/v3/index.json" />
<add key="AElfMyGet" value="https://www.myget.org/F/aelf-project-dev/api/v3/index.json" />
<add key="AeFinderMyGet" value="https://www.myget.org/F/aefinder/api/v3/index.json" />
</packageSources>
</configuration>
78 changes: 78 additions & 0 deletions build.cake
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
#tool nuget:?package=Codecov
#addin nuget:?package=Cake.Codecov&version=0.8.0

var target = Argument("target", "Default");
var configuration = Argument("configuration", "Debug");
var rootPath = "./";
var srcPath = rootPath + "src/";
var testPath = rootPath + "test/";
var solution = rootPath + "GenesisApp.sln";

Task("Clean")
.Description("clean up project cache")
.Does(() =>
{
CleanDirectories(srcPath + "**/bin");
CleanDirectories(srcPath + "**/obj");
CleanDirectories(testPath + "**/bin");
CleanDirectories(testPath + "**/obj");
});

Task("Restore")
.Description("restore project dependencies")
.Does(() =>
{
DotNetCoreRestore(solution, new DotNetCoreRestoreSettings
{
Verbosity = DotNetCoreVerbosity.Quiet,
Sources = new [] { "https://www.myget.org/F/aelf-project-dev/api/v3/index.json", "https://api.nuget.org/v3/index.json" }
});
});
Task("Build")
.Description("Compilation project")
.IsDependentOn("Clean")
.IsDependentOn("Restore")
.Does(() =>
{
var buildSetting = new DotNetCoreBuildSettings{
NoRestore = true,
Configuration = configuration,
ArgumentCustomization = args => {
return args.Append("/clp:ErrorsOnly")
.Append("-v quiet");}
};

DotNetCoreBuild(solution, buildSetting);
});

Task("Test-with-Codecov")
.Description("operation tes")
.IsDependentOn("Build")
.Does(() =>
{
var testSetting = new DotNetCoreTestSettings{
Configuration = configuration,
NoRestore = true,
NoBuild = true,
ArgumentCustomization = args => {
return args
.Append("--logger trx")
.Append("--settings CodeCoverage.runsettings")
.Append("--collect:\"XPlat Code Coverage\"");
}
};
var testProjects = GetFiles("./test/*.Tests/*.csproj");
var testProjectList = testProjects.OrderBy(p=>p.FullPath).ToList();
foreach(var testProject in testProjectList)
{
DotNetCoreTest(testProject.FullPath, testSetting);
}
});

Task("Upload-Coverage-Azure")
.Does(() =>
{
Codecov("./CodeCoverage/Cobertura.xml","$CODECOV_TOKEN");
});

RunTarget(target);
3 changes: 3 additions & 0 deletions build.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/usr/bin/env bash
CAKE_VERSION=0.37.0
DOTNET_VERSION=7.0.100
Loading
Loading