From e737feaba05f1ca70b46b49b133dc136d0ae007c Mon Sep 17 00:00:00 2001 From: siwatanejo <7511840+siwatanejo@users.noreply.github.com> Date: Wed, 13 Mar 2024 18:47:51 +0100 Subject: [PATCH] CI: add a fantomas step To avoid, from the start, potential bikeshedding debates about style in PRs. --- .editorconfig | 45 +++++++++++++++++++++++++++++++++++++++ .github/workflows/CI.yml | 34 +++++++++++++++++++++++++++++ src/PackWallet/Program.fs | 5 +++-- 3 files changed, 82 insertions(+), 2 deletions(-) create mode 100644 .editorconfig diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..3d0e941 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,45 @@ +[*] +insert_final_newline=true + +[*.{fs,fsx,ts}] +end_of_line=lf +indent_size=4 +max_line_length=80 +fsharp_semicolon_at_end_of_line=false +fsharp_space_before_parameter=false +fsharp_space_before_lowercase_invocation=false +fsharp_space_before_uppercase_invocation=false +fsharp_space_before_class_constructor=false +fsharp_space_before_member=false +fsharp_space_before_colon=false +fsharp_space_after_comma=true +fsharp_space_before_semicolon=false +fsharp_space_after_semicolon=true +fsharp_indent_on_try_with=false +fsharp_space_around_delimiter=true +fsharp_max_if_then_else_short_width=0 +fsharp_max_infix_operator_expression=80 +fsharp_max_record_width=0 +fsharp_max_function_binding_width=0 +fsharp_max_value_binding_width=80 +fsharp_multiline_block_brackets_on_same_column=true +fsharp_newline_between_type_definition_and_members=true +fsharp_keep_if_then_in_same_line=true +fsharp_strict_mode=false +fsharp_multi_line_lambda_closing_newline=true +fsharp_disable_elmish_syntax=true + +# Xml project files +[*.{csproj,fsproj,vcxproj,vcxproj.filters,proj,nativeproj,locproj}] +indent_size = 2 + +# Xml config files +[*.{props,targets,config,nuspec}] +indent_size = 2 + +# Shell scripts +[*.sh] +end_of_line = lf + +[*.{cmd, bat}] +end_of_line = crlf diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 6696a9e..59b5577 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -92,3 +92,37 @@ jobs: - name: Test snap run: packwallet + + conventions: + needs: + - integration_tests + - run_snap + + runs-on: ubuntu-22.04 + container: + image: "ubuntu:22.04" + + steps: + - uses: actions/checkout@v1 + - name: Install required dependencies + run: | + apt update + apt install --yes sudo + sudo apt install --yes --no-install-recommends git + # workaround for https://github.com/actions/runner/issues/2033 + git config --global --add safe.directory '*' + - name: Setup .NET + run: | + # We need to install `ca-certificates`, otherwise we get these errors in the CI: + # Unable to load the service index for source https://api.nuget.org/v3/index.json. + # The SSL connection could not be established, see inner exception. + # The remote certificate is invalid because of errors in the certificate chain: UntrustedRoot + apt install --yes --no-install-recommends ca-certificates + apt install --yes --no-install-recommends dotnet6 + - name: fantomas + run: | + dotnet new tool-manifest + dotnet tool install fantomas --version 6.2.3 + dotnet fantomas . + git diff --exit-code + diff --git a/src/PackWallet/Program.fs b/src/PackWallet/Program.fs index c7612a6..4aee56b 100644 --- a/src/PackWallet/Program.fs +++ b/src/PackWallet/Program.fs @@ -1,7 +1,8 @@ open System.Net.Http open FSharp.Data -type CoindDeskProvider = JsonProvider<""" +type CoindDeskProvider = + JsonProvider<""" { "time": { "updated": "Feb 25, 2024 12:27:26 UTC", @@ -42,7 +43,7 @@ let address = "https://api.coindesk.com/v1/bpi/currentprice.json" printfn "Retrieving contents of %s ...\n" address -let contents = +let contents = webClient.GetStringAsync address |> Async.AwaitTask |> Async.RunSynchronously