Skip to content

Commit 8da9bec

Browse files
Update for PureScript 0.14 and remove Purty (#21)
1 parent c5ba2e5 commit 8da9bec

File tree

13 files changed

+67
-118
lines changed

13 files changed

+67
-118
lines changed

.github/workflows/integration.yml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,9 @@ jobs:
1919

2020
- uses: ./ # equivalent to purescript-contrib/setup-purescript@<branch>
2121
with:
22-
purty: "latest"
2322
zephyr: "latest"
2423

25-
- name: Check purty is installed correctly
26-
run: purty src/Main.purs
27-
2824
- name: Check spago and purs are installed correctly
29-
# run: spago build --purs-args '--censor-lib --strict --codegen corefn,js'
3025
run: |
3126
purs --version
3227
spago version

README.md

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ A GitHub Action which sets up a PureScript toolchain for CI. Contains the follow
1313
You can also optionally include the following tools:
1414

1515
- The [Zephyr dead code elimination tool](https://github.com/coot/zephyr)
16-
- The [Purty source code formatter](https://gitlab.com/joneshf/purty)
1716

1817
This action is designed to support PureScript tools. Your PureScript project may also depend on tooling and libraries provided by the NPM ecosystem, in which case you will also want to use the [setup-node](https://github.com/actions/setup-node) action.
1918

@@ -43,10 +42,9 @@ steps:
4342
- uses: actions/checkout@v2
4443
- uses: purescript-contrib/setup-purescript@main
4544
with:
46-
purescript: "0.13.8"
47-
psa: "0.7.2"
48-
spago: "0.15.3"
49-
purty: "latest"
45+
purescript: "0.14.0"
46+
psa: "0.8.2"
47+
spago: "latest"
5048
zephyr: "0.3.2"
5149
- run: spago build
5250
```
@@ -120,4 +118,4 @@ These libraries and applications are examples of `setup-purescript` in action:
120118
- [halogen-formless](https://github.com/thomashoneyman/purescript-halogen-formless/blob/main/.github/workflows/ci.yml)
121119
- [halogen-hooks](https://github.com/thomashoneyman/purescript-halogen-hooks/blob/main/.github/workflows/ci.yml)
122120
- [slug](https://github.com/thomashoneyman/purescript-slug/blob/main/.github/workflows/ci.yml)
123-
- Add your project here
121+
- ...add your package here!

action.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@ inputs:
1111
psa:
1212
description: "The psa version to install. Examples: latest, 0.7.2"
1313
default: "latest"
14-
purty:
15-
description: "The Purty version to install. Examples: latest, 6.2.0"
1614
zephyr:
1715
description: "The Zephyr version to install. Examples: latest, 0.3.2"
1816
runs:

dist/index.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/update.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/versions.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"purs":"0.14.3","spago":"0.20.3","psa":"0.8.2","purty":"7.0.0","zephyr":"0.3.2"}
1+
{ "purs": "0.14.3", "spago": "0.20.3", "psa": "0.8.2", "zephyr": "0.3.2" }

packages.dhall

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,4 @@
11
let upstream =
2-
https://github.com/purescript/package-sets/releases/download/psc-0.13.8-20200922/packages.dhall sha256:5edc9af74593eab8834d7e324e5868a3d258bbab75c5531d2eb770d4324a2900
2+
https://github.com/purescript/package-sets/releases/download/psc-0.14.3-20210722/packages.dhall sha256:1ceb43aa59436bf5601bac45f6f3781c4e1f0e4c2b8458105b018e5ed8c30f8c
33

44
in upstream
5-
with versions =
6-
{ dependencies =
7-
[ "console"
8-
, "control"
9-
, "either"
10-
, "exceptions"
11-
, "foldable-traversable"
12-
, "functions"
13-
, "integers"
14-
, "lists"
15-
, "maybe"
16-
, "orders"
17-
, "parsing"
18-
, "partial"
19-
, "strings"
20-
]
21-
, repo = "https://github.com/hdgarrood/purescript-versions.git"
22-
, version = "v5.0.1"
23-
}

shell.nix

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,21 @@
11
let
22
pkgs = import (builtins.fetchTarball {
3-
url = "https://github.com/NixOS/nixpkgs/archive/20.03.tar.gz";
3+
url = "https://github.com/NixOS/nixpkgs/archive/21.05.tar.gz";
44
}) {};
55

6-
# 2020-08-01 nix-prefetch-git https://github.com/justinwoo/easy-purescript-nix
6+
# 2021-08-05 nix-prefetch-git https://github.com/justinwoo/easy-purescript-nix
77
pursPkgs = import (pkgs.fetchFromGitHub {
88
owner = "justinwoo";
99
repo = "easy-purescript-nix";
10-
rev = "7ff5a12af5750f94d0480059dba0ba6b82c6c452";
11-
sha256 = "0af25dqhs13ii4mx9jjkx2pww4ddbs741vb5gfc5ckxb084d69fq";
10+
rev = "bbef4245cd6810ea84e97a47c801947bfec9fadc";
11+
sha256 = "00764zbwhbn61jwb5px2syzi2f9djyl8fmbd2p8wma985af54iwx";
1212
}) { inherit pkgs; };
1313

1414
in pkgs.stdenv.mkDerivation {
1515
name = "setup-purescript";
1616
buildInputs = with pursPkgs; [
1717
pursPkgs.purs
1818
pursPkgs.spago
19-
pursPkgs.purty
20-
pkgs.nodejs-12_x
19+
pkgs.nodejs-14_x
2120
];
2221
}

spago.dhall

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,34 @@
11
{ name = "setup-purescript"
22
, dependencies =
33
[ "aff"
4-
, "aff-promise"
54
, "aff-retry"
65
, "affjax"
76
, "argonaut-codecs"
87
, "argonaut-core"
9-
, "console"
10-
, "debug"
8+
, "arrays"
9+
, "bifunctors"
1110
, "effect"
11+
, "either"
12+
, "enums"
13+
, "exceptions"
14+
, "foldable-traversable"
1215
, "github-actions-toolkit"
13-
, "monad-loops"
16+
, "integers"
17+
, "math"
18+
, "maybe"
19+
, "newtype"
20+
, "node-buffer"
1421
, "node-fs"
1522
, "node-path"
1623
, "node-process"
17-
, "nullable"
18-
, "psci-support"
19-
, "record"
24+
, "parsing"
25+
, "partial"
26+
, "prelude"
27+
, "refs"
28+
, "strings"
29+
, "tailrec"
30+
, "transformers"
31+
, "tuples"
2032
, "versions"
2133
]
2234
, packages = ./packages.dhall

src/Main.purs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ main = runAff_ go $ runExceptT do
3030

3131
go res = case join res of
3232
Left err -> Core.setFailed (message err)
33-
Right a -> pure unit
33+
Right _ -> pure unit
3434

3535
update :: Effect Unit
3636
update = launchAff_ updateVersions

src/Setup/Data/Key.purs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,6 @@ spagoKey = Key "spago"
1919
psaKey :: Key
2020
psaKey = Key "psa"
2121

22-
purtyKey :: Key
23-
purtyKey = Key "purty"
24-
2522
zephyrKey :: Key
2623
zephyrKey = Key "zephyr"
2724

@@ -30,5 +27,4 @@ fromTool = case _ of
3027
PureScript -> purescriptKey
3128
Spago -> spagoKey
3229
Psa -> psaKey
33-
Purty -> purtyKey
3430
Zephyr -> zephyrKey

src/Setup/Data/Tool.purs

Lines changed: 30 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -3,24 +3,23 @@ module Setup.Data.Tool where
33
import Prelude
44

55
import Affjax (URL)
6-
import Data.Either (fromRight)
6+
import Data.Either (fromRight')
77
import Data.Enum (class Enum, upFromIncluding)
88
import Data.Foldable (elem, fold)
99
import Data.Generic.Rep (class Generic)
10-
import Data.Generic.Rep.Bounded (genericBottom, genericTop)
11-
import Data.Generic.Rep.Enum (genericPred, genericSucc)
10+
import Data.Bounded.Generic (genericBottom, genericTop)
11+
import Data.Enum.Generic (genericPred, genericSucc)
1212
import Data.Version (Version, parseVersion)
1313
import Data.Version as Version
1414
import Node.Path (FilePath)
1515
import Node.Path as Path
16-
import Partial.Unsafe (unsafePartial)
16+
import Partial.Unsafe (unsafeCrashWith)
1717
import Setup.Data.Platform (Platform(..), platform)
1818

1919
data Tool
2020
= PureScript
2121
| Spago
2222
| Psa
23-
| Purty
2423
| Zephyr
2524

2625
derive instance eqTool :: Eq Tool
@@ -52,7 +51,6 @@ name = case _ of
5251
PureScript -> "purs"
5352
Spago -> "spago"
5453
Psa -> "psa"
55-
Purty -> "purty"
5654
Zephyr -> "zephyr"
5755

5856
-- | The source repository for a tool (whether on GitHub or Gitlab)
@@ -69,9 +67,6 @@ repository = case _ of
6967
Psa ->
7068
{ owner: "natefaubion", name: "purescript-psa" }
7169

72-
Purty ->
73-
{ owner: "joneshf", name: "purty" }
74-
7570
Zephyr ->
7671
{ owner: "coot", name: "zephyr" }
7772

@@ -99,59 +94,53 @@ installMethod tool version = do
9994
formatArgs = { repo: toolRepo, tag: formatTag, tarball: _ }
10095

10196
formatGitHub' = formatGitHub <<< formatArgs
102-
formatBintray' = formatBintray <<< formatArgs
10397

104-
unsafeVersion str = unsafePartial fromRight $ parseVersion str
98+
unsafeVersion str = fromRight' (\_ -> unsafeCrashWith "Unexpected Left") $ parseVersion str
10599

106100
executableName = case platform of
107101
Windows -> toolName <> ".exe"
108102
_ -> toolName
109103

110104
case tool of
111105
PureScript -> Tarball
112-
{ source: formatGitHub' case platform of
113-
Windows -> "win64"
114-
Mac -> "macos"
115-
Linux -> "linux64"
106+
{ source:
107+
formatGitHub' case platform of
108+
Windows -> "win64"
109+
Mac -> "macos"
110+
Linux -> "linux64"
116111
, getExecutablePath:
117112
\p -> Path.concat [ p, "purescript", executableName ]
118113
}
119114

120115
Spago -> Tarball
121-
{ source: formatGitHub'
122-
-- Spago has changed naming conventions from version to version
123-
if version >= unsafeVersion "0.18.1" then case platform of
124-
Windows -> "Windows"
125-
Mac -> "macOS"
126-
Linux -> "Linux"
127-
else if version == unsafeVersion "0.18.0" then case platform of
128-
Windows -> "windows-latest"
129-
Mac -> "macOS-latest"
130-
Linux -> "linux-latest"
131-
else case platform of
132-
Windows -> "windows"
133-
Mac -> "osx"
134-
Linux -> "linux"
116+
{ source:
117+
formatGitHub'
118+
-- Spago has changed naming conventions from version to version
119+
if version >= unsafeVersion "0.18.1" then case platform of
120+
Windows -> "Windows"
121+
Mac -> "macOS"
122+
Linux -> "Linux"
123+
else if version == unsafeVersion "0.18.0" then case platform of
124+
Windows -> "windows-latest"
125+
Mac -> "macOS-latest"
126+
Linux -> "linux-latest"
127+
else case platform of
128+
Windows -> "windows"
129+
Mac -> "osx"
130+
Linux -> "linux"
135131
, getExecutablePath:
136132
\p -> Path.concat [ p, executableName ]
137133
}
138134

139135
Psa ->
140136
NPM (toolRepo.name <> "@" <> Version.showVersion version)
141137

142-
Purty -> Tarball
143-
{ source: formatBintray' $ case platform of
144-
Windows -> "win"
145-
Mac -> "osx"
146-
Linux -> "linux"
147-
, getExecutablePath: \p -> Path.concat [ p, executableName ]
148-
}
149-
150138
Zephyr -> Tarball
151-
{ source: formatGitHub' $ case platform of
152-
Windows -> "Windows"
153-
Mac -> "macOS"
154-
Linux -> "Linux"
139+
{ source:
140+
formatGitHub' $ case platform of
141+
Windows -> "Windows"
142+
Mac -> "macOS"
143+
Linux -> "Linux"
155144
, getExecutablePath: \p -> Path.concat [ p, "zephyr", executableName ]
156145
}
157146

@@ -182,18 +171,3 @@ installMethod tool version = do
182171
, tarball
183172
, ".tar.gz"
184173
]
185-
186-
formatBintray :: { repo :: ToolRepository, tag :: String, tarball :: String } -> String
187-
formatBintray { repo, tag, tarball } =
188-
-- Example: https://dl.bintray.com/joneshf/generic/purty-6.2.0-linux.tar.gz
189-
fold
190-
[ "https://dl.bintray.com/"
191-
, repo.owner
192-
, "/generic/"
193-
, repo.name
194-
, "-"
195-
, tag
196-
, "-"
197-
, tarball
198-
, ".tar.gz"
199-
]

src/Setup/UpdateVersions.purs

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import Prelude
77
import Affjax as AX
88
import Affjax.ResponseFormat as RF
99
import Control.Monad.Rec.Class (untilJust)
10-
import Data.Argonaut.Core (Json, jsonEmptyObject, stringify, stringifyWithIndent)
10+
import Data.Argonaut.Core (Json, jsonEmptyObject, stringifyWithIndent)
1111
import Data.Argonaut.Decode (decodeJson, printJsonDecodeError, (.:))
1212
import Data.Argonaut.Encode ((:=), (~>))
1313
import Data.Array (foldl)
@@ -63,10 +63,6 @@ fetchLatestReleaseVersion tool = Tool.repository tool # case tool of
6363
PureScript -> fetchFromGitHubReleases
6464
Spago -> fetchFromGitHubReleases
6565
Psa -> fetchFromGitHubTags
66-
-- Technically, Purty is hosted on Gitlab. But without an accessible way to
67-
-- fetch the latest release tag from Gitlab via an API, it seems better to fetch
68-
-- from the GitHub mirror.
69-
Purty -> fetchFromGitHubTags
7066
Zephyr -> fetchFromGitHubReleases
7167
where
7268
-- TODO: These functions really ought to be in ExceptT to avoid all the
@@ -98,7 +94,7 @@ fetchLatestReleaseVersion tool = Tool.repository tool # case tool of
9894
$ fold
9995
[ "Failed to decode GitHub response. This is most likely due to a timeout.\n\n"
10096
, printJsonDecodeError e
101-
, stringify body
97+
, stringifyWithIndent 2 body
10298
]
10399
Right [] -> pure Nothing
104100
Right objects ->
@@ -113,7 +109,7 @@ fetchLatestReleaseVersion tool = Tool.repository tool # case tool of
113109
]
114110
Right tagName ->
115111
case tagStrToVersion tagName of
116-
Left e -> do
112+
Left _ -> do
117113
liftEffect $ warning $ fold
118114
[ "Got invalid version"
119115
, tagName
@@ -153,7 +149,7 @@ fetchLatestReleaseVersion tool = Tool.repository tool # case tool of
153149
throwError $ error $ fold
154150
[ "Failed to decode GitHub response. This is most likely due to a timeout.\n\n"
155151
, printJsonDecodeError e
156-
, stringify body
152+
, stringifyWithIndent 2 body
157153
]
158154

159155
Right arr -> do

0 commit comments

Comments
 (0)