Skip to content

Commit

Permalink
fix: Fix errors caused by running CI.
Browse files Browse the repository at this point in the history
  • Loading branch information
s2quake committed Jun 18, 2024
1 parent 233c11d commit 4a8eb14
Show file tree
Hide file tree
Showing 14 changed files with 100 additions and 87 deletions.
12 changes: 8 additions & 4 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ commands:
steps:
- checkout
- concat_files:
glob: "*/*.csproj"
glob: "{src,test,tools}/*/*.csproj"
to: .combined-package-files.txt
- restore_cache:
keys:
Expand Down Expand Up @@ -105,14 +105,18 @@ commands:
root: .
paths:
- <<parameters.collect_tests_to>>
- "*/bin/"
- "*/obj/"
- "src/*/bin/"
- "src/*/obj/"
- "test/*/bin/"
- "test/*/obj/"
- "tools/*/bin/"
- "tools/*/obj/"

mono_build_base:
steps:
- checkout
- concat_files:
glob: "*/*.csproj"
glob: "{src,test,tools}/*/*.csproj"
to: .combined-package-files.txt
- restore_cache:
keys:
Expand Down
40 changes: 20 additions & 20 deletions .github/bin/constants.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,29 +3,29 @@
# shellcheck disable=SC2034
solution="Libplanet"
projects=(
"Libplanet"
"Libplanet.Action"
"Libplanet.Common"
"Libplanet.Crypto"
"Libplanet.Crypto.Secp256k1"
"Libplanet.Mocks"
"Libplanet.Net"
"Libplanet.Store"
"Libplanet.Store.Remote"
"Libplanet.Stun"
"Libplanet.Types"
"Libplanet.RocksDBStore"
"Libplanet.Analyzers"
"Libplanet.Tools"
"Libplanet.Explorer"
"Libplanet.Explorer.Executable"
"Libplanet.Explorer.Cocona"
"Libplanet.Extensions.Cocona"
"src/Libplanet"
"src/Libplanet.Action"
"src/Libplanet.Common"
"src/Libplanet.Crypto"
"src/Libplanet.Crypto.Secp256k1"
"src/Libplanet.Net"
"src/Libplanet.Store"
"src/Libplanet.Store.Remote"
"src/Libplanet.Stun"
"src/Libplanet.Types"
"src/Libplanet.RocksDBStore"
"test/Libplanet.Mocks"
"tools/Libplanet.Analyzers"
"tools/Libplanet.Tools"
"tools/Libplanet.Explorer"
"tools/Libplanet.Explorer.Executable"
"tools/Libplanet.Explorer.Cocona"
"tools/Libplanet.Extensions.Cocona"
)
configuration=Release
executables=(
"Libplanet.Tools"
"Libplanet.Explorer.Executable"
"tools/Libplanet.Tools"
"tools/Libplanet.Explorer.Executable"
)
npm_packages=(
"@planetarium/cli"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/benchmarks-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
with:
dotnet-version: 6.0.x
- name: Run benchmark
run: dotnet run --project Libplanet.Benchmarks -c Release -- --exporters json --filter '*'
run: dotnet run --project tools/Libplanet.Benchmarks -c Release -- --exporters json --filter '*'

- name: Compare benchmark result
uses: planetarium/github-action-benchmark@v1
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/yarn.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -61,15 +61,15 @@ jobs:
- if: runner.os != 'Windows'
run: |
set -ev
cd Libplanet.Tools/
cd tools/Libplanet.Tools/
bin/npm-test.sh "$LATEST_VERSION"
env:
LATEST_VERSION: ${{ steps.latest-tag.outputs.tag }}
- if: runner.os == 'Windows'
shell: pwsh
run: |
$ErrorActionPreference = "Stop"
cd Libplanet.Tools\
cd tools\Libplanet.Tools\
pwsh `
-ExecutionPolicy Bypass `
-File bin\npm-test.ps1 `
Expand Down
2 changes: 1 addition & 1 deletion @planetarium/cli
4 changes: 2 additions & 2 deletions @planetarium/tx/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
"scripts": {
"build": "yarn && nanobundle build",
"prepack": "yarn && yarn build",
"dev": "yarn && dotnet build ../../Libplanet.Tools && vitest",
"test": "yarn && yarn run -T tsc -p tsconfig.json && dotnet build ../../Libplanet.Tools && vitest run",
"dev": "yarn && dotnet build ../../tools/Libplanet.Tools && vitest",
"test": "yarn && yarn run -T tsc -p tsconfig.json && dotnet build ../../tools/Libplanet.Tools && vitest run",
"coverage": "yarn && vitest run --coverage"
},
"repository": {
Expand Down
24 changes: 12 additions & 12 deletions @planetarium/tx/test/tx/signed.test.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { encodeSignedTx, signTx } from "../../src/tx/signed";
import { type UnsignedTx } from "../../src/tx/unsigned";
import { account1, address1 } from "./fixtures";
import { join } from "node:path";
import { RecordView, encode } from "@planetarium/bencodex";
import { execa } from "execa";
import { join } from "node:path";
import { describe, expect, test } from "vitest";
import { encodeSignedTx, signTx } from "../../src/tx/signed";
import { type UnsignedTx } from "../../src/tx/unsigned";
import { account1, address1 } from "./fixtures";

describe("signTx", () => {
test("UnsignedTx", async () => {
Expand All @@ -30,28 +30,28 @@ describe("signTx", () => {
minters: [
Buffer.from(
"47d082a115c63e7b58b1532d20e631538eafadde",
"hex",
"hex"
),
],
ticker: "NCG",
},
"text",
"text"
),
1000n,
],
recipient: Buffer.from(
"5a533067D0cBa77490268b26195EdB10B990143D",
"hex",
"hex"
),
sender: Buffer.from(
"111CB8E18c6D70f5032000c5739c5ac36E793EDB",
"hex",
"hex"
),
},
"text",
"text"
),
},
"text",
"text"
),
],
};
Expand All @@ -64,13 +64,13 @@ describe("signTx", () => {
"run",
"--no-build",
"--project",
join(__dirname, "..", "..", "..", "..", "Libplanet.Tools"),
join(__dirname, "..", "..", "..", "..", "tools", "Libplanet.Tools"),
"--",
"tx",
"analyze",
"-",
],
{ input: payload },
{ input: payload }
);
expect(JSON.parse(stdout)).toStrictEqual({
id: "49a645bb80fa96757009615ec33bc15a2e90e9121877de9f14de35b7d657a118",
Expand Down
22 changes: 11 additions & 11 deletions @planetarium/tx/test/tx/unsigned.test.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { encodeUnsignedTx } from "../../src/tx/unsigned";
import { key1 } from "./fixtures";
import { join } from "node:path";
import { RecordView, encode } from "@planetarium/bencodex";
import { execa } from "execa";
import { join } from "node:path";
import { expect, test } from "vitest";
import { encodeUnsignedTx } from "../../src/tx/unsigned";
import { key1 } from "./fixtures";

test("encodeUnsignedTx", async () => {
const encoded = encodeUnsignedTx({
Expand All @@ -28,25 +28,25 @@ test("encodeUnsignedTx", async () => {
new Uint8Array(
Buffer.from(
"47d082a115c63e7b58b1532d20e631538eafadde",
"hex",
),
"hex"
)
),
],
ticker: "NCG",
},
"text",
"text"
),
1000n,
],
recipient: new Uint8Array(
Buffer.from("5a533067D0cBa77490268b26195EdB10B990143D", "hex"),
Buffer.from("5a533067D0cBa77490268b26195EdB10B990143D", "hex")
),
sender: new Uint8Array(
Buffer.from("111CB8E18c6D70f5032000c5739c5ac36E793EDB", "hex"),
Buffer.from("111CB8E18c6D70f5032000c5739c5ac36E793EDB", "hex")
),
},
},
"text",
"text"
),
],
});
Expand All @@ -57,7 +57,7 @@ test("encodeUnsignedTx", async () => {
"run",
"--no-build",
"--project",
join(__dirname, "..", "..", "..", "..", "Libplanet.Tools"),
join(__dirname, "..", "..", "..", "..", "tools", "Libplanet.Tools"),
"--",
"tx",
"analyze",
Expand All @@ -66,7 +66,7 @@ test("encodeUnsignedTx", async () => {
],
{
input: Buffer.from(payload),
},
}
);
expect(JSON.parse(stdout)).toStrictEqual({
nonce: 123,
Expand Down
35 changes: 17 additions & 18 deletions Docs/docfx.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,20 @@
"src": [
{
"files": [
"Libplanet/Libplanet.csproj",
"Libplanet.Action/Libplanet.Action.csproj",
"Libplanet.Common/Libplanet.Common.csproj",
"Libplanet.Crypto/Libplanet.Crypto.csproj",
"Libplanet.Crypto.Secp256k1/Libplanet.Crypto.Secp256k1.csproj",
"Libplanet.Explorer.Cocona/Libplanet.Explorer.Cocona.csproj",
"Libplanet.Extensions.Cocona/Libplanet.Extensions.Cocona.csproj",
"Libplanet.Mocks/Libplanet.Mocks.csproj",
"Libplanet.Net/Libplanet.Net.csproj",
"Libplanet.RocksDBStore/Libplanet.RocksDBStore.csproj",
"Libplanet.Store/Libplanet.Store.csproj",
"Libplanet.Store.Remote/Libplanet.Store.Remote.csproj",
"Libplanet.Stun/Libplanet.Stun.csproj",
"Libplanet.Types/Libplanet.Types.csproj"
"src/Libplanet/Libplanet.csproj",
"src/Libplanet.Action/Libplanet.Action.csproj",
"src/Libplanet.Common/Libplanet.Common.csproj",
"src/Libplanet.Crypto/Libplanet.Crypto.csproj",
"src/Libplanet.Crypto.Secp256k1/Libplanet.Crypto.Secp256k1.csproj",
"tools/Libplanet.Explorer.Cocona/Libplanet.Explorer.Cocona.csproj",
"tools/Libplanet.Extensions.Cocona/Libplanet.Extensions.Cocona.csproj",
"test/Libplanet.Mocks/Libplanet.Mocks.csproj",
"src/Libplanet.Net/Libplanet.Net.csproj",
"src/Libplanet.RocksDBStore/Libplanet.RocksDBStore.csproj",
"src/Libplanet.Store/Libplanet.Store.csproj",
"src/Libplanet.Store.Remote/Libplanet.Store.Remote.csproj",
"src/Libplanet.Stun/Libplanet.Stun.csproj",
"src/Libplanet.Types/Libplanet.Types.csproj"
],
"exclude": ["**/bin/**", "**/obj/**"],
"src": "../"
Expand Down Expand Up @@ -48,22 +48,22 @@
]
},
{
"src": "../Libplanet.Analyzers",
"src": "../tools/Libplanet.Analyzers",
"dest": "analyzer",
"files": [
"*.md",
"rules/*.md"
]
},
{
"src": "../Libplanet.Tools",
"src": "../tools/Libplanet.Tools",
"dest": "cli",
"files": [
"*.md"
]
},
{
"src": "../Libplanet.Explorer",
"src": "../tools/Libplanet.Explorer",
"dest": "explorer",
"files": [
"*.md"
Expand Down Expand Up @@ -111,7 +111,6 @@
"fileMetadataFiles": [],

"template": ["default"],
// "statictoc" has a bug that relative links with nested dirs in nav refer to incorrect destinations

"theme": ["theme"],
"postProcessors": [],
Expand Down
5 changes: 3 additions & 2 deletions hooks/check-projects
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ if ! [[ -f "$SOLUTION" ]]; then
fi

list-projects() {
dotnet sln "$SOLUTION" list | grep -E $'\\...proj\r?$' | sed 's/[/\].*//'
dotnet sln "$SOLUTION" list | grep -E $'\\...proj\r?$' | sed 's/[/][^/]*$//'
}

# shellcheck source=.github/bin/constants.sh
Expand All @@ -26,7 +26,8 @@ check-github-actions() {
}

check-contributing() {
if ! grep -E "^ - \*$1\*: " CONTRIBUTING.md > /dev/null; then
name=$(echo "$1" | sed -re 's/(src|tools|test)\///')
if ! grep -E "^ - \*$name\*: " CONTRIBUTING.md > /dev/null; then
echo "The project $1 is not documented in the CONTRIBUTING.md file." \
> /dev/stderr
exit 1
Expand Down
2 changes: 1 addition & 1 deletion hooks/pre-commit
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ if command -v yarn --help > /dev/null; then
# FIXME: The following workaround should be removed when Rome fixes their bug
# which fails to resolve symlinks referring to the parent directory.
rm -f @planetarium/cli
trap "ln -sf ../Libplanet.Tools @planetarium/cli" EXIT
trap "ln -sf ../tools/Libplanet.Tools @planetarium/cli" EXIT
yarn rome check .
else
echo warn: yarn is not available\; not running commands pertaining to node.js. >&2
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"@planetarium/account-aws-kms",
"@planetarium/account-web3-secret-storage",
"@planetarium/tx",
"Libplanet.Tools"
"tools/Libplanet.Tools"
],
"scripts": {
"build": "printf \"\\033[41;97mLibplanet note: currently, it is expected for `yarn build` to fail on the first run and succeed on the second run due to an unknown issue unrelated to the codebase (see issue #3492,) so the build phase runs twice. Whenever the culprit is specified please remove this message and the duplicate call.\\033[0m\n\" >&2 && _libplanet_build=1 yarn workspaces foreach -p -A run build || _libplanet_build=1 yarn workspaces foreach -p -A run build",
Expand Down
9 changes: 3 additions & 6 deletions test/Libplanet.Tests/Tx/TxSigningMetadataTest.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
namespace Libplanet.Tests.Tx
{
public class X {

}
}
namespace Libplanet.Tests.Tx {
class X {}
}
Loading

0 comments on commit 4a8eb14

Please sign in to comment.