Skip to content

Commit 08c554d

Browse files
committed
ci: run canary tests in matrix one job per lib
Take a stab at running each canary lib test as a GitHub Action job. If this works, it should run canary tests in parallel, which is nice. But the real benefit will be able to rerun a single failed canary lib that has flaked out on CI rather than having to rerun them all.
1 parent 6a78066 commit 08c554d

File tree

2 files changed

+30
-4
lines changed

2 files changed

+30
-4
lines changed

.github/workflows/libs-test.yml

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,32 @@ name: Libs Test
33
on: [push, pull_request]
44

55
jobs:
6+
enumerate-libs:
7+
runs-on: ubuntu-latest
8+
9+
outputs:
10+
libs: ${{ steps.set-libs.outputs.libs }}
11+
12+
steps:
13+
- uses: actions/checkout@v3
14+
15+
- name: Install babashka
16+
uses: turtlequeue/[email protected]
17+
with:
18+
babashka-version: 0.8.1
19+
20+
- id: set-libs
21+
name: Set libs var for matrix
22+
## call bb script directly instead of as task to avoid task status output
23+
run: echo "::set-output name=libs::$(bb script/test_libs.clj list --format=json)"
24+
625
libs-test:
26+
needs: enumerate-libs
727
runs-on: ubuntu-latest
28+
strategy:
29+
fail-fast: false
30+
matrix:
31+
lib: ${{fromJSON(needs.enumerate-libs.outputs.libs)}}
832

933
steps:
1034
- uses: actions/checkout@v3
@@ -36,7 +60,7 @@ jobs:
3660
- name: Install babashka
3761
uses: turtlequeue/[email protected]
3862
with:
39-
babashka-version: 0.7.8
63+
babashka-version: 0.8.1
4064

4165
- name: Install Clojure
4266
run: curl -s https://download.clojure.org/install/linux-install-1.10.3.986.sh | sudo bash
@@ -55,4 +79,4 @@ jobs:
5579
planck --version
5680
5781
- name: Run Libs Tests
58-
run: bb test-libs run
82+
run: bb test-libs run $${ matrix.lib }

script/test_libs.clj

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -509,7 +509,7 @@
509509
0 1))))))
510510

511511
(def args-usage "Valid args:
512-
list
512+
list [--format=json]
513513
run [<lib-name>...]
514514
outdated [<lib-name>...]
515515
--help
@@ -528,7 +528,9 @@ Specifying no lib-names selects all libraries.")
528528
(when-let [opts (main/doc-arg-opt args-usage args)]
529529
(cond
530530
(get opts "list")
531-
(status/line :detail (str "available libs: " (string/join " " (map :name libs))))
531+
(if (= "json" (get opts "--format"))
532+
(status/line :detail (->> libs (map :name) json/generate-string))
533+
(status/line :detail (str "available libs: " (string/join " " (map :name libs)))))
532534

533535
:else
534536
(let [lib-names (get opts "<lib-name>")

0 commit comments

Comments
 (0)