Skip to content
This repository has been archived by the owner on Aug 30, 2024. It is now read-only.

Commit

Permalink
Prep jar building, CI checks
Browse files Browse the repository at this point in the history
  • Loading branch information
joodie committed Jun 26, 2024
1 parent 9292af2 commit d297de9
Show file tree
Hide file tree
Showing 10 changed files with 145 additions and 9 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/dependency-vulnerabilities.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# SPDX-FileCopyrightText: 2024 Topsector Logistiek
# SPDX-FileContributor: Joost Diepenmaat <[email protected]>
# SPDX-FileContributor: Remco van 't Veer <[email protected]>
#
# SPDX-License-Identifier: AGPL-3.0-or-later

name: Check dependency vulnerabilities

on:
Expand Down
6 changes: 6 additions & 0 deletions .github/workflows/install-binaries.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
#!/usr/bin/env bash

# SPDX-FileCopyrightText: 2024 Topsector Logistiek
# SPDX-FileContributor: Joost Diepenmaat <[email protected]>
# SPDX-FileContributor: Remco van 't Veer <[email protected]>
#
# SPDX-License-Identifier: AGPL-3.0-or-later

set -ex

CLOJURE_VERSION="1.11.1.1273"
Expand Down
38 changes: 38 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# SPDX-FileCopyrightText: 2024 Jomco B.V.
# SPDX-FileCopyrightText: 2024 Topsector Logistiek
# SPDX-FileContributor: Joost Diepenmaat <[email protected]
# SPDX-FileContributor: Remco van 't Veer <[email protected]>
#
# SPDX-License-Identifier: AGPL-3.0-or-later

name: Test

on: push

jobs:
check:
name: Check
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- uses: actions/cache@v4
with:
path: "~/.m2"
key: "deps-${{ hashFiles('deps.edn') }}"

- name: Install packages
run: |
sudo apt-get install -y reuse
- name: Install clj runtime
run: |
cd "$HOME"
curl -L -O https://github.com/clojure/brew-install/releases/latest/download/linux-install.sh
bash linux-install.sh -p "$HOME"
- name: Run make check
run: |
PATH="$PATH:$HOME/bin"
make check
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@
.cpcache
.nrepl-port
*.pem
/ishare-jwt/target/
20 changes: 20 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# SPDX-FileCopyrightText: 2024 Jomco B.V.
# SPDX-FileCopyrightText: 2024 Topsector Logistiek
# SPDX-FileContributor: Joost Diepenmaat <[email protected]
# SPDX-FileContributor: Remco van 't Veer <[email protected]>
#
# SPDX-License-Identifier: AGPL-3.0-or-later

.PHONY: check working_tree_clean_check test

working_tree_clean_check:
# ensure no uncommitted stuff
# git-status --porcelain should print 0 lines. wc -l counts lines
# tee /dev/fd/2 prints any uncommitted changes to stderr for logging in CI
exit $$(git status --porcelain |tee /dev/fd/2| wc -l)

check: working_tree_clean_check
$(MAKE) -C ishare-jwt check

test:
$(MAKE) -C ishare-jwt test
7 changes: 7 additions & 0 deletions ishare-jwt/.nvd-config.edn
Original file line number Diff line number Diff line change
@@ -1 +1,8 @@
;;; SPDX-FileCopyrightText: 2024 Jomco B.V.
;;; SPDX-FileCopyrightText: 2024 Topsector Logistiek
;;; SPDX-FileContributor: Joost Diepenmaat <[email protected]
;;; SPDX-FileContributor: Remco van 't Veer <[email protected]>
;;;
;;; SPDX-License-Identifier: AGPL-3.0-or-later

{:suppression-file ".nvd-suppressions.xml"}
9 changes: 9 additions & 0 deletions ishare-jwt/.nvd-suppressions.xml
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
<!--
SPDX-FileCopyrightText: 2024 Topsector Logistiek
SPDX-FileCopyrightText: 2024 Jomco B.V.
SPDX-FileContributor: Joost Diepenmaat <[email protected]>
SPDX-FileContributor: Remco van 't Veer <[email protected]>
SPDX-License-Identifier: AGPL-3.0-or-later
-->

<suppressions xmlns="https://jeremylong.github.io/DependencyCheck/dependency-suppression.1.3.xsd">
<!-- This is an automatically generated config file by nvd-clojure. -->
<!-- Feel free to tweak it, version-control it and remove any comment. -->
Expand Down
14 changes: 10 additions & 4 deletions ishare-jwt/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
#
# SPDX-License-Identifier: AGPL-3.0-or-later

.PHONY: all lint test check clean test-certs

.PHONY: all lint test check clean test-certs jar

test/pem/ca.cert.pem:
mkdir -p test/pem
Expand Down Expand Up @@ -46,7 +45,14 @@ lint:
test: test-certs
clojure -M:test

check: lint test

clean:
rm -rf classes target test/pem

jar: clean
clj -T:build jar


check: test lint outdated

outdated:
clojure -M:outdated
39 changes: 39 additions & 0 deletions ishare-jwt/build.clj
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
;;; SPDX-FileCopyrightText: 2024 Jomco B.V.
;;; SPDX-FileCopyrightText: 2024 Topsector Logistiek
;;; SPDX-FileContributor: Joost Diepenmaat <[email protected]
;;; SPDX-FileContributor: Remco van 't Veer <[email protected]>
;;;
;;; SPDX-License-Identifier: AGPL-3.0-or-later

(ns build
(:require [clojure.tools.build.api :as b]))

(def lib 'org.bdinetwork/ishare-jwt)
(def version (format "0.1.%s" (b/git-count-revs nil)))

(def jar-file (format "target/%s-%s.jar" (name lib) version))
(def class-dir "target/classes")

;; delay to defer side effects (artifact downloads)
(def basis (delay (b/create-basis {:project "deps.edn"})))

(defn clean [_]
(b/delete {:path "target"}))

(defn jar [_]
(b/write-pom {:class-dir class-dir
:lib lib
:version version
:basis @basis
:src-dirs ["src"]
:pom-data [[:organization
[:name "BDI Network"]
[:url "https://bdinetwork.org"]]
[:licenses
[:license
[:name "AGPL-3.0-or-later"]
[:url "https://www.gnu.org/licenses/agpl-3.0.en.html"]]]]})
(b/copy-dir {:src-dirs ["src" "resources"]
:target-dir class-dir})
(b/jar {:class-dir class-dir
:jar-file jar-file}))
14 changes: 9 additions & 5 deletions ishare-jwt/deps.edn
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,15 @@
;;;
;;; SPDX-License-Identifier: AGPL-3.0-or-later

{:deps {buddy/buddy-sign {:mvn/version "3.5.351"}}
{:deps {buddy/buddy-sign {:mvn/version "3.5.351"}}
:paths ["src"]

:aliases
{:test {:extra-deps {lambdaisland/kaocha {:mvn/version "RELEASE"}}
:main-opts ["-m" "kaocha.runner"]}
:lint {:extra-deps {clj-kondo/clj-kondo {:mvn/version "RELEASE"}}
:main-opts ["-m" "clj-kondo.main" "--lint" "src" "test"]}}}
{:test {:extra-deps {lambdaisland/kaocha {:mvn/version "RELEASE"}}
:main-opts ["-m" "kaocha.runner"]}
:lint {:extra-deps {clj-kondo/clj-kondo {:mvn/version "RELEASE"}}
:main-opts ["-m" "clj-kondo.main" "--lint" "src" "test"]}
:build {:deps {io.github.clojure/tools.build {:mvn/version "0.10.4"}}
:ns-default build}
:outdated {:replace-deps {com.github.liquidz/antq {:mvn/version "RELEASE"}}
:main-opts ["-m" "antq.core"]}}}

0 comments on commit d297de9

Please sign in to comment.