Skip to content

Commit

Permalink
Fix ToolCache.find and add a test action (#8)
Browse files Browse the repository at this point in the history
  • Loading branch information
Colin Wahl authored Sep 22, 2020
1 parent b89167c commit 35ca19e
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 4 deletions.
5 changes: 4 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,5 +43,8 @@ jobs:
- name: Build the project
run: npm run build

- name: Build and bundle tests
run: spago bundle-module --main Test.Main --to output/index.js && ./node_modules/@vercel/ncc/dist/ncc/cli.js build --minify test/index.js

- name: Run tests
run: npm run test
uses: ./test
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"test": "spago test --no-install"
},
"devDependencies": {
"@vercel/ncc": "^0.24.1",
"eslint": "^7.6.0"
},
"dependencies": {
Expand Down
4 changes: 2 additions & 2 deletions src/GitHub/Actions/ToolCache.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@ exports.cacheFile4Impl = toolCache.cacheFile;

exports.cacheFile5Impl = toolCache.cacheFile;

exports.find2Impl = toolCache.findImpl;
exports.find2Impl = toolCache.find;

exports.find3Impl = toolCache.findImpl;
exports.find3Impl = toolCache.find;

exports.findAllVersions1Impl = toolCache.findAllVersions;

Expand Down
16 changes: 15 additions & 1 deletion test/Main.purs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,21 @@ module Test.Main where

import Prelude

import Control.Monad.Except.Trans (runExceptT)
import Data.Either (Either(..))
import Data.Maybe (Maybe(..))
import Effect (Effect)
import Effect.Exception (message)
import GitHub.Actions.Core as Core
import GitHub.Actions.ToolCache as ToolCache

main :: Effect Unit
main = pure unit
main = do
Core.info "Starting test action..."
result <- runExceptT do
_ <- ToolCache.find' { toolName: "my-tool", versionSpec: "12.x" }
ToolCache.find { toolName: "my-tool", versionSpec: "12.x", arch: Just "armv6" }
case result of
Left err -> Core.setFailed (message err)
Right _ -> Core.info "No errors in find"
Core.info "Done running test action."
5 changes: 5 additions & 0 deletions test/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
name: 'Test'
description: 'Test out bindings in this library'
runs:
using: 'node12'
main: '../dist/index.js'
5 changes: 5 additions & 0 deletions test/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
"use strict";

var Test = require("../output/index");

Test.main();

0 comments on commit 35ca19e

Please sign in to comment.