Skip to content

Commit

Permalink
add CI to test Clojure solutions
Browse files Browse the repository at this point in the history
  • Loading branch information
narimiran committed Nov 26, 2023
1 parent b433c30 commit 99f740a
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 2 deletions.
41 changes: 41 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: CI

on: [push, pull_request]

jobs:
test-solutions:
strategy:
matrix:
os: [ubuntu-latest, macOS-latest]
fail-fast: false

runs-on: ${{ matrix.os }}

steps:
- name: Checkout
uses: actions/checkout@v3

- name: Prepare java
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: '17'

- name: Install Clojure
uses: DeLaGuardo/[email protected]
with:
cli: '1.10.3.1013'

- name: Cache clojure dependencies
uses: actions/cache@v3
with:
path: |
~/.m2/repository
~/.gitlibs
~/.deps.clj
# List all files containing dependencies:
key: cljdeps-${{ hashFiles('deps.edn') }}
restore-keys: cljdeps-

- name: Test solutions
run: clojure -M clojure/tests/solutions_tests.clj
6 changes: 4 additions & 2 deletions clojure/tests/solutions_tests.clj
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
day11 day12 day13 day14 day15
day16 day17 day18 day19 day20
day21 day22 day23 day24 day25
[clojure.test :refer [deftest are run-tests]]))
[clojure.test :refer [deftest are run-tests successful?]]))


(defmacro check-day [day test-results real-results]
Expand Down Expand Up @@ -64,4 +64,6 @@
(check-day 25 "2=-1=0" "122-2=200-0111--=200")


(run-tests)
(let [summ (run-tests)]
(when-not (successful? summ)
(throw (Exception. "tests failed"))))

0 comments on commit 99f740a

Please sign in to comment.