Skip to content

Commit 52201d5

Browse files
Rewrite action in PureScript and add Purty (#1)
1 parent e0c5aa8 commit 52201d5

23 files changed

+4601
-173
lines changed

.github/workflows/integration.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: Integration
2+
3+
on: [push]
4+
5+
jobs:
6+
test-install:
7+
runs-on: ${{ matrix.os }}
8+
strategy:
9+
matrix:
10+
os: [ubuntu-latest, macos-latest, windows-latest]
11+
12+
steps:
13+
- uses: actions/checkout@v2
14+
- uses: ./ # equivalent to thomashoneyman/setup-purescript@<branch>
15+
- name: Check tools are installed correctly
16+
run: |
17+
purty src/Main.purs
18+
spago build --purs-args '--codegen corefn,js'
19+
zephyr -f Main.main

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,8 @@
55

66
# Dependencies
77
node_modules
8+
9+
# PureScript
10+
output
11+
dce-output
12+
generated-docs

README.md

Lines changed: 24 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ A GitHub Action which sets up a PureScript toolchain for CI. Contains the follow
55
- The [PureScript compiler](https://github.com/purescript/purescript)
66
- The [Spago package manager and build tool](https://github.com/purescript/spago)
77
- The [Zephyr dead code elimination tool](https://github.com/coot/zephyr)
8+
- The [Purty source code formatter](https://gitlab.com/joneshf/purty)
89

910
This action is designed to support tools with static binaries. 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.
1011

@@ -16,7 +17,7 @@ See the [action.yml](action.yml) file for all possible inputs and outputs.
1617

1718
### Basic
1819

19-
Get the latest versions of PureScript, Spago, and Zephyr in the environment:
20+
Use the PureScript toolchain with the latest version of each tool (resolved from GitHub releases or the latest tag with a valid semantic version):
2021

2122
```yaml
2223
steps:
@@ -27,7 +28,7 @@ steps:
2728
2829
### Use Specific Versions
2930
30-
Use specific versions of any tool by supplying a valid semantic version (only exact versions currently supported):
31+
Use a specific version of any tool by supplying a valid semantic version (only exact versions currently supported):
3132
3233
```yaml
3334
steps:
@@ -36,19 +37,31 @@ steps:
3637
with:
3738
purescript-version: "0.13.8"
3839
spago-version: "0.15.3"
40+
purty-version: "6.2.0"
3941
zephyr-version: "0.3.2"
4042
- run: spago build
4143
```
4244
43-
### Cache Library Dependencies (Coming Soon)
45+
## Development
4446
45-
Automatically build and cache library dependencies between workflow runs by supplying a path to a Spago config file:
47+
Enter a development shell with necessary tools installed:
4648
47-
```yaml
48-
steps:
49-
- uses: actions/checkout@v2
50-
- uses: thomashoneyman/setup-purescript@master
51-
with:
52-
cache: "spago.dhall"
53-
- run: spago build
49+
```sh
50+
nix-shell
51+
```
52+
53+
If you need any additional tools not included in this Nix expression or available via NPM, please feel free to add them via [easy-purescript-nix](https://github.com/justinwoo/easy-purescript-nix).
54+
55+
Next, install NPM dependencies:
56+
57+
```sh
58+
npm install
5459
```
60+
61+
GitHub Actions uses the `action.yml` file to define the action and the `dist/index.js` file to execute it. After making any changes to the source code, make sure those changes are visible by running:
62+
63+
```sh
64+
npm run package
65+
```
66+
67+
This will bundle and minify the source code so it is available to the end user.

action.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ inputs:
88
spago-version:
99
description: "The Spago version to install. Examples: latest, 0.15.3"
1010
default: "latest"
11+
purty-version:
12+
description: "The Purty version to install. Examples: latest, 6.2.0"
13+
default: "latest"
1114
zephyr-version:
1215
description: "The Zephyr version to install. Examples: latest, 0.3.2"
1316
default: "latest"

dist/index.js

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

dist/index.js.map

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

0 commit comments

Comments
 (0)