A GitHub Action which sets up a PureScript toolchain for CI. Contains the following tools by default:
- The PureScript compiler
- The Spago package manager and build tool
- Use the
unstableversion for spago-next; otherwise, setup-purescript providesspago-legacy; see issue 37
- Use the
- The
psaerror reporting frontend for the compiler
You can also optionally include the following tools:
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 action.
See the action.yml file for all possible inputs and outputs.
Use the PureScript toolchain with the latest versions of PureScript and Spago:
steps:
- uses: actions/checkout@v2
- uses: purescript-contrib/setup-purescript@main
- run: spago buildOther tools are not enabled by default, but you can enable them by specifying their version.
Each tool can accept one of the following:
- a semantic version (only exact versions currently supported)
- the string
"latest", which represents the latest version that uses major, minor, and patch, but will omit versions using pre-release identifiers or build metadata - the string
"unstable", which represents the latest version no matter what it is (i.e. pre-release identifiers and build metadata are not considered).
Tools that are not installed by default must be specified this way to be included in the toolchain.
steps:
- uses: actions/checkout@v2
- uses: purescript-contrib/setup-purescript@main
with:
purescript: "0.14.0"
psa: "0.8.2"
spago: "latest"
purs-tidy: "latest"
zephyr: "0.3.2"
- run: spago buildThis workflow is a useful starting point for new projects and libraries. You can add a .yml file with the contents below to the .github/workflows directory in your project (for example: .github/workflows/ci.yml).
name: CI
on: push
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: purescript-contrib/setup-purescript@main
- name: Cache PureScript dependencies
uses: actions/cache@v2
# This cache uses the .dhall files to know when it should reinstall
# and rebuild packages. It caches both the installed packages from
# the `.spago` directory and compilation artifacts from the `output`
# directory. When restored the compiler will rebuild any files that
# have changed. If you do not want to cache compiled output, remove
# the `output` path.
with:
key: ${{ runner.os }}-spago-${{ hashFiles('**/*.dhall') }}
path: |
.spago
output
- run: spago build
- run: spago test --no-installEnter a development shell with necessary tools installed:
nix-shellIf 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.
Next, install NPM dependencies:
npm installGitHub 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:
npm run buildThis will bundle and minify the source code so it is available to the end user.
These libraries and applications are examples of setup-purescript in action:
- halogen
- halogen-realworld
- halogen-formless
- halogen-hooks
- slug
- ...add your package here!