Skip to content

Commit 6691bae

Browse files
committed
CLJS-3262: Add self-parity tests to GitHub actions
1 parent a19f8e0 commit 6691bae

File tree

6 files changed

+98
-4
lines changed

6 files changed

+98
-4
lines changed

.github/workflows/test.yaml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,43 @@ jobs:
8989
- name: Run tests
9090
run: node builds/out-self/core-self-test.js
9191

92+
# Self-parity Tests
93+
self-parity-test:
94+
name: Self-parity Tests
95+
runs-on: ubuntu-latest
96+
steps:
97+
- uses: actions/checkout@v2
98+
99+
- uses: DeLaGuardo/[email protected]
100+
with:
101+
tools-deps: '1.10.1.536'
102+
103+
- name: Cache maven
104+
uses: actions/cache@v2
105+
env:
106+
cache-name: cache-maven
107+
with:
108+
path: ~/.m2
109+
key: ${{ runner.os }}-${{ env.cache-name }}-${{ hashFiles('**/deps.edn') }}
110+
restore-keys: |
111+
${{ runner.os }}-${{ env.cache-name }}-
112+
113+
- name: Cache gitlibs
114+
uses: actions/cache@v2
115+
env:
116+
cache-name: cache-gitlibs
117+
with:
118+
path: ~/.gitlibs
119+
key: ${{ runner.os }}-${{ env.cache-name }}-${{ hashFiles('**/deps.edn') }}
120+
restore-keys: |
121+
${{ runner.os }}-${{ env.cache-name }}-
122+
123+
- name: Build tests
124+
run: clojure -A:selfparity.test.build
125+
126+
- name: Run tests
127+
run: node builds/out-self-parity/main.js
128+
92129
# Compiler Tests
93130
compiler-test:
94131
name: Compiler Tests

deps.edn

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,8 @@
2020
:runtime.test.build {:extra-paths ["src/test/cljs"]
2121
:main-opts ["-m" "cljs.main" "-co" "resources/test.edn" "-c"]}
2222
:selfhost.test.build {:extra-paths ["src/test/self"]
23-
:main-opts ["-m" "cljs.main" "-co" "resources/self_host_test.edn" "-c"]}}}
23+
:main-opts ["-m" "cljs.main" "-co" "resources/self_host_test.edn" "-c"]}
24+
:selfparity.test.build {:extra-paths ["src/test/self"]
25+
:main-opts ["-i" "src/test/self/self_parity/setup.clj"
26+
"-e" "(self-parity.setup/-main)"
27+
"-m" "cljs.main" "-co" "resources/self_parity_test.edn" "-c"]}}}

resources/self_parity_test.edn

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{:optimizations :none
2+
:main self-parity.test
3+
:output-to "builds/out-self-parity/main.js"
4+
:output-dir "builds/out-self-parity"
5+
:cache-analysis-format :edn
6+
:target :nodejs}

src/test/self/self_parity/auxiliary.cljs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@
66
;; the terms of this license.
77
;; You must not remove this notice, or any other, from this software.
88

9-
(ns ^{:doc "This auxiliary namespace is not actually loaded.
10-
Its mere presence cause it to be compiled and thus causes
9+
(ns ^{:doc "This auxiliary namespace only exists to cause
1110
the libs listed here to be dumped into the compiler output
1211
directory where they can be loaded on demand when running
1312
the compiler tests in bootstrap mode."}

src/test/self/self_parity/setup.clj

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
;; Copyright (c) Rich Hickey. All rights reserved.
2+
;; The use and distribution terms for this software are covered by the
3+
;; Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)
4+
;; which can be found in the file epl-v10.html at the root of this distribution.
5+
;; By using this software in any fashion, you are agreeing to be bound by
6+
;; the terms of this license.
7+
;; You must not remove this notice, or any other, from this software.
8+
9+
(ns self-parity.setup
10+
^{:doc "Sets up the filesystem, priming the output directory
11+
with needed source files so that the self-hosted compiler
12+
being executed within Node has various dependency sources
13+
available (without the benefit of being able to load resources
14+
from a classpath)."}
15+
(:require
16+
[clojure.java.io :as io]))
17+
18+
(def out-path (io/file "builds" "out-self-parity"))
19+
20+
(defn copy-source
21+
[source-resource-name]
22+
(let [target-file (io/file out-path source-resource-name)]
23+
(io/make-parents target-file)
24+
(io/copy (io/input-stream (io/resource source-resource-name)) target-file)))
25+
26+
(def test-check-source-resource-names
27+
["clojure/test/check.cljc"
28+
"clojure/test/check/random.clj"
29+
"clojure/test/check/random.cljs"
30+
"clojure/test/check/rose_tree.cljc"
31+
"clojure/test/check/clojure_test.cljc"
32+
"clojure/test/check/clojure_test/assertions.cljc"
33+
"clojure/test/check/clojure_test/assertions/cljs.cljc"
34+
"clojure/test/check/results.cljc"
35+
"clojure/test/check/impl.cljc"
36+
"clojure/test/check/properties.cljc"
37+
"clojure/test/check/random/longs.cljs"
38+
"clojure/test/check/random/doubles.cljs"
39+
"clojure/test/check/random/longs/bit_count_impl.cljs"
40+
"clojure/test/check/generators.cljc"])
41+
42+
(def source-resource-names
43+
(into ["clojure/template.clj"]
44+
test-check-source-resource-names))
45+
46+
(defn -main []
47+
(run! copy-source source-resource-names))

src/test/self/self_parity/test.cljs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@
2121
[cljs.js :as cljs]
2222
[cljs.tools.reader :as reader]
2323
[cljs.stacktrace :as st]
24-
[goog.object :as gobj]))
24+
[goog.object :as gobj]
25+
[self-parity.auxiliary]))
2526

2627
(def out-dir "builds/out-self-parity")
2728

0 commit comments

Comments
 (0)