diff --git a/.config/dotnet-tools.json b/.config/dotnet-tools.json new file mode 100644 index 0000000..8c3d322 --- /dev/null +++ b/.config/dotnet-tools.json @@ -0,0 +1,12 @@ +{ + "version": 1, + "isRoot": true, + "tools": { + "fantomas-tool": { + "version": "4.5.10", + "commands": [ + "fantomas" + ] + } + } +} diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..8180abf --- /dev/null +++ b/.editorconfig @@ -0,0 +1,14 @@ +root = true + +[*.{fs,fsi,fsx}] +fsharp_space_before_uppercase_invocation=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_newline_between_type_definition_and_members=true +fsharp_keep_indent_in_branch=true +fsharp_align_function_signature_to_indentation=true +fsharp_alternative_long_member_definitions=true +fsharp_disable_elmish_syntax=true +fsharp_multi_line_lambda_closing_newline=true diff --git a/.github/workflows/dotnet-core.yaml b/.github/workflows/dotnet-core.yaml new file mode 100644 index 0000000..7a802d4 --- /dev/null +++ b/.github/workflows/dotnet-core.yaml @@ -0,0 +1,29 @@ +name: .NET Core + +on: + push: + branches: [ main ] + pull_request: + branches: [ main ] + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + - name: Setup .NET Core + uses: actions/setup-dotnet@v1 + with: + dotnet-version: 6.0.100 + - name: Install dependencies + run: dotnet restore FicroKanSharp.sln + - name: Build + run: dotnet build FicroKanSharp.sln --configuration Release --no-restore + - name: Test + run: dotnet test FicroKanSharp.sln --no-restore --verbosity normal + - name: Install Fantomas + run: dotnet tool restore + - name: Run Fantomas + run: dotnet tool run fantomas --check -r . diff --git a/README.md b/README.md new file mode 100644 index 0000000..dd1b699 --- /dev/null +++ b/README.md @@ -0,0 +1,17 @@ +# FicroKanSharp + +A microKanren implementation in F#. + +# Development tips + +There are pull request checks on this repo, enforcing [Fantomas](https://github.com/fsprojects/fantomas/)-compliant formatting. +After checking out the repo, you may wish to add a pre-push hook to ensure locally that formatting is complete, rather than having to wait for the CI checks to tell you that you haven't formatted your code. +Consider performing the following command to set this up in the repo: +```bash +git config core.hooksPath hooks/ +``` +Before your first push (but only once), you will need to install the [.NET local tools](https://docs.microsoft.com/en-us/dotnet/core/tools/local-tools-how-to-use) which form part of the pre-push hook: +```bash +dotnet tool restore +``` + diff --git a/hooks/pre-push b/hooks/pre-push new file mode 100644 index 0000000..ab3341d --- /dev/null +++ b/hooks/pre-push @@ -0,0 +1,17 @@ +#!/usr/bin/env python3 + +import subprocess + +def check_fantomas(): + result = subprocess.run(["dotnet", "tool", "run", "fantomas", "--check", "-r", "."]) + if result.returncode != 0: + print(result.stdout) + raise Exception(f"Formatting incomplete (return code: {result.returncode}). Consider running `dotnet tool run fantomas -r .`") + + +def main(): + check_fantomas() + + +if __name__ == "__main__": + main()