From 75ee363ec2f0d6560e8bb0e0aac866d6729bed7a Mon Sep 17 00:00:00 2001 From: Serhii Khoma Date: Thu, 10 Oct 2024 21:53:53 +0700 Subject: [PATCH 1/7] feat: migrate to spago@next --- .github/workflows/ci.yml | 61 +++++++++++++------------------------- bower.json | 17 ++--------- package.json | 8 ++--- spago.yaml | 12 ++++++-- test/{ => Test}/Main.purs | 0 test/{ => Test}/action.yml | 0 test/{ => Test}/index.js | 0 7 files changed, 35 insertions(+), 63 deletions(-) rename test/{ => Test}/Main.purs (100%) rename test/{ => Test}/action.yml (100%) rename test/{ => Test}/index.js (100%) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1eb005c..76cf55a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,58 +1,37 @@ 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: Cache NPM dependencies - uses: actions/cache@v2 - env: - cache-name: cache-node-modules - with: - path: ~/.npm - key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package.json') }} - restore-keys: | - ${{ 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 - - - name: Build the project - run: npm run build - - - name: Build and bundle tests - run: ./node_modules/@vercel/ncc/dist/ncc/cli.js build --minify test/index.js + - name: Build source + run: spago build --censor-stats --strict --pedantic-packages - name: Run tests - uses: ./test - with: - testinput: test + run: spago test --offline --censor-stats --strict --pedantic-packages -- --censor-codes=UserDefinedWarning - - 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 diff --git a/bower.json b/bower.json index 4b249da..028e626 100644 --- a/bower.json +++ b/bower.json @@ -1,8 +1,6 @@ { "name": "purescript-github-actions-toolkit", - "license": [ - "MIT" - ], + "license": "MIT", "repository": { "type": "git", "url": "https://github.com/purescript-contrib/purescript-github-actions-toolkit" @@ -12,16 +10,5 @@ "node_modules", "bower_components", "output" - ], - "dependencies": { - "purescript-aff": "^7.0.0", - "purescript-aff-promise": "^4.0.0", - "purescript-effect": "^4.0.0", - "purescript-foreign-object": "^4.0.0", - "purescript-node-buffer": "^8.0.0", - "purescript-node-path": "^5.0.0", - "purescript-node-streams": "^7.0.0", - "purescript-nullable": "^6.0.0", - "purescript-transformers": "^6.0.0" - } + ] } diff --git a/package.json b/package.json index 5c37da0..a46d49a 100644 --- a/package.json +++ b/package.json @@ -2,15 +2,15 @@ "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" + "@vercel/ncc": "^0.38.2", + "eslint": "^9.12.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" diff --git a/spago.yaml b/spago.yaml index af2a6a5..577cabc 100644 --- a/spago.yaml +++ b/spago.yaml @@ -1,5 +1,11 @@ package: name: github-actions-toolkit + publish: + license: MIT + version: 0.5.0 + location: + githubOwner: purescript-contrib + githubRepo: purescript-github-actions-toolkit dependencies: - aff - aff-promise @@ -19,6 +25,6 @@ package: dependencies: - either workspace: - package_set: - registry: 50.4.0 - extra_packages: {} + packageSet: + registry: 60.5.0 + extraPackages: {} diff --git a/test/Main.purs b/test/Test/Main.purs similarity index 100% rename from test/Main.purs rename to test/Test/Main.purs diff --git a/test/action.yml b/test/Test/action.yml similarity index 100% rename from test/action.yml rename to test/Test/action.yml diff --git a/test/index.js b/test/Test/index.js similarity index 100% rename from test/index.js rename to test/Test/index.js From 050956e2555b0224706e999e6cddffad11ada85b Mon Sep 17 00:00:00 2001 From: Serhii Khoma Date: Thu, 10 Oct 2024 21:53:53 +0700 Subject: [PATCH 2/7] purs-tidy format-in-place src/**/*.purs test/**/*.purs --- src/GitHub/Actions/ToolCache.purs | 4 ++-- test/Test/Main.purs | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/GitHub/Actions/ToolCache.purs b/src/GitHub/Actions/ToolCache.purs index b7c0414..4170a01 100644 --- a/src/GitHub/Actions/ToolCache.purs +++ b/src/GitHub/Actions/ToolCache.purs @@ -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) @@ -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 diff --git a/test/Test/Main.purs b/test/Test/Main.purs index 965872a..fb84b05 100644 --- a/test/Test/Main.purs +++ b/test/Test/Main.purs @@ -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 @@ -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 @@ -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" } From 334987a9f8cc94deb40f67d5674519c435483765 Mon Sep 17 00:00:00 2001 From: Serhii Khoma Date: Thu, 10 Oct 2024 21:53:53 +0700 Subject: [PATCH 3/7] feat: migrate to spago@next --- .github/workflows/ci.yml | 2 +- bower.json | 8 +------- spago.yaml | 26 +++++++++++++------------- 3 files changed, 15 insertions(+), 21 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 76cf55a..832e988 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -28,7 +28,7 @@ jobs: output - name: Build source - run: spago build --censor-stats --strict --pedantic-packages + run: spago build --censor-stats --strict --ensure-ranges --pedantic-packages - name: Run tests run: spago test --offline --censor-stats --strict --pedantic-packages -- --censor-codes=UserDefinedWarning diff --git a/bower.json b/bower.json index 028e626..a96a0d9 100644 --- a/bower.json +++ b/bower.json @@ -4,11 +4,5 @@ "repository": { "type": "git", "url": "https://github.com/purescript-contrib/purescript-github-actions-toolkit" - }, - "ignore": [ - "**/.*", - "node_modules", - "bower_components", - "output" - ] + } } diff --git a/spago.yaml b/spago.yaml index 577cabc..b7759b1 100644 --- a/spago.yaml +++ b/spago.yaml @@ -7,19 +7,19 @@ package: 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: From 25d4aab96b308311367c1f1fe717876f536dd62e Mon Sep 17 00:00:00 2001 From: Serhii Khoma Date: Fri, 11 Oct 2024 14:50:50 +0700 Subject: [PATCH 4/7] fix: ci --- .github/workflows/ci.yml | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 832e988..89cbf03 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -27,11 +27,30 @@ jobs: .spago output + - name: Setup node and npm + uses: actions/setup-node@v4 + + - name: Cache NPM dependencies + uses: actions/cache@v4 + env: + cache-name: cache-node-modules + with: + path: ~/.npm + 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 + - name: Build source run: spago build --censor-stats --strict --ensure-ranges --pedantic-packages - name: Run tests - run: spago test --offline --censor-stats --strict --pedantic-packages -- --censor-codes=UserDefinedWarning + run: spago test --offline --censor-stats --strict --pedantic-packages - name: Verify formatting run: purs-tidy check src test From d8c06c424906c9d8b45cba6e32d59d915d9ef3a8 Mon Sep 17 00:00:00 2001 From: Serhii Khoma Date: Fri, 11 Oct 2024 15:40:44 +0700 Subject: [PATCH 5/7] fix: ci --- .github/workflows/ci.yml | 12 ++++++++---- bower.json | 8 -------- eslint.config.mjs | 8 ++++++++ package.json | 4 +++- test/Test/action.yml | 12 ------------ test/action.yml | 12 ++++++++++++ test/{Test => }/index.js | 0 7 files changed, 31 insertions(+), 25 deletions(-) delete mode 100644 bower.json create mode 100644 eslint.config.mjs delete mode 100644 test/Test/action.yml create mode 100644 test/action.yml rename test/{Test => }/index.js (100%) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 89cbf03..821a4e2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -46,11 +46,15 @@ jobs: - name: Install NPM dependencies run: npm install - - name: Build source - run: spago build --censor-stats --strict --ensure-ranges --pedantic-packages + - name: Build the project + run: npm run build - - name: Run tests - run: spago test --offline --censor-stats --strict --pedantic-packages + - name: Build and bundle tests + run: ./node_modules/@vercel/ncc/dist/ncc/cli.js build --minify test/index.js + + - uses: ./test + with: + testinput: test - name: Verify formatting run: purs-tidy check src test diff --git a/bower.json b/bower.json deleted file mode 100644 index a96a0d9..0000000 --- a/bower.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "name": "purescript-github-actions-toolkit", - "license": "MIT", - "repository": { - "type": "git", - "url": "https://github.com/purescript-contrib/purescript-github-actions-toolkit" - } -} diff --git a/eslint.config.mjs b/eslint.config.mjs new file mode 100644 index 0000000..2edbef8 --- /dev/null +++ b/eslint.config.mjs @@ -0,0 +1,8 @@ +import globals from "globals"; +import pluginJs from "@eslint/js"; + + +export default [ + {languageOptions: { globals: globals.browser }}, + pluginJs.configs.recommended, +]; \ No newline at end of file diff --git a/package.json b/package.json index a46d49a..0d79887 100644 --- a/package.json +++ b/package.json @@ -5,8 +5,10 @@ "test": "spago test --offline" }, "devDependencies": { + "@eslint/js": "^9.12.0", "@vercel/ncc": "^0.38.2", - "eslint": "^9.12.0" + "eslint": "^9.12.0", + "globals": "^15.11.0" }, "dependencies": { "@actions/cache": "^3.2.4", diff --git a/test/Test/action.yml b/test/Test/action.yml deleted file mode 100644 index 20b3a5b..0000000 --- a/test/Test/action.yml +++ /dev/null @@ -1,12 +0,0 @@ -name: 'Test' -description: 'Test out bindings in this library' -runs: - using: 'node20' - main: '../dist/index.js' -inputs: - testinput: - description: 'Test input for test action' - required: true -outputs: - testoutput: - description: 'Test output for test action' diff --git a/test/action.yml b/test/action.yml new file mode 100644 index 0000000..8551718 --- /dev/null +++ b/test/action.yml @@ -0,0 +1,12 @@ +name: "Test" +description: "Test out bindings in this library" +runs: + using: "node20" + main: "../dist/index.js" +inputs: + testinput: + description: "Test input for test action" + required: true +outputs: + testoutput: + description: "Test output for test action" diff --git a/test/Test/index.js b/test/index.js similarity index 100% rename from test/Test/index.js rename to test/index.js From 3644725b3c4eb17f5c3c4a556a71c10d06e5d5b7 Mon Sep 17 00:00:00 2001 From: Serhii Khoma Date: Mon, 14 Oct 2024 11:26:41 +0700 Subject: [PATCH 6/7] feat: bump version to 1.0.0 --- spago.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spago.yaml b/spago.yaml index b7759b1..c1a20e0 100644 --- a/spago.yaml +++ b/spago.yaml @@ -2,7 +2,7 @@ package: name: github-actions-toolkit publish: license: MIT - version: 0.5.0 + version: 1.0.0 location: githubOwner: purescript-contrib githubRepo: purescript-github-actions-toolkit From bbe7eb9d05de1eaf53bb4463981cd18d075a855c Mon Sep 17 00:00:00 2001 From: Serhii Khoma Date: Mon, 14 Oct 2024 14:53:51 +0700 Subject: [PATCH 7/7] fix: libraries should not use package sets at all -> use solver --- spago.yaml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/spago.yaml b/spago.yaml index c1a20e0..1c677dd 100644 --- a/spago.yaml +++ b/spago.yaml @@ -24,7 +24,4 @@ package: main: Test.Main dependencies: - either -workspace: - packageSet: - registry: 60.5.0 - extraPackages: {} +workspace: {}