From 2fe35b4ab6180a38546764330fc9a0b4d3542ea5 Mon Sep 17 00:00:00 2001 From: Smaug123 Date: Fri, 4 Aug 2023 21:34:13 +0100 Subject: [PATCH] Upgrade Fantomas and add Woodpecker build --- .editorconfig | 5 +++-- .github/workflows/dotnet-core.yaml | 2 +- .woodpecker/.all-checks-complete.yml | 10 ++++++++++ .woodpecker/.build.yml | 17 +++++++++++++++++ dotnet-tools.json | 2 +- hooks/pre-push | 4 ++-- 6 files changed, 34 insertions(+), 6 deletions(-) create mode 100644 .woodpecker/.all-checks-complete.yml create mode 100644 .woodpecker/.build.yml diff --git a/.editorconfig b/.editorconfig index 85d6fcc..029afcd 100644 --- a/.editorconfig +++ b/.editorconfig @@ -13,12 +13,13 @@ indent_style=space indent_size=2 [*.{fs,fsi}] +fsharp_bar_before_discriminated_union_declaration=true fsharp_space_before_uppercase_invocation=true fsharp_space_before_class_constructor=true fsharp_space_before_member=true fsharp_space_before_colon=true fsharp_space_before_semicolon=true -fsharp_multiline_block_brackets_on_same_column=true +fsharp_multiline_bracket_style=aligned fsharp_newline_between_type_definition_and_members=true fsharp_align_function_signature_to_indentation=true fsharp_alternative_long_member_definitions=true @@ -26,6 +27,6 @@ fsharp_multi_line_lambda_closing_newline=true fsharp_experimental_keep_indent_in_branch=true fsharp_max_value_binding_width=80 fsharp_max_record_width=0 -fsharp_bar_before_discriminated_union_declaration=true max_line_length=120 end_of_line=lf + diff --git a/.github/workflows/dotnet-core.yaml b/.github/workflows/dotnet-core.yaml index 7dae4c0..1731cea 100644 --- a/.github/workflows/dotnet-core.yaml +++ b/.github/workflows/dotnet-core.yaml @@ -26,4 +26,4 @@ jobs: - name: Install Fantomas run: dotnet tool restore - name: Run Fantomas - run: dotnet tool run fantomas --check -r . + run: dotnet tool run fantomas --check . diff --git a/.woodpecker/.all-checks-complete.yml b/.woodpecker/.all-checks-complete.yml new file mode 100644 index 0000000..5a7fdd7 --- /dev/null +++ b/.woodpecker/.all-checks-complete.yml @@ -0,0 +1,10 @@ +steps: + echo: + image: alpine + commands: + - echo "All required checks complete" + +depends_on: + - build + +skip_clone: true diff --git a/.woodpecker/.build.yml b/.woodpecker/.build.yml new file mode 100644 index 0000000..881afe8 --- /dev/null +++ b/.woodpecker/.build.yml @@ -0,0 +1,17 @@ +steps: + build: + image: nixos/nix + commands: + - echo 'experimental-features = flakes nix-command' >> /etc/nix/nix.conf + # Lint + - nix develop --command dotnet -- tool restore + - nix develop --command ./hooks/pre-push + # Test + - nix develop --command dotnet -- test + - nix develop --command dotnet -- test --configuration Release + # Perform build + - "pushd RaftFable && nix develop --command npm -- install && popd" + - "pushd RaftFable && nix develop --command npm -- run-script webpack && popd" + +when: + evaluate: '(CI_PIPELINE_EVENT == "push" && CI_COMMIT_BRANCH == CI_REPO_DEFAULT_BRANCH) || (CI_PIPELINE_EVENT == "pull_request")' diff --git a/dotnet-tools.json b/dotnet-tools.json index 26cf93a..809ba48 100644 --- a/dotnet-tools.json +++ b/dotnet-tools.json @@ -3,7 +3,7 @@ "isRoot": true, "tools": { "fantomas": { - "version": "5.1.0", + "version": "6.1.2", "commands": [ "fantomas" ] diff --git a/hooks/pre-push b/hooks/pre-push index feb6e3d..4f7ce2f 100755 --- a/hooks/pre-push +++ b/hooks/pre-push @@ -3,10 +3,10 @@ import subprocess def check_fantomas(): - result = subprocess.run(["dotnet", "tool", "run", "fantomas", "--check", "-r", "."]) + result = subprocess.run(["dotnet", "tool", "run", "fantomas", "--check", "."]) if result.returncode != 0: print(result.stdout) - raise Exception(f"Formatting incomplete (return code: {result.returncode}). Consider running `dotnet tool run fantomas -r .`") + raise Exception(f"Formatting incomplete (return code: {result.returncode}). Consider running `dotnet tool run fantomas .`") def check_alejandra():