Skip to content

Commit

Permalink
Merge dev branch, then resolve conflicts.
Browse files Browse the repository at this point in the history
  • Loading branch information
chopin-fan committed Jul 18, 2024
2 parents f6a60e5 + 542043d commit db228e8
Show file tree
Hide file tree
Showing 143 changed files with 3,631 additions and 533 deletions.
2 changes: 2 additions & 0 deletions .bettercodehub.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# Depth of components to analyze (2 levels deep)
component_depth: 2

# Programming languages to analyze
languages:
- csharp
42 changes: 22 additions & 20 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -1,31 +1,33 @@
---
name: Bug report
about: Create a report to help us improve
name: 👾 Bug Report
about: Report a bug or issue with the project.
title: ''
labels: ''
labels: 'bug'
assignees: ''

---

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

**To Reproduce**
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error
### 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...

**Expected behavior**
A clear and concise description of what you expected to happen.
### Current Behavior
- After the period of inactivity...
- When the user tries to log in using another method...
- This causes a bug due to...

**Screenshots**
If applicable, add screenshots to help explain your problem.
### Expected Behavior
- After a long period of inactivity...
- When a user logs in successfully...
- This ensures that only...

**Environment (please complete the following information):**
- OS and version: [e.g. Ubuntu 18.04]
- Dotnet core version [e.g. 2.2.106]

**Additional context**
Add any other context about the problem here.
### 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
29 changes: 18 additions & 11 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,27 @@
---
name: Feature request
about: Suggest an idea for this project
name: 💡 Feature Request
about: Create a new ticket for a new feature request
title: ''
labels: ''
labels: 'enhancement'
assignees: ''

---

**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
### Expected Behavior
Describe the expected behavior here.

**Describe the solution you'd like**
A clear and concise description of what you want to happen.
### Specifications
As a `user`, I would like to `action` so that `reason`.

**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.
**Features:**
- describe feature details here.

**Additional context**
Add any other context or screenshots about the feature request 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.
48 changes: 48 additions & 0 deletions .github/workflows/benchmark_action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: benchmark_action
on:
push:
tags:
- '**'
branches:
- '**'



env:
DOTNET_INSTALL_DIR: "./.dotnet"
Solution_Name: AElf.All.sln
Service_Name: AELF

jobs:
test:
runs-on: ubuntu-latest
permissions:
pull-requests: write
contents: write
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup dotnet
uses: actions/setup-dotnet@v4
with:
dotnet-version: '6.0'

- name: 'Download AElf build tools'
run: bash scripts/download_binary.sh

- name: 'Install protobuf'
run: bash scripts/install_protobuf.sh

- name: Install dependencies
run: dotnet restore bench/AElf.Benchmark/AElf.Benchmark.csproj --verbosity quiet

- name: BenchMark
run: |
cd bench/AElf.Benchmark
dotnet run --filter '*MinerTests*'
- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ env.Service_Name }}
path: bench/AElf.Benchmark/BenchmarkDotNet.Artifacts/results
retention-days: 30
49 changes: 49 additions & 0 deletions .github/workflows/sonarqube.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
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":"8.0.7"}}' > ./global.json
- 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: Install protobuf
run: sudo apt-get update && sudo apt-get install -y protobuf-compiler
- name: Begin SonarQube analysis
run: |
./.sonar/scanner/dotnet-sonarscanner begin /k:"AElf" /d:sonar.host.url="${{ secrets.SONAR_HOST_URL }}" /d:sonar.token="${{ secrets.SONAR_TOKEN }}"
dotnet build AElf.All.sln
./.sonar/scanner/dotnet-sonarscanner end /d:sonar.token="${{ secrets.SONAR_TOKEN }}"
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -312,4 +312,4 @@ tools
.idea/.idea.AElf/.idea/projectSettingsUpdater.xml
.idea/.idea.AElf/.idea/vcs.xml
.idea/.idea.AElf/.idea/workspace.xml
.idea/.idea.AElf/riderModule.iml
.idea/.idea.AElf/riderModule.iml
2 changes: 1 addition & 1 deletion .readthedocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ sphinx:
# Optionally build your docs in additional formats such as PDF and ePub
formats: all

# Optionally set the version of Python and requirements required to build your docs
# Optionally set the version of python and requirements required to build your docs
python:
version: 3.7
install:
Expand Down
3 changes: 2 additions & 1 deletion AElf.ContractTools.targets
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@
</PropertyGroup>
</Otherwise>
</Choose>


<!-- Generate protobuf code before building and getting the target path -->
<Target Name="GenerateProtobufCode" BeforeTargets="BeforeBuild;GetTargetPath">
<PropertyGroup>
<LocalProtobufDir>$(ProjectDir)/Protobuf</LocalProtobufDir>
Expand Down
3 changes: 1 addition & 2 deletions AElf.Contracts.sln
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@

Microsoft Visual Studio Solution File, Format Version 12.00
Microsoft Visual Studio Solution File, Format Version 12.00
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "contract", "contract", "{651F0F6E-86CF-42D2-9110-5F3EAE5704F0}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{26990847-E0A2-4FCC-8C71-267CA77557CD}"
Expand Down
29 changes: 16 additions & 13 deletions AElf.sln.DotSettings
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:s="clr-namespace:System;assembly=mscorlib"
xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml"
xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<s:Boolean x:Key="/Default/CodeEditing/SuppressNullableWarningFix/Enabled/@EntryValue">False</s:Boolean>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=JS/@EntryIndexedValue">JS</s:String>
<s:Boolean x:Key="/Default/UserDictionary/Words/=aelf/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=appsettings/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=blockchain/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Blockchains/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=DPOS/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=grpc/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=hangfire/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Merkle/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=pubkey/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Ssdb/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Xunit/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=JS/@EntryIndexedValue">JS</s:String>
<s:Boolean x:Key="/Default/UserDictionary/Words/=aelf/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=appsettings/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=blockchain/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Blockchains/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=DPOS/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=grpc/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=hangfire/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Merkle/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=pubkey/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Ssdb/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Xunit/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>
1 change: 1 addition & 0 deletions CodeCoverage.runsettings
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- This XML defines run settings for code coverage. -->
<!-- File name extension must be .runsettings -->
<RunSettings>
<DataCollectionRunSettings>
Expand Down
1 change: 1 addition & 0 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# appveyor configuration file
version: 1.0.0.{build}
skip_tags: true
os: Windows Server 2012 R2
Expand Down
1 change: 1 addition & 0 deletions azure-myget-publish.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Azure DevOps pipeline configuration for publishing NuGet packages to MyGet
pool:
vmImage: ubuntu-latest
pr: none
Expand Down
2 changes: 1 addition & 1 deletion azure-pipelines.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# File: azure-pipelines.yml
# Azure Pipelines configuration file
jobs:
- template: templates/build-template-window.yml
parameters:
Expand Down
82 changes: 82 additions & 0 deletions bench/AElf.Benchmark/HtmlSummaryExporter.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
using BenchmarkDotNet.Exporters;
using BenchmarkDotNet.Loggers;
using BenchmarkDotNet.Reports;

using System.Collections.Generic;
using System.IO;


public class HtmlSummaryExporter : IExporter
{
public string Name => nameof(HtmlSummaryExporter);

public void ExportToLog(Summary summary, ILogger logger)
{

}

public IEnumerable<string> ExportToFiles(Summary summary, ILogger consoleLogger)
{
string directoryPath = summary.ResultsDirectoryPath;
string outputPath = Path.Combine(directoryPath, "Summary.html");

var htmlFiles = Directory.GetFiles(directoryPath, "*.html");

using (StreamWriter writer = new StreamWriter(outputPath))
{
writer.WriteLine("<html>");
writer.WriteLine("<head>");
writer.WriteLine("<title>Benchmark Summary</title>");

writer.WriteLine("<style>");
foreach (var file in htmlFiles)
{
string content = File.ReadAllText(file);
string styleContent = GetStyleContent(content);
writer.WriteLine(styleContent);
}
writer.WriteLine("</style>");

writer.WriteLine("</head>");
writer.WriteLine("<body>");

foreach (var file in htmlFiles)
{
string fileName = Path.GetFileName(file);
writer.WriteLine($"<h2>{fileName}</h2>");
string content = File.ReadAllText(file);
string bodyContent = GetBodyContent(content);
writer.WriteLine(bodyContent);
}

writer.WriteLine("</body>");
writer.WriteLine("</html>");
}

consoleLogger.WriteLine($"Summary HTML file created successfully at {outputPath}.");

return new[] { outputPath };
}

private string GetBodyContent(string html)
{
int bodyStartIndex = html.IndexOf("<body>") + "<body>".Length;
int bodyEndIndex = html.IndexOf("</body>");
if (bodyStartIndex >= 0 && bodyEndIndex >= 0)
{
return html.Substring(bodyStartIndex, bodyEndIndex - bodyStartIndex);
}
return string.Empty;
}

private string GetStyleContent(string html)
{
int styleStartIndex = html.IndexOf("<style>") + "<style>".Length;
int styleEndIndex = html.IndexOf("</style>");
if (styleStartIndex >= 0 && styleEndIndex >= 0)
{
return html.Substring(styleStartIndex, styleEndIndex - styleStartIndex);
}
return string.Empty;
}
}
Loading

0 comments on commit db228e8

Please sign in to comment.