Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: update to spago@next #24

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 15 additions & 23 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,7 @@ on:
push:
branches: [master]
pull_request:

defaults:
run:
shell: bash
branches: [master]

jobs:
build:
Expand All @@ -18,30 +15,25 @@ jobs:
runs-on: ${{ matrix.os }}

steps:
- uses: actions/checkout@v3
with:
# Fetch all history and tags to ensure we get all commits made
# in the PR. Otherwise, we only fetch the commit that
# merges the PR's HEAD to the base branch and prune everything else.
# This causes the PR numbers to not appear in the commit titles
# and causes the `update` command's test to fail.
fetch-depth: 0
- uses: actions/setup-node@v3
- uses: actions/checkout@v4

- name: Set up a PureScript toolchain
uses: purescript-contrib/setup-purescript@main
with:
node-version: "lts/*"

- uses: actions/cache@v3
# 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.
purescript: "latest"
purs-tidy: "latest"
spago: "unstable"

- name: Cache PureScript dependencies
uses: actions/cache@v4
with:
key: ${{ runner.os }}-spago-${{ hashFiles('**/*.dhall') }}
key: ${{ runner.os }}-spago-${{ hashFiles('**/spago.lock') }}
path: |
.spago
output

- uses: actions/setup-node@v4

- name: Install dependencies
run: npm install

Expand All @@ -51,7 +43,7 @@ jobs:
- name: Build bin
run: npm run bundle

- name: "Run tests"
- name: Run tests
run: npm run test:ci

- name: Verify formatting (Ubuntu only)
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,6 @@
/bin/index.mjs
/.vscode
/output-es/
.psc-ide-port
/init*
.spec-results
38 changes: 0 additions & 38 deletions bin/spago.dhall

This file was deleted.

23 changes: 23 additions & 0 deletions bin/spago.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package:
name: chnglg-bin
dependencies:
- aff: ">=8.0.0 <9.0.0"
- argparse-basic: ">=2.0.0 <3.0.0"
- arrays: ">=7.3.0 <8.0.0"
- bifunctors: ">=6.0.0 <7.0.0"
- chnglg-lib: "*"
- console: ">=6.1.0 <7.0.0"
- effect: ">=4.0.0 <5.0.0"
- either: ">=6.1.0 <7.0.0"
- maybe: ">=6.0.0 <7.0.0"
- node-path: ">=5.0.0 <6.0.0"
- node-process: ">=11.2.0 <12.0.0"
- prelude: ">=6.0.1 <7.0.0"
- strings: ">=6.0.1 <7.0.0"
- tuples: ">=7.0.0 <8.0.0"
- versions: ">=7.0.0 <8.0.0"
test:
main: Test.Bin.Main
dependencies:
- console
- node-process
File renamed without changes.
11 changes: 11 additions & 0 deletions bin/test/Test/Bin/Main.purs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
module Test.Bin.Main where

import Prelude

import Effect (Effect)
import Effect.Class.Console (log)

main :: Effect Unit
main = do
log "🍕"
log "You should add some tests."
41 changes: 41 additions & 0 deletions lib/spago.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
package:
name: chnglg-lib
dependencies:
- aff
- argonaut-codecs
- arrays
- console
- control
- datetime
- effect
- either
- exceptions
- fetch
- filterable
- foldable-traversable
- foreign
- formatters
- integers
- maybe
- newtype
- node-buffer
- node-execa
- node-fs
- node-path
- nullable
- parsing
- precise-datetime
- prelude
- strings
- transformers
- tuples
- versions
test:
main: Test.Main
dependencies:
- console
- node-child-process
- node-process
- profunctor-lenses
- spec
- spec-node
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
15 changes: 8 additions & 7 deletions test/Test/Main.purs → lib/test/Test/Main.purs
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
module Test.Main where

import Prelude
import Test.Spec.Runner.Node (runSpecAndExitProcess')

import Control.Monad.Error.Class (class MonadError)
import Data.Either (either)
import Data.Lens (Prism', preview, prism')
import Data.Maybe (Maybe(..))
import Effect (Effect)
import Effect.Aff (Aff, Error, Milliseconds(..), runAff_)
import Effect.Aff (Aff, Error, Milliseconds(..))
import Effect.Aff.Class (class MonadAff)
import Effect.Class (class MonadEffect, liftEffect)
import Effect.Class.Console (log)
import Effect.Exception (throw, throwException)
import Effect.Exception (throw)
import Node.ChildProcess.Types (Exit(..), KillSignal)
import Node.Encoding (Encoding(..))
import Node.FS.Aff (mkdtemp)
Expand All @@ -25,19 +25,20 @@ import Node.Process as Process
import Test.Spec (SpecT, afterAll, after_, around_, beforeAll, describe, it, sequential)
import Test.Spec.Assertions (shouldEqual, shouldNotEqual)
import Test.Spec.Reporter (consoleReporter)
import Test.Spec.Runner (defaultConfig, runSpecT)
import Test.Utils (delDir)
import UpChangelog.Constants as Constants
import Test.Spec.Runner.Node.Config as Cfg

main :: Effect Unit
main = runAff_ (either throwException pure) do
void $ join $ runSpecT (defaultConfig { timeout = Just $ Milliseconds 20_000.0 }) [ consoleReporter ] $ sequential spec
main = do
let config = { defaultConfig: Cfg.defaultConfig { timeout = Just $ Milliseconds 20_000.0 }, parseCLIOptions: true }
runSpecAndExitProcess' @Aff config [ consoleReporter ] (sequential spec)

spec :: SpecT Aff Unit Aff Unit
spec = do
pwd <- liftEffect $ Process.cwd
let
binaryFile = Path.concat [ pwd, "bin", "index.mjs" ]
binaryFile = Path.concat [ pwd, "bin", "index.dev.mjs" ]
pursChangelog cmd args =
_.getResult =<< execa "node" ([ binaryFile, "--log-debug", cmd ] <> args) identity
defaultReadme = Path.concat [ Constants.changelogDir, Constants.readmeFile ]
Expand Down
File renamed without changes.
File renamed without changes.
Loading