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: migrate to spago@next #21

Open
wants to merge 7 commits into
base: main
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
44 changes: 23 additions & 21 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,42 +1,48 @@
name: CI

on: [push, pull_request]
on:
push:
branches: [main]
pull_request:
branches: [main]

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- name: Set up a PureScript toolchain
uses: purescript-contrib/setup-purescript@main
with:
purescript: "latest"
purs-tidy: "latest"
spago: "unstable"

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

- name: Set up Node toolchain
uses: actions/setup-node@v2
with:
node-version: "20.x"
- name: Setup node and npm
uses: actions/setup-node@v4

- name: Cache NPM dependencies
uses: actions/cache@v2
uses: actions/cache@v4
env:
cache-name: cache-node-modules
with:
path: ~/.npm
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package.json') }}
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}-${{ hashFiles('**/package.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}-
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-

- name: Install NPM dependencies
run: npm install -g spago@next purescript@latest

- name: Install NPM dependencies
run: npm install

Expand All @@ -46,13 +52,9 @@ jobs:
- name: Build and bundle tests
run: ./node_modules/@vercel/ncc/dist/ncc/cli.js build --minify test/index.js

- name: Run tests
uses: ./test
- uses: ./test
with:
testinput: test

- name: Verify Bower & Pulp
run: |
npm install bower pulp@16.0.2
npx bower install
npx pulp build
- name: Verify formatting
run: purs-tidy check src test
27 changes: 0 additions & 27 deletions bower.json

This file was deleted.

8 changes: 8 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import globals from "globals";
import pluginJs from "@eslint/js";


export default [
{languageOptions: { globals: globals.browser }},
pluginJs.configs.recommended,
];
10 changes: 6 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,17 @@
"private": true,
"scripts": {
"build": "eslint src && spago build --strict --censor-stats --pedantic-packages",
"test": "spago test --no-install"
"test": "spago test --offline"
},
"devDependencies": {
"@vercel/ncc": "^0.38.1",
"eslint": "^8.57.0"
"@eslint/js": "^9.12.0",
"@vercel/ncc": "^0.38.2",
"eslint": "^9.12.0",
"globals": "^15.11.0"
},
"dependencies": {
"@actions/cache": "^3.2.4",
"@actions/core": "^1.10.1",
"@actions/core": "^1.11.1",
"@actions/exec": "^1.1.1",
"@actions/io": "^1.1.3",
"@actions/tool-cache": "^2.0.1"
Expand Down
37 changes: 20 additions & 17 deletions spago.yaml
Original file line number Diff line number Diff line change
@@ -1,24 +1,27 @@
package:
name: github-actions-toolkit
publish:
license: MIT
version: 1.0.0
location:
githubOwner: purescript-contrib
githubRepo: purescript-github-actions-toolkit
dependencies:
- aff
- aff-promise
- control
- effect
- exceptions
- foreign-object
- maybe
- node-buffer
- node-path
- node-streams
- nullable
- prelude
- transformers
- aff: ">=8.0.0 <9.0.0"
- aff-promise: ">=4.0.0 <5.0.0"
- control: ">=6.0.0 <7.0.0"
- effect: ">=4.0.0 <5.0.0"
- exceptions: ">=6.1.0 <7.0.0"
- foreign-object: ">=4.1.0 <5.0.0"
- maybe: ">=6.0.0 <7.0.0"
- node-buffer: ">=9.0.0 <10.0.0"
- node-path: ">=5.0.0 <6.0.0"
- node-streams: ">=9.0.0 <10.0.0"
- nullable: ">=6.0.0 <7.0.0"
- prelude: ">=6.0.1 <7.0.0"
- transformers: ">=6.1.0 <7.0.0"
test:
main: Test.Main
dependencies:
- either
workspace:
package_set:
registry: 50.4.0
extra_packages: {}
workspace: {}
4 changes: 2 additions & 2 deletions src/GitHub/Actions/ToolCache.purs
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ extractXar =
Nothing, Nothing -> runEffectFn1 extractXar1Impl file
Just d, Nothing -> runEffectFn2 extractXar2Impl file d
Nothing, Just f -> runEffectFn2 extractXar2Impl2 file f
Just d, Just f -> runEffectFn3 extractXar3Impl file d f
Just d, Just f -> runEffectFn3 extractXar3Impl file d f

foreign import extractZip1Impl :: EffectFn1 FilePath (Promise FilePath)

Expand Down Expand Up @@ -230,7 +230,7 @@ type CacheDirArgs =
}

-- | Caches a directory and installs it into the tool cacheDir
cacheDir' :: { sourceDir :: String, tool :: String , version :: String } -> ExceptT Error Aff FilePath
cacheDir' :: { sourceDir :: String, tool :: String, version :: String } -> ExceptT Error Aff FilePath
cacheDir' { sourceDir, tool, version } = cacheDir { sourceDir, tool, version, arch: Nothing }

-- | Caches a directory and installs it into the tool cacheDir
Expand Down
6 changes: 3 additions & 3 deletions test/Main.purs → test/Test/Main.purs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ main = do
_ <- Cache.restoreCache' { paths: [], primaryKey: "restorecache" }
_ <- Cache.restoreCache { paths: [], primaryKey: "restorecache", restoreKeys: Nothing, options: Nothing }
_ <- Cache.restoreCache { paths: [], primaryKey: "restorecache", restoreKeys: Just [ "a" ], options: Nothing }
Cache.restoreCache { paths: [], primaryKey: "restorecaceh", restoreKeys: Just [ "a" ], options: Just (Cache.defaultDownloadOptions { useAzureSdk = Just true, downloadConcurrency = Just true, timeoutInMs = Just 10.0 })}
Cache.restoreCache { paths: [], primaryKey: "restorecaceh", restoreKeys: Just [ "a" ], options: Just (Cache.defaultDownloadOptions { useAzureSdk = Just true, downloadConcurrency = Just true, timeoutInMs = Just 10.0 }) }

-- Tests for GitHub.Actions.Exec
let
Expand All @@ -68,7 +68,7 @@ main = do
runAff_ execCb $ runExceptT do
_ <- Exec.exec' "pwd"
_ <- Exec.exec { command: "pwd", args: Just [ "-L" ], options: Nothing }
Exec.exec { command: "pwd", args: Just [ "-L" ], options: Just (Exec.defaultExecOptions { delay = Just 10.0 })}
Exec.exec { command: "pwd", args: Just [ "-L" ], options: Just (Exec.defaultExecOptions { delay = Just 10.0 }) }

-- Tests for GitHub.Actions.IO
let
Expand All @@ -78,7 +78,7 @@ main = do
runAff_ ioCb $ runExceptT do
_ <- Exec.exec' "touch test.txt"
_ <- IO.cp' { source: "test.txt", dest: "test1.txt" }
_ <- IO.cp { source: "test1.txt", dest: "test2.txt", options: Just (IO.defaultCopyOptions { force = Just true })}
_ <- IO.cp { source: "test1.txt", dest: "test2.txt", options: Just (IO.defaultCopyOptions { force = Just true }) }
_ <- IO.mv' { source: "test2.txt", dest: "test3.txt" }
_ <- IO.mv { source: "test3.txt", dest: "test4.txt", options: Just (IO.defaultMoveOptions { force = Just true }) }
_ <- IO.rmRF { inputPath: "test4.txt" }
Expand Down
12 changes: 6 additions & 6 deletions test/action.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
name: 'Test'
description: 'Test out bindings in this library'
name: "Test"
description: "Test out bindings in this library"
runs:
using: 'node20'
main: '../dist/index.js'
using: "node20"
main: "../dist/index.js"
inputs:
testinput:
description: 'Test input for test action'
description: "Test input for test action"
required: true
outputs:
testoutput:
description: 'Test output for test action'
description: "Test output for test action"
Loading