Skip to content

Commit 35ca19e

Browse files
author
Colin Wahl
authored
Fix ToolCache.find and add a test action (#8)
1 parent b89167c commit 35ca19e

File tree

6 files changed

+32
-4
lines changed

6 files changed

+32
-4
lines changed

.github/workflows/ci.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,5 +43,8 @@ jobs:
4343
- name: Build the project
4444
run: npm run build
4545

46+
- name: Build and bundle tests
47+
run: spago bundle-module --main Test.Main --to output/index.js && ./node_modules/@vercel/ncc/dist/ncc/cli.js build --minify test/index.js
48+
4649
- name: Run tests
47-
run: npm run test
50+
uses: ./test

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
"test": "spago test --no-install"
66
},
77
"devDependencies": {
8+
"@vercel/ncc": "^0.24.1",
89
"eslint": "^7.6.0"
910
},
1011
"dependencies": {

src/GitHub/Actions/ToolCache.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,9 @@ exports.cacheFile4Impl = toolCache.cacheFile;
4949

5050
exports.cacheFile5Impl = toolCache.cacheFile;
5151

52-
exports.find2Impl = toolCache.findImpl;
52+
exports.find2Impl = toolCache.find;
5353

54-
exports.find3Impl = toolCache.findImpl;
54+
exports.find3Impl = toolCache.find;
5555

5656
exports.findAllVersions1Impl = toolCache.findAllVersions;
5757

test/Main.purs

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,21 @@ module Test.Main where
22

33
import Prelude
44

5+
import Control.Monad.Except.Trans (runExceptT)
6+
import Data.Either (Either(..))
7+
import Data.Maybe (Maybe(..))
58
import Effect (Effect)
9+
import Effect.Exception (message)
10+
import GitHub.Actions.Core as Core
11+
import GitHub.Actions.ToolCache as ToolCache
612

713
main :: Effect Unit
8-
main = pure unit
14+
main = do
15+
Core.info "Starting test action..."
16+
result <- runExceptT do
17+
_ <- ToolCache.find' { toolName: "my-tool", versionSpec: "12.x" }
18+
ToolCache.find { toolName: "my-tool", versionSpec: "12.x", arch: Just "armv6" }
19+
case result of
20+
Left err -> Core.setFailed (message err)
21+
Right _ -> Core.info "No errors in find"
22+
Core.info "Done running test action."

test/action.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
name: 'Test'
2+
description: 'Test out bindings in this library'
3+
runs:
4+
using: 'node12'
5+
main: '../dist/index.js'

test/index.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
"use strict";
2+
3+
var Test = require("../output/index");
4+
5+
Test.main();

0 commit comments

Comments
 (0)