diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 3e4f61f..666d9e2 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -8,24 +8,10 @@ jobs: elm-test: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - - uses: actions/setup-node@v1 - with: - node-version: "12" - - - uses: actions/cache@v2 + - uses: actions/checkout@v3 + - uses: cachix/install-nix-action@v22 with: - path: | - ~/.npm - ~/.elm - elm-stuff - key: ${{ runner.os }}-cache - - - run: npm install -g elm@latest-0.19.1 elm-test@0.19.1-revision6 elm-review@2.5.0 elm-format@0.8.5 - - - run: elm-format --validate . - - - run: elm-review - - - run: elm-test + github_access_token: ${{ secrets.GITHUB_TOKEN }} + - run: nix develop --command elm-format --validate . + - run: nix develop --command elm-review + - run: nix develop --command elm-test diff --git a/elm.json b/elm.json index 9840802..4355d20 100644 --- a/elm.json +++ b/elm.json @@ -21,6 +21,6 @@ "ianmackenzie/elm-units": "2.7.0 <= v < 3.0.0" }, "test-dependencies": { - "elm-explorations/test": "1.2.2 <= v < 2.0.0" + "elm-explorations/test": "2.2.0 <= v < 3.0.0" } } diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..2921cfd --- /dev/null +++ b/flake.lock @@ -0,0 +1,61 @@ +{ + "nodes": { + "flake-utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1710146030, + "narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1711124224, + "narHash": "sha256-l0zlN/3CiodvWDtfBOVxeTwYSRz93muVbXWSpaMjXxM=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "56528ee42526794d413d6f244648aaee4a7b56c0", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-23.11", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs" + } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..d64ddda --- /dev/null +++ b/flake.nix @@ -0,0 +1,22 @@ +{ + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixos-23.11"; + flake-utils.url = "github:numtide/flake-utils"; + }; + + outputs = { self, nixpkgs, flake-utils }: + flake-utils.lib.eachDefaultSystem (system: + let pkgs = nixpkgs.legacyPackages.${system}; + in + { + devShells.default = with pkgs; with elmPackages; mkShell { + buildInputs = [ + elm + elm-format + elm-test + elm-review + elm-json + ]; + }; + }); +} diff --git a/review/elm.json b/review/elm.json index 1b7c4e8..7cb6cf3 100644 --- a/review/elm.json +++ b/review/elm.json @@ -9,11 +9,11 @@ "elm/core": "1.0.5", "elm/json": "1.1.3", "elm/project-metadata-utils": "1.0.1", - "jfmengels/elm-review": "2.4.1", - "jfmengels/elm-review-simplify": "1.0.1", - "jfmengels/elm-review-unused": "1.1.9", - "jfmengels/elm-review-performance": "1.0.0", - "stil4m/elm-syntax": "7.2.2" + "jfmengels/elm-review": "2.13.1", + "jfmengels/elm-review-simplify": "2.1.3", + "jfmengels/elm-review-unused": "1.2.0", + "jfmengels/elm-review-performance": "1.0.2", + "stil4m/elm-syntax": "7.3.2" }, "indirect": { "elm/html": "1.0.0", @@ -21,15 +21,15 @@ "elm/random": "1.0.0", "elm/time": "1.0.0", "elm/virtual-dom": "1.0.2", - "elm-community/list-extra": "8.3.0", - "elm-explorations/test": "1.2.2", + "elm-community/list-extra": "8.7.0", + "elm-explorations/test": "2.2.0", "rtfeldman/elm-hex": "1.0.0", "stil4m/structured-writer": "1.0.3" } }, "test-dependencies": { "direct": { - "elm-explorations/test": "1.2.2" + "elm-explorations/test": "2.2.0" }, "indirect": {} } diff --git a/review/src/ReviewConfig.elm b/review/src/ReviewConfig.elm index 5630c29..2363de5 100644 --- a/review/src/ReviewConfig.elm +++ b/review/src/ReviewConfig.elm @@ -34,6 +34,6 @@ config = , NoUnused.Parameters.rule , NoUnused.Patterns.rule , NoUnused.Variables.rule - , Simplify.rule + , Simplify.rule Simplify.defaults , NoUnoptimizedRecursion.rule (NoUnoptimizedRecursion.optOutWithComment "IGNORE TCO") ] diff --git a/scripts/elm-publish.sh b/scripts/elm-publish.sh index ab7d1a6..c387a8e 100755 --- a/scripts/elm-publish.sh +++ b/scripts/elm-publish.sh @@ -26,7 +26,7 @@ git commit -m "Bump to $version" git push last_commit=$(git rev-parse HEAD) -git rm -rf --ignore-unmatch .github benchmarks examples scripts tests elm-physics.gif +git rm -rf --ignore-unmatch .github benchmarks examples scripts tests elm-physics.gif flake.nix sed -i.bak "s+https://unsoundscapes.com/elm-physics/+https://unsoundscapes.com/elm-physics/$version/+g" README.md sed -i.bak "s+https://github.com/w0rm/elm-physics/tree/main/+https://github.com/w0rm/elm-physics/tree/$last_commit/+g" README.md rm README.md.bak diff --git a/src/Shapes/Convex.elm b/src/Shapes/Convex.elm index 9dafad7..32b792e 100644 --- a/src/Shapes/Convex.elm +++ b/src/Shapes/Convex.elm @@ -280,9 +280,11 @@ initFacesHelp visited vertices faceByEdgeIndex facesToCheck edgesToCheck current newEdgesToCheck = List.foldl (\{ indices } res -> - case indices of - ( i1, i2, i3 ) -> - ( i2, i1 ) :: ( i3, i2 ) :: ( i1, i3 ) :: res + let + ( i1, i2, i3 ) = + indices + in + ( i2, i1 ) :: ( i3, i2 ) :: ( i1, i3 ) :: res ) [] coplanar diff --git a/tests/Shapes/ConvexTest.elm b/tests/Shapes/ConvexTest.elm index c85d9bc..255782a 100644 --- a/tests/Shapes/ConvexTest.elm +++ b/tests/Shapes/ConvexTest.elm @@ -8,7 +8,6 @@ module Shapes.ConvexTest exposing , volume ) -import Block3d exposing (vertices) import Expect import Extra.Expect as Expect import Fixtures.Convex @@ -102,8 +101,7 @@ faces = (List.map (\{ normal, vertices } -> \_ -> - Expect.true - "normal points inside" + Expect.equal True (List.all (\v -> let