-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #73 from Swirrl/circleci
Port to circleci and tools.build
- Loading branch information
Showing
12 changed files
with
242 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
# Use the latest 2.1 version of CircleCI pipeline process engine. | ||
# See: https://circleci.com/docs/2.0/configuration-reference | ||
version: 2.1 | ||
|
||
# Define a job to be invoked later in a workflow. | ||
# See: https://circleci.com/docs/2.0/configuration-reference/#jobs | ||
jobs: | ||
test: | ||
docker: | ||
- image: cimg/clojure:1.10 | ||
auth: | ||
username: $DOCKERHUB_USERNAME # can specify string literal values | ||
password: $DOCKERHUB_PASSWORD # or project environment variable reference | ||
# Add steps to the job | ||
# See: https://circleci.com/docs/2.0/configuration-reference/#steps | ||
steps: | ||
- checkout | ||
- run: | ||
name: Test | ||
command: "clojure -T:build test" | ||
- store_test_results: | ||
path: test-results | ||
|
||
deploy: | ||
docker: | ||
- image: cimg/clojure:1.10 | ||
auth: | ||
username: $DOCKERHUB_USERNAME # can specify string literal values | ||
password: $DOCKERHUB_PASSWORD # or project environment variable reference | ||
# Add steps to the job | ||
# See: https://circleci.com/docs/2.0/configuration-reference/#steps | ||
steps: | ||
- checkout | ||
- run: | ||
name: Build | ||
command: clojure -T:build build-lib | ||
- run: | ||
name: Deploy | ||
command: | | ||
if [ -n "${CIRCLE_TAG}" ]; then | ||
clojure -T:build deploy | ||
else | ||
/bin/echo "Not deploying, not a tagged commit" | ||
fi | ||
# Invoke jobs via workflows | ||
# See: https://circleci.com/docs/2.0/configuration-reference/#workflows | ||
workflows: | ||
build-workflow: | ||
jobs: | ||
- test: | ||
context: | ||
- swirrl-dockerhub-consumer | ||
filters: | ||
tags: | ||
only: /^v.*/ | ||
- deploy: | ||
context: | ||
- swirrl-dockerhub-consumer | ||
- swirrl-clojars-publisher | ||
requires: | ||
- test | ||
filters: | ||
tags: | ||
only: /^v.*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
#!/usr/bin/env sh | ||
clojure -A:with-logging:test:dev -m kaocha.runner "$@" | ||
clojure -M:with-logging:test:dev "$@" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
(ns build | ||
(:require [clojure.tools.build.api :as b] | ||
[org.corfield.build :as bb] | ||
[clojure.string :as str]) | ||
(:refer-clojure :exclude [test])) | ||
|
||
(def lib 'swirrl/csv2rdf) | ||
(def version (str/replace (or (System/getenv "CIRCLE_TAG") | ||
"v0.5.999-SNAPSHOT") | ||
#"^v" "")) | ||
(def class-dir "target/classes") | ||
|
||
|
||
(def jar-file (format "target/%s-%s.jar" (name lib) version)) | ||
|
||
(defn test | ||
"Run the tests" | ||
[opts] | ||
(bb/run-tests (assoc opts :aliases [:with-logging :dev]))) | ||
|
||
(defn build-lib | ||
"Run the CI pipeline of tests (and build the JAR)." | ||
[opts] | ||
(-> opts | ||
(assoc :lib lib | ||
:version version | ||
:src-pom "template/pom.xml") | ||
(bb/clean) | ||
(bb/jar))) | ||
|
||
(defn install | ||
"Install the JAR locally." | ||
[opts] | ||
(-> opts | ||
(assoc :lib lib :version version) | ||
(bb/install))) | ||
|
||
(defn deploy | ||
"Deploy the JAR to Clojars. | ||
NOTE: this expects a tag to be set; typically done via the github release UI." | ||
[opts] | ||
(-> opts | ||
(assoc :lib lib :version version) | ||
(bb/deploy))) | ||
|
||
(defn clean [_] | ||
(b/delete {:path "target"})) | ||
|
||
;; NOTE this is not yet built by CI | ||
(defn build-app | ||
"Build an uberjar for the command line app" | ||
[_] | ||
(clean nil) | ||
(b/copy-dir {:src-dirs ["resources"] | ||
:target-dir class-dir}) | ||
(let [basis (b/create-basis {:aliases [:cli :with-logging]})] | ||
(b/compile-clj {:basis basis | ||
:class-dir class-dir | ||
:src-dirs ["src"]}) | ||
(bb/uber {:main 'csv2rdf.main | ||
:basis basis | ||
:class-dir class-dir | ||
:uber-file "target/csv2rdf-app.jar" | ||
}))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
# Developing csv2rdf itself | ||
|
||
These notes cover how to use the tooling to build, test and develop | ||
the `csv2rdf` library and command line app. | ||
|
||
## Experimental GraalVM builds | ||
|
||
These are not yet merged to master; see the [`graal-native-image`](https://github.com/Swirrl/csv2rdf/pull/54) PR. | ||
|
||
## tools.deps and tools.build | ||
|
||
`csv2rdf` is now maintained with the tools.deps and tools.build libraries. | ||
|
||
The best workflow is always to use a REPL, exactly how this is done | ||
largely depends on your editor environment. However a basic REPL can | ||
be started with: | ||
|
||
``` | ||
$ clj | ||
``` | ||
|
||
or via something like a custom `:cider` alias in your `~/.clojure/deps.edn` | ||
|
||
``` | ||
$ clj -M:cider | ||
``` | ||
|
||
To run the tests: | ||
|
||
``` | ||
$ clojure -T:build test | ||
``` | ||
|
||
To build the command line application as an uberjar: | ||
|
||
``` | ||
$ clojure -T:build build-app | ||
``` | ||
|
||
and to run that app: | ||
|
||
``` | ||
$ java -jar target/csv2rdf-app.jar | ||
16:43:56.344 [main] ERROR csv2rdf.main - User metadata or tabular data file required | ||
Usage: | ||
-t, --tabular TABULAR Location of the tabular file | ||
-u, --user-metadata METADATA Location of the metadata file | ||
-o, --output-file OUTPUT Output file to write to | ||
-m, --mode MODE :standard CSVW mode to run | ||
``` | ||
|
||
## Circle CI | ||
|
||
Circle CI will run the tests on push for each branch. | ||
|
||
Currently CI only builds and deploys the library, releases of the | ||
command line app need to be made by hand. | ||
|
||
Releases are listed on the github [releases page](https://github.com/Swirrl/csv2rdf/releases). | ||
|
||
### Deploying new library jars to clojars | ||
|
||
You can do this by tagging a commit with `vX.Y.Z`, which will trigger | ||
the tests to be run by CI; if they then pass a build will pushed to | ||
clojars with that version number. | ||
|
||
A good workflow for this is to use github releases to coin a new | ||
release document the changes, and create that tag. Be sure to prefix | ||
your tags with `v` from now on (as some clojure tooling requires it | ||
e.g. cljdocs). |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<?xml version="1.0" encoding="UTF-8"?><project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<groupId>swirrl</groupId> | ||
<artifactId>csv2rdf</artifactId> | ||
<packaging>jar</packaging> | ||
<name>csv2rdf</name> | ||
<description>A clojure API implementing the W3C CSVW csv2rdf processor</description> | ||
<url>https://github.com/Swirrl/csv2rdf</url> | ||
<licenses> | ||
<license> | ||
<name>Eclipse Public License</name> | ||
<url>http://www.eclipse.org/legal/epl-v10.html</url> | ||
</license> | ||
</licenses> | ||
<scm> | ||
<url>https://github.com/Swirrl/csv2rdf</url> | ||
<connection>scm:git:git://github.com/Swirrl/csv2rdf.git</connection> | ||
<developerConnection>scm:git:ssh://git@github.com/Swirrl/csv2rdf.git</developerConnection> | ||
</scm> | ||
</project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#kaocha/v1 | ||
{:plugins [:kaocha.plugin/profiling :kaocha.plugin/junit-xml] | ||
:kaocha.plugin.junit-xml/target-file "test-results/kaocha/results.xml" | ||
:reporter kaocha.report.progress/progress | ||
;; :plugins [kaocha.plugin/profiling] | ||
} |
This file was deleted.
Oops, something went wrong.