Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into frontend
Browse files Browse the repository at this point in the history
To bring the build/CI improvements.
  • Loading branch information
knocte committed Aug 12, 2023
2 parents 7a94774 + a74f731 commit 2dec7cb
Show file tree
Hide file tree
Showing 12 changed files with 116 additions and 46 deletions.
109 changes: 85 additions & 24 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ jobs:
find . -type f -name "*.fsx" | xargs -t -I {} dotnet fsxc {}
macOS--mono:
macOS--mono-only:
runs-on: macOS-latest
steps:
- uses: actions/checkout@v1
Expand All @@ -64,7 +64,30 @@ jobs:
- name: integration tests
run: make update-servers

windows--dotnet6:
macOS--dotnet6-only:
runs-on: macOS-latest
steps:
- uses: actions/checkout@v1
with:
submodules: false
- name: HACK to emulate mono uninstall
run: sudo rm -f `which mono` && sudo rm -f `which msbuild`
- name: configure
run: ./configure.sh
- name: build in DEBUG mode
run: make
- name: sanity check
run: make sanitycheck
- name: unit tests
run: make check
- name: build in STRICT mode
run: git clean -fdx && ./configure.sh && make strict
- name: build in RELEASE mode
run: git clean -fdx && ./configure.sh && make release
- name: integration tests
run: make update-servers

windows--dotnet6-and-legacyFramework:
runs-on: windows-latest
steps:
- uses: actions/checkout@v1
Expand Down Expand Up @@ -98,7 +121,7 @@ jobs:
find . -type f -name "*.fsx" | xargs -t -I {} dotnet fsxc {}
windows--legacyFramework:
windows--legacyFramework-only:
runs-on: windows-2019
steps:
- uses: actions/checkout@v1
Expand All @@ -121,7 +144,43 @@ jobs:
- name: integration tests
run: .\make update-servers

linux22-github:
windows--dotnet6-only:
runs-on: windows-latest
steps:
- uses: actions/checkout@v1
with:
submodules: false
- name: Setup .NET SDK 6.0.x
uses: actions/[email protected]
with:
dotnet-version: '6.0.113'
- name: HACK to emulate legacy .NETFramework uninstall
run: del $(& "${Env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe" -find MSBuild\\**\\Bin\\MSBuild.exe)
- name: configure
run: .\configure.bat
- name: build in DEBUG mode
run: .\make.bat
- name: sanity check
run: .\make.bat sanitycheck
- name: unit tests
run: .\make.bat check
- name: re-build in STRICT mode
run: git clean -fdx && .\configure.bat && .\make.bat strict
- name: re-build in RELEASE mode
run: git clean -fdx && .\configure.bat && .\make.bat release
- name: integration tests
run: .\make update-servers
- name: compile .fsx scripts
shell: bash
run: |
dotnet new tool-manifest
# we need to install specific version because of this bug: https://github.com/dotnet/sdk/issues/24037
dotnet tool install fsxc --version 0.5.9.1
find . -type f -name "*.fsx" | xargs -t -I {} dotnet fsxc {}
linux22-github--dotnet-and-mono:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v1
Expand All @@ -146,7 +205,7 @@ jobs:
- name: integration tests
run: make update-servers

linux22-github--newmono:
linux22-github--dotnet-and-newmono:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v1
Expand Down Expand Up @@ -176,7 +235,7 @@ jobs:
- name: integration tests
run: make update-servers

linux22-vanilla--stockmono:
linux22-vanilla--stockmono-only:
runs-on: ubuntu-22.04
container:
image: "ubuntu:22.04"
Expand Down Expand Up @@ -212,7 +271,7 @@ jobs:
- name: integration tests
run: make update-servers

linux22-vanilla--stockdotnet6:
linux22-vanilla--stockdotnet6-only:
runs-on: ubuntu-22.04
container:
image: "ubuntu:22.04"
Expand Down Expand Up @@ -340,7 +399,7 @@ jobs:
find . -type f -name "*.fsx" | xargs -t -I {} dotnet fsxc {}
linux22-vanilla--newmono:
linux22-vanilla--newmono-only:
runs-on: ubuntu-22.04
container:
image: "ubuntu:22.04"
Expand Down Expand Up @@ -382,7 +441,7 @@ jobs:
run: make update-servers


linux20-github:
linux20-github--dotnet-and-mono:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v1
Expand All @@ -407,7 +466,7 @@ jobs:
- name: integration tests
run: make update-servers

linux20-github--newmono:
linux20-github--dotnet-and-newmono:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v1
Expand Down Expand Up @@ -435,7 +494,7 @@ jobs:
- name: integration tests
run: make update-servers

linux20-vanilla--stockmono:
linux20-vanilla--stockmono-only:
runs-on: ubuntu-20.04
container:
image: "ubuntu:20.04"
Expand Down Expand Up @@ -471,7 +530,7 @@ jobs:
- name: integration tests
run: make update-servers

linux20-vanilla--newmono:
linux20-vanilla--newmono-only:
runs-on: ubuntu-20.04
container:
image: "ubuntu:20.04"
Expand Down Expand Up @@ -517,21 +576,23 @@ jobs:
container:
image: "ubuntu:22.04"
needs:
- linux22-github
- linux22-github--newmono
- linux22-vanilla--stockmono
- linux22-vanilla--newmono
- linux22-vanilla--stockdotnet6
- linux22-github--dotnet-and-mono
- linux22-github--dotnet-and-newmono
- linux22-vanilla--stockmono-only
- linux22-vanilla--newmono-only
- linux22-vanilla--stockdotnet6-only
- linux22-vanilla--stockdotnet6-and-stockmono
- linux22-vanilla--stockdotnet6-and-newmono
- linux20-github
- linux20-github--newmono
- linux20-vanilla--stockmono
- linux20-vanilla--newmono
- windows--dotnet6
- windows--legacyFramework
- linux20-github--dotnet-and-mono
- linux20-github--dotnet-and-newmono
- linux20-vanilla--stockmono-only
- linux20-vanilla--newmono-only
- windows--dotnet6-and-legacyFramework
- windows--legacyFramework-only
- windows--dotnet6-only
- macOS--dotnet6-and-mono
- macOS--mono
- macOS--mono-only
- macOS--dotnet6-only

steps:
- uses: actions/checkout@v1
Expand Down
2 changes: 1 addition & 1 deletion scripts/bump.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ open System
open System.IO

#if !LEGACY_FRAMEWORK
#r "nuget: Fsdk"
#r "nuget: Fsdk, Version=0.6.0--date20230812-0646.git-2268d50"
#else
#r "System.Configuration"
open System.Configuration
Expand Down
14 changes: 12 additions & 2 deletions scripts/configure.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ open System
open System.IO

#if !LEGACY_FRAMEWORK
#r "nuget: Fsdk"
#r "nuget: Fsdk, Version=0.6.0--date20230812-0646.git-2268d50"
#else
#r "System.Configuration"
open System.Configuration
Expand All @@ -27,7 +27,17 @@ let initialConfigFile, buildTool, areGtkLibsAbsentOrDoesNotApply =
match Process.ConfigCommandCheck ["dotnet"] false true with
| Some _ -> "dotnet"
| None ->
Process.VsWhere "MSBuild\\**\\Bin\\MSBuild.exe"
Console.Write "checking for msbuild... "
match Process.VsWhere "MSBuild\\**\\Bin\\MSBuild.exe" with
| None ->
Console.WriteLine "not found"
Console.Out.Flush()
Console.Error.WriteLine "Error, please install 'dotnet' aka .NET (6.0 or newer), and/or .NETFramework 4.x ('msbuild')"
Environment.Exit 1
failwith "Unreachable"
| Some msbuildPath ->
Console.WriteLine "found"
msbuildPath

Map.empty, buildTool, true
| platform (* Unix *) ->
Expand Down
2 changes: 1 addition & 1 deletion scripts/find.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ open System.IO
open System.Linq

#if !LEGACY_FRAMEWORK
#r "nuget: Fsdk"
#r "nuget: Fsdk, Version=0.6.0--date20230812-0646.git-2268d50"
#else
#r "System.Configuration"
#load "fsx/Fsdk/Misc.fs"
Expand Down
13 changes: 6 additions & 7 deletions scripts/make.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ open System.Xml.Linq
open System.Xml.XPath

#if !LEGACY_FRAMEWORK
#r "nuget: Fsdk"
#r "nuget: Fsdk, Version=0.6.0--date20230812-0646.git-2268d50"
#else
#r "System.Configuration"
open System.Configuration
Expand Down Expand Up @@ -160,18 +160,17 @@ let BuildSolution
let buildTool,buildArg = buildToolAndBuildArg

let configOption =
#if !LEGACY_FRAMEWORK
sprintf "--configuration %s" (binaryConfig.ToString())
#else
sprintf "/p:Configuration=%s" (binaryConfig.ToString())
#endif
if buildTool.StartsWith "dotnet" then
sprintf "--configuration %s" (binaryConfig.ToString())
else
sprintf "/p:Configuration=%s" (binaryConfig.ToString())

let defineConstantsFromBuildConfig =
match buildConfigContents |> Map.tryFind "DefineConstants" with
| Some constants -> constants.Split([|";"|], StringSplitOptions.RemoveEmptyEntries) |> Seq.ofArray
| None -> Seq.empty
let defineConstantsSoFar =
if buildTool <> "dotnet" then
if not (buildTool.StartsWith "dotnet") then
Seq.append ["LEGACY_FRAMEWORK"] defineConstantsFromBuildConfig
else
defineConstantsFromBuildConfig
Expand Down
2 changes: 1 addition & 1 deletion scripts/sanitycheck.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ open System.Xml.Linq
open System.Xml.XPath

#if !LEGACY_FRAMEWORK
#r "nuget: Fsdk"
#r "nuget: Fsdk, Version=0.6.0--date20230812-0646.git-2268d50"
#else
#r "System.Configuration"
open System.Configuration
Expand Down
2 changes: 1 addition & 1 deletion scripts/snap_release.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ open System.Xml.Linq
open System.Xml.XPath

#if !LEGACY_FRAMEWORK
#r "nuget: Fsdk"
#r "nuget: Fsdk, Version=0.6.0--date20230812-0646.git-2268d50"
#else
#r "System.Configuration"
open System.Configuration
Expand Down
8 changes: 4 additions & 4 deletions src/GWallet.Backend/Ether/EtherServer.fs
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ module Server =
let maybeRpcResponseEx = FSharpUtil.FindException<JsonRpcSharp.Client.RpcResponseException> ex
match maybeRpcResponseEx with
| Some rpcResponseEx ->
if rpcResponseEx.RpcError <> null then
if not (isNull rpcResponseEx.RpcError) then
match rpcResponseEx.RpcError.Code with
| a when a = int RpcErrorCode.JackOfAllTradesErrorCode ->
if not (err32kPossibleMessages.Any (fun msg -> rpcResponseEx.RpcError.Message.Contains msg)) then
Expand Down Expand Up @@ -494,7 +494,7 @@ module Server =
let! latestBlock =
web3.Eth.Blocks.GetBlockNumber.SendRequestAsync (null, cancelToken)
|> Async.AwaitTask
if (latestBlock = null) then
if isNull latestBlock then
failwith "latestBlock somehow is null"

let blockToCheck = BigInteger.Subtract(latestBlock.Value,
Expand Down Expand Up @@ -578,7 +578,7 @@ module Server =

let private GetConfirmedTokenBalanceInternal (web3: Web3) (publicAddress: string) (currency: Currency)
: Async<decimal> =
if (web3 = null) then
if isNull web3 then
invalidArg "web3" "web3 argument should not be null"

async {
Expand All @@ -587,7 +587,7 @@ module Server =
let contractAddress = TokenManager.GetTokenContractAddress currency

let contractHandler = web3.Eth.GetContractHandler contractAddress
if (contractHandler = null) then
if isNull contractHandler then
failwith "contractHandler somehow is null"

let! cancelToken = Async.CancellationToken
Expand Down
2 changes: 1 addition & 1 deletion src/GWallet.Backend/Ether/TokenManager.fs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ module TokenManager =
origin,
HexBigInteger(gasLimit),
tokenValue)
if (transactionInput = null) then
if isNull transactionInput then
failwith "Assertion failed: transaction input should not be null"
if transactionInput.To <> GetTokenContractAddress currency then
failwith "Assertion failed: transactionInput's TO property should be equal to the contract address"
Expand Down
4 changes: 2 additions & 2 deletions src/GWallet.Backend/Marshalling.fs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ type MarshalledException =
}
static member private ExtractBasicDetailsFromException (ex: Exception) =
let stackTrace =
if ex.StackTrace = null then
if isNull ex.StackTrace then
String.Empty
else
ex.StackTrace
Expand Down Expand Up @@ -170,7 +170,7 @@ module Marshalling =
false

let DeserializeCustom<'T>(json: string, settings: JsonSerializerSettings): 'T =
if (json = null) then
if isNull json then
raise (ArgumentNullException("json"))
if (String.IsNullOrWhiteSpace(json)) then
raise (ArgumentException("empty or whitespace json", "json"))
Expand Down
2 changes: 1 addition & 1 deletion src/GWallet.Frontend.Console/Program.fs
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@ let rec PerformOperation (numActiveAccounts: uint32) (numHotAccounts: uint32) =
| Operations.CreateAccounts ->
let bootstrapTask = Caching.Instance.BootstrapServerStatsFromTrustedSource() |> Async.StartAsTask
let passphrase,dob,email = UserInteraction.AskBrainSeed true
if null <> bootstrapTask.Exception then
if not (isNull bootstrapTask.Exception) then
raise bootstrapTask.Exception
let masterPrivateKeyTask =
Account.GenerateMasterPrivateKey passphrase dob email
Expand Down

0 comments on commit 2dec7cb

Please sign in to comment.