Skip to content

Latest commit

 

History

9 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

magic-conformance

MAGIC conformance

Does a Clojure library still build and test under MAGIC (Clojure→.NET for Unity/IL2CPP)? MAGIC ships Clojure 1.10 and ClojureCLR (cljr) is ahead of it, so passing on one CLR compiler says nothing about the other.

This runner clones each library in a manifest and tests it on both, inside the ci-clj-clr image:

  • nos build and nos test (MAGIC), always.
  • cljr -X:test (ClojureCLR), when the library's deps-clr.edn has a runnable :test alias.

Results are cached, so only changed libraries re-run.

libs.edn here is a small green example. scripts/conformance.clj is reusable: point it at your own manifest.

Use it in your project

Add the runner to your bb.edn:

{:deps {io.github.flybot-sg/magic-conformance {:git/tag "v0.1.0" :git/sha "..."}}  ; pin a tag/sha
 :tasks
 {:requires ([conformance :as c])
  check     {:task (c/check! (first *command-line-args*))}
  check-all {:task (c/check-all! (boolean (some #{"--force"} *command-line-args*)))}}}

Write a libs.edn, one entry per library:

{my-org/my-lib
 {:git/url  "https://github.com/my-org/my-lib.git"  ; https or ssh
  :git/ref  "master"                                ; branch, tag, or sha
  :magic    {:build {:exclude [my.lib.jvm-only]}}   ; optional: written as magic.edn if the repo ships none
  :deps-clr {:paths ["src"]}                        ; optional: written as deps-clr.edn if the repo ships none
  :tasks    [build test]                            ; optional: auto-detected from magic.edn / dotnet.clj
  :cljr     false}}                                  ; optional: skip the ClojureCLR lane

Optional conformance.edn overrides the defaults:

{:default-ref "master" :magic-version "v0.12.0"}

Run inside the ci-clj-clr image, or with nos and cljr on your PATH:

bb check my-lib        # one library
bb check-all           # all, incremental (writes results.edn)
bb check-all --force   # ignore the cache
bb rct                 # test the runner's helpers
bb clean               # drop work/ clones

How it works

flowchart LR
  L[libs.edn] --> R[bb check-all]
  R -->|per library| S{ls-remote: ref SHA +<br/>MAGIC + config same?}
  S -->|yes| K[reuse cached result]
  S -->|no| A[clone] --> B[inject magic.edn / deps-clr.edn<br/>if the repo ships none] --> C[nos build + test<br/>+ cljr -X:test when available]
  C --> W[(results.edn)]
  K --> W
Loading

A result is keyed on (ref SHA, MAGIC version, config spec). results.edn is generated locally with bb check-all and committed; CI only reads it as the cache baseline. Bump :magic-version when the ci-clj-clr image tag bumps: it invalidates the cache, so every library re-runs under the new compiler.

Files

libs.edn                 the manifest (example: three green libs)
scripts/conformance.clj  the runner
deps.edn                 exposes the runner as a dependency
results.edn              committed run snapshot + cache baseline

About

Check if Clojure libs ported to the CLR via ClojureCLR also runs on Magic

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages