diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..d68d377 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,10 @@ +# Please see the documentation for all configuration options: +# https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file + +version: 2 +updates: + - package-ecosystem: github-actions + directory: "/" + schedule: { interval: monthly } + cooldown: { default-days: 14 } + groups: { github-actions: { patterns: ["*"] } } diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..56d4bfd --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,40 @@ +name: CI + +on: + push: + pull_request: + +jobs: + test: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + + - uses: actions/setup-java@de7274f081f381c8f8158605e0321c36c376e2e6 # v6.0.1 + with: + distribution: temurin + java-version: '11' + + - uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0 + with: + node-version: '24' + + - uses: DeLaGuardo/setup-clojure@6d46099eae24853c33c0482f2bb54edf4f1a4c74 # 13.7.0 + with: + lein: latest + + - name: Cache Maven repository + uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 + with: + path: ~/.m2/repository + key: m2-${{ hashFiles('project.clj') }} + restore-keys: m2- + + - name: Install dependencies + run: lein do deps, cljsbuild deps + + - name: Compile + run: lein compile + + - name: Test + run: lein test diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 97bb13a..0000000 --- a/.travis.yml +++ /dev/null @@ -1,3 +0,0 @@ -language: clojure -script: lein cleantest -sudo: false diff --git a/README.md b/README.md index 2731674..75d90a8 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# clojurescript.csv [![Build Status](https://travis-ci.org/testdouble/clojurescript.csv.png?branch=main)](https://travis-ci.org/testdouble/clojurescript.csv) [![Dependency Status](https://www.versioneye.com/user/projects/53d67fe23648f4a793000046/badge.svg)](https://www.versioneye.com/user/projects/53d67fe23648f4a793000046) +# clojurescript.csv [![Build Status](https://github.com/testdouble/clojurescript.csv/actions/workflows/ci.yml/badge.svg)](https://github.com/testdouble/clojurescript.csv/actions/workflows/ci.yml) A ClojureScript library for reading and writing comma (and other) separated values. diff --git a/node/runner.js b/node/runner.js new file mode 100644 index 0000000..102fda3 --- /dev/null +++ b/node/runner.js @@ -0,0 +1,15 @@ +// Runs a compiled test build in a fresh context (no Node globals such as +// `process`, which collide with Closure namespaces) and exits non-zero on failure. +var fs = require('fs'); +var vm = require('vm'); + +if (process.argv.length !== 3) { + console.log('Expected a compiled test file parameter.'); + process.exit(1); +} + +var context = vm.createContext({ console: console }); +vm.runInContext(fs.readFileSync(process.argv[2], 'utf8'), context); + +var passed = vm.runInContext('testdouble.cljs.csv_test.run()', context); +process.exit(passed ? 0 : 1); diff --git a/phantom/runner.js b/phantom/runner.js deleted file mode 100644 index dd569ef..0000000 --- a/phantom/runner.js +++ /dev/null @@ -1,30 +0,0 @@ -var page = require('webpage').create(); -var system = require('system'); - -if (system.args.length !== 2) { - console.log('Expected a target URL parameter.'); - phantom.exit(1); -} - -page.onConsoleMessage = function (message) { - console.log(message); -}; - -var url = system.args[1]; - -page.open(url, function (status) { - if (status !== "success") { - console.log('Failed to open ' + url); - setTimeout(function() { // https://github.com/ariya/phantomjs/issues/12697 - phantom.exit(1); - }, 0); - } - - page.evaluate(function() { - testdouble.cljs.csv_test.run(); - }); - - setTimeout(function() { // https://github.com/ariya/phantomjs/issues/12697 - phantom.exit(0); - }, 0); -}); diff --git a/project.clj b/project.clj index 8bc5c24..9253256 100644 --- a/project.clj +++ b/project.clj @@ -22,10 +22,8 @@ :compiler {:output-to "target/js/advanced.js" :optimizations :advanced :pretty-print false}}] - :test-commands {; PhantomJS tests - "phantom-whitespace" ["phantomjs" "phantom/runner.js" "test-resources/html/whitespace.html"] - "phantom-simple" ["phantomjs" "phantom/runner.js" "test-resources/html/simple.html"] - ;; "phantom-advanced" ["phantomjs" "phantom/runner.js" "test-resources/html/advanced.html"] - }} + :test-commands {"node-whitespace" ["node" "node/runner.js" "target/js/whitespace.js"] + "node-simple" ["node" "node/runner.js" "target/js/simple.js"] + "node-advanced" ["node" "node/runner.js" "target/js/advanced.js"]}} :aliases {"cleantest" ["do" "clean," "test"] "release" ["do" "clean," "deploy" "clojars"]}) diff --git a/test-resources/html/advanced.html b/test-resources/html/advanced.html deleted file mode 100644 index d25f85e..0000000 --- a/test-resources/html/advanced.html +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/test-resources/html/simple.html b/test-resources/html/simple.html deleted file mode 100644 index 75153e7..0000000 --- a/test-resources/html/simple.html +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/test-resources/html/whitespace.html b/test-resources/html/whitespace.html deleted file mode 100644 index e5ac2f6..0000000 --- a/test-resources/html/whitespace.html +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/test/testdouble/cljs/csv_test.cljs b/test/testdouble/cljs/csv_test.cljs index 9353176..fab045a 100644 --- a/test/testdouble/cljs/csv_test.cljs +++ b/test/testdouble/cljs/csv_test.cljs @@ -144,5 +144,11 @@ [""]] (csv/read-csv "\na b c\n")))))) +(def ^:private passed? (atom false)) + +(defmethod t/report [::t/default :end-run-tests] [summary] + (reset! passed? (t/successful? summary))) + (defn ^:export run [] - (run-tests)) + (run-tests) + @passed?)