Skip to content

Commit

Permalink
Merge pull request #3632 from s2quake/feature/ci-without-net
Browse files Browse the repository at this point in the history
Separate Net tests from the platform-specific main tests.
  • Loading branch information
riemannulus authored Jan 30, 2024
2 parents 7398a22 + 41f1b99 commit ae6de1a
Show file tree
Hide file tree
Showing 14 changed files with 87 additions and 67 deletions.
125 changes: 71 additions & 54 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ commands:
- restore_cache:
keys:
- "v1-codecov"
when: always
- run:
name: Upload a code coverage report file to Codecov.io
shell: bash
Expand Down Expand Up @@ -65,6 +64,9 @@ commands:
collect_tests_to:
type: string
default: .tests.txt
collect_tests_filter:
type: string
default: ""
steps:
- checkout
- concat_files:
Expand All @@ -89,7 +91,7 @@ commands:
[[ -d /usr/local/share/dotnet ]]; then
export PATH="/usr/local/share/dotnet:$PATH"
fi
dotnet test --no-restore --no-build -c Release --list-tests \
dotnet test --no-restore --no-build -c Release --list-tests --filter "<<parameters.collect_tests_filter>>" \
> .dotnet-list-tests.txt
grep ' ' .dotnet-list-tests.txt \
| sed 's/ /\n /g' \
Expand Down Expand Up @@ -183,51 +185,14 @@ commands:
else
head -n $part .head_tests.txt > .current_tests.txt
fi
excluded_tests=(
Libplanet.Net.Tests.Protocols.ProtocolTest.KademliaTest
Libplanet.Net.Tests.Protocols.ProtocolTest.Start
Libplanet.Net.Tests.Protocols.ProtocolTest.Ping
Libplanet.Net.Tests.Protocols.ProtocolTest.PingTwice
Libplanet.Net.Tests.Protocols.ProtocolTest.PingToClosedPeer
Libplanet.Net.Tests.Protocols.ProtocolTest.BootstrapException
Libplanet.Net.Tests.Protocols.ProtocolTest.BootstrapAsyncTest
Libplanet.Net.Tests.Protocols.ProtocolTest.RemoveStalePeers
Libplanet.Net.Tests.Protocols.ProtocolTest.RoutingTableFull
Libplanet.Net.Tests.Protocols.ProtocolTest.ReplacementCache
Libplanet.Net.Tests.Protocols.ProtocolTest.RemoveDeadReplacementCache
Libplanet.Net.Tests.Protocols.ProtocolTest.BroadcastMessage
Libplanet.Net.Tests.Protocols.ProtocolTest.BroadcastGuarantee
Libplanet.Net.Tests.Protocols.ProtocolTest.DoNotBroadcastToSourcePeer
Libplanet.Net.Tests.Protocols.ProtocolTest.RefreshTable
Libplanet.Extensions.Cocona.Tests.Commands.StatsCommandTest.SummaryInvalidArguments
Libplanet.Extensions.Cocona.Tests.Commands.StoreCommandTest.TestInvalidArguments
Libplanet.Extensions.Cocona.Tests.Commands.StoreCommandTest.TestBlockByTxIdNotExist
Libplanet.Extensions.Cocona.Tests.Commands.StoreCommandTest.TestBlockByTxIdTwo
Libplanet.Extensions.Cocona.Tests.Commands.StoreCommandTest.TestBlockHashesByTxId
Libplanet.Extensions.Cocona.Tests.Commands.StoreCommandTest.TestBuildIndexTxBlockBlockByTxId
Libplanet.Extensions.Cocona.Tests.Commands.StoreCommandTest.TestBlockByHashNotExists
Libplanet.Extensions.Cocona.Tests.Commands.StoreCommandTest.TestBlockByHash
Libplanet.Extensions.Cocona.Tests.Commands.StoreCommandTest.TestBlockByIndexNotExists
Libplanet.Extensions.Cocona.Tests.Commands.StoreCommandTest.TestBlockByIndex
Libplanet.Extensions.Cocona.Tests.Commands.StoreCommandTest.TestTxByIdNotExists
Libplanet.Extensions.Cocona.Tests.Commands.StoreCommandTest.TestTxById
)
cat .current_tests.txt
first=1
while read test; do
to_write=1
for excl in "${excluded_tests[@]}"; do
if [[ "$test" == "$excl"* ]]; then
to_write=0
fi
done
if [[ "$to_write" == "1" ]]; then
if [[ "$first" = "1" ]]; then
echo "FullyQualifiedName=$test"
first=0
else
echo "| FullyQualifiedName=$test"
fi
if [[ "$first" = "1" ]]; then
echo "FullyQualifiedName=$test"
first=0
else
echo "| FullyQualifiedName=$test"
fi
done < .current_tests.txt > .test-filter.txt
- when:
Expand All @@ -245,7 +210,7 @@ commands:
--dcDisableDefaultFilters
--dcReportType=DetailedXML
--dcFilters="+:Libplanet;+:Libplanet.*;-:Libplanet.Tests;-:Libplanet.*.Tests;-:Libplanet.*.UnitTests;-:Libplanet.Benchmarks;-:Libplanet.Explorer"
no_output_timeout: 180s
no_output_timeout: 360s
environment:
LC_ALL: "<<parameters.locale>>"
LANG: "<<parameters.locale>>"
Expand All @@ -257,6 +222,20 @@ commands:
- unless:
condition: "<<parameters.code_coverage>>"
steps:
- run:
name: Display tests
command: >-
dotnet test
--no-restore
--no-build
-c Release
-l "junit;FailureBodyFormat=Verbose;LogFilePath=/tmp/junit/{assembly}.xml"
--filter "$(cat .test-filter.txt)"
--list-tests | grep -E " .+"
environment:
LC_ALL: "<<parameters.locale>>"
LANG: "<<parameters.locale>>"
LANGUAGE: "<<parameters.locale>>"
- run:
name: Run tests
command: >-
Expand All @@ -266,7 +245,7 @@ commands:
-c Release
-l "junit;FailureBodyFormat=Verbose;LogFilePath=/tmp/junit/{assembly}.xml"
--filter "$(cat .test-filter.txt)"
no_output_timeout: 180s
no_output_timeout: 360s
environment:
LC_ALL: "<<parameters.locale>>"
LANG: "<<parameters.locale>>"
Expand Down Expand Up @@ -439,11 +418,17 @@ commands:

jobs:
linux-netcore-build:
parameters:
collect_tests_filter:
type: string
default: ""
docker:
- image: mcr.microsoft.com/dotnet/sdk:6.0
resource_class: xlarge
working_directory: /mnt/ramdisk
steps: [netcore_build_base]
steps:
- netcore_build_base:
collect_tests_filter: "<<parameters.collect_tests_filter>>"

linux-mono-build:
docker:
Expand All @@ -453,14 +438,18 @@ jobs:
steps: [mono_build_base]

linux-netcore-test-netmq:
parameters:
parallelism:
type: integer
default: 4
docker:
- image: mcr.microsoft.com/dotnet/sdk:6.0
environment:
TRANSPORT_TYPE: netmq
resource_class: xlarge
working_directory: /mnt/ramdisk
parallelism: 4
steps:
parallelism: <<parameters.parallelism>>
steps:
- linux_netcore_test_base:
code_coverage: false

Expand All @@ -487,19 +476,28 @@ jobs:
code_coverage: false

macos-netcore-test:
parameters:
parallelism:
type: integer
default: 4
macos:
xcode: 14.3.1
resource_class: macos.m1.medium.gen1
parallelism: 4
parallelism: <<parameters.parallelism>>
steps:
- macos_netcore_test_base: { code_coverage: false }

windows-netcore-test:
parameters:
parallelism:
type: integer
default: 6
executor:
name: win/server-2022
size: xlarge
parallelism: 6
steps: [netcore_test_base]
parallelism: <<parameters.parallelism>>
steps:
- netcore_test_base: { code_coverage: false }

linux-unity-test:
docker:
Expand All @@ -517,7 +515,7 @@ jobs:

macos-unity-test:
macos:
xcode: 11.3.0
xcode: 15.2.0
environment:
XUNIT_UNITY_RUNNER: 0.5.0
parallelism: 3
Expand All @@ -543,7 +541,8 @@ jobs:
workflows:
main:
jobs:
- linux-netcore-build
- linux-netcore-build:
collect_tests_filter: "FullyQualifiedName!~Libplanet.Net.Tests & CircleCI!=Skip"
# Temporarily tunred off by excluding of linux-unity-test
#- linux-mono-build
- linux-netcore-test-netmq:
Expand All @@ -565,3 +564,21 @@ workflows:
# requires: [linux-mono-build]
#- windows-unity-test:
# requires: [linux-mono-build]
net:
jobs:
- linux-netcore-build:
name: linux-netcore-build-net
collect_tests_filter: "FullyQualifiedName~Libplanet.Net.Tests"
- linux-netcore-test-netmq:
name: linux-netcore-test-netmq-net
requires: [linux-netcore-build-net]
parallelism: 1
# - macos-netcore-test:
# name: macos-netcore-test-net
# requires: [linux-netcore-build-net]
# parallelism: 1
- windows-netcore-test:
name: windows-netcore-test-net
requires: [linux-netcore-build-net]
parallelism: 1

2 changes: 1 addition & 1 deletion Libplanet.Action.Tests/Libplanet.Action.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
<PackageReference Include="xRetry" Version="1.5.0" />
<PackageReference Include="xunit" Version="2.4.1" />
<PackageReference Include="xunit.extensibility.execution" Version="2.4.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.6" />
<PackageReference Include="Xunit.SkippableFact" Version="1.3.12" />
</ItemGroup>

Expand Down
8 changes: 4 additions & 4 deletions Libplanet.Analyzers.Tests/Libplanet.Analyzers.Tests.csproj
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<IsPackable>false</IsPackable>
<IsPackable>false</IsPackable>
<CheckForOverflowUnderflow>true</CheckForOverflowUnderflow>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<IsTestProject>true</IsTestProject>
<LangVersion>7.1</LangVersion>
<NoWarn>$(NoWarn);SA1401</NoWarn>
<NoWarn>$(NoWarn);SA1401</NoWarn>
<CodeAnalysisRuleSet>..\Libplanet.Tests.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>

Expand All @@ -22,7 +22,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="JunitXml.TestLogger" Version="3.0.98" />
<PackageReference Include="JunitXml.TestLogger" Version="3.0.98" />
<PackageReference
Include="Menees.Analyzers.2017"
Version="2.0.3"
Expand Down Expand Up @@ -50,7 +50,7 @@
</PackageReference>
<PackageReference Include="xunit" Version="2.4.1" />
<PackageReference Include="xunit.extensibility.execution" Version="2.4.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.6" />
</ItemGroup>

<ItemGroup Condition="'$(SkipSonar)' != 'true'">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
<PackageReference Include="System.Collections.Immutable" Version="1.7.*" />
<PackageReference Include="xunit" Version="2.4.1" />
<PackageReference Include="xunit.extensibility.execution" Version="2.4.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.6" />
</ItemGroup>

<ItemGroup Condition="'$(SkipSonar)' != 'true'">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
</PackageReference>
<PackageReference Include="xunit" Version="2.4.1" />
<PackageReference Include="xunit.extensibility.execution" Version="2.4.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.3" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.6" />
</ItemGroup>

<ItemGroup Condition="'$(SkipSonar)' != 'true'">
Expand Down
2 changes: 1 addition & 1 deletion Libplanet.Explorer.Tests/Libplanet.Explorer.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<PackageReference Include="JunitXml.TestLogger" Version="3.0.98" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.8.3" />
<PackageReference Include="xunit" Version="2.4.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.3" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.6" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ public StatsCommandTest()
}

[SkippableFact]
[Trait("CircleCI", "Skip")]
public void SummaryInvalidArguments()
{
string badPathFormat = "rocksdb+foo+bar://" + "/bar";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

namespace Libplanet.Extensions.Cocona.Tests.Commands;

[Trait("CircleCI", "Skip")]
public class StoreCommandTest : IDisposable
{
private readonly ImmutableArray<StoreFixture> _storeFixtures;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
<PackageReference Include="System.Collections.Immutable" Version="1.7.*" />
<PackageReference Include="xunit" Version="2.4.1" />
<PackageReference Include="xunit.extensibility.execution" Version="2.4.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.6" />
</ItemGroup>

<ItemGroup Condition="'$(SkipSonar)' != 'true'">
Expand Down
2 changes: 1 addition & 1 deletion Libplanet.Net.Tests/Libplanet.Net.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
</PackageReference>
<PackageReference Include="xunit" Version="2.4.2" />
<PackageReference Include="xunit.extensibility.execution" Version="2.4.2" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.6" />
<PackageReference Include="Xunit.SkippableFact" Version="1.3.12" />
</ItemGroup>

Expand Down
1 change: 1 addition & 0 deletions Libplanet.Net.Tests/Protocols/ProtocolTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

namespace Libplanet.Net.Tests.Protocols
{
[Trait("CircleCI", "Skip")]
public class ProtocolTest
{
private const int Timeout = 60 * 1000;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
<PackageReference Include="System.Collections.Immutable" Version="1.7.*" />
<PackageReference Include="xunit" Version="2.4.1" />
<PackageReference Include="xunit.extensibility.execution" Version="2.4.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.6" />
</ItemGroup>

<ItemGroup Condition="'$(SkipSonar)' != 'true'">
Expand Down
2 changes: 1 addition & 1 deletion Libplanet.Stun.Tests/Libplanet.Stun.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
</PackageReference>
<PackageReference Include="xunit" Version="2.4.1" />
<PackageReference Include="xunit.extensibility.execution" Version="2.4.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.1">
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.6">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>
runtime; build; native; contentfiles; analyzers
Expand Down
2 changes: 1 addition & 1 deletion Libplanet.Tests/Libplanet.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
<PackageReference Include="xRetry" Version="1.5.0" />
<PackageReference Include="xunit" Version="2.4.1" />
<PackageReference Include="xunit.extensibility.execution" Version="2.4.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.6" />
<PackageReference Include="Xunit.SkippableFact" Version="1.3.12" />
</ItemGroup>

Expand Down

0 comments on commit ae6de1a

Please sign in to comment.