Skip to content

Commit 5c0b007

Browse files
committed
first draft
1 parent ffe5938 commit 5c0b007

File tree

4 files changed

+85
-1
lines changed

4 files changed

+85
-1
lines changed

Dockerfile

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
FROM clojure:tools-deps
2+
3+
COPY check.sh /check.sh
4+
5+
RUN clojure -Ttools install io.github.cljdoc/cljdoc-analyzer '{:git/tag "v1.0.695"}' :as cljdoc
6+
7+
ENTRYPOINT ["bash", "/check.sh"]

README.md

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,33 @@
1-
# cljdoc-check-action
1+
# CljDoc Check Action
2+
23
GitHub Action for checking that CljDoc will be able to analyze the project successfully
4+
5+
NOTE: CljDoc only works on the JAR archive of the library so you need to build it first.
6+
7+
Checking a clojure-deps based library is as simple as:
8+
9+
```yaml
10+
name: Check Cljdoc
11+
on: [pull_request]
12+
jobs:
13+
check-cljdoc:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@v1
17+
- name Build target/<the lib>*.jar so that CljDoc analyze can use it:
18+
run: clojure -T:build jar # REPALCE with whatever you do to build your jar
19+
- name: CljDoc Check
20+
uses: cljdoc/cljdoc-check-action@v1
21+
```
22+
23+
For other types of libraries, you need to install these into the local Maven repository (e.g. via `lein install`) and pass it the Maven coordinate and version:
24+
25+
```yaml
26+
# inside jobs.<name>.steps
27+
- run: lein install # or whatever is usitable for your build tool/project, to install the library into a maven repo
28+
- name: CljDoc Check
29+
uses: cljdoc/cljdoc-check-action@v1
30+
with:
31+
mvn_project: io.aviso/pretty
32+
mvn_version: LATEST
33+
```

action.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# ref: https://help.github.com/en/actions/building-actions/metadata-syntax-for-github-actions
2+
name: CljDoc Check Action
3+
description: Check that CljDoc will be able to analyze the project successfully
4+
5+
author: Jakub Holý
6+
7+
branding:
8+
color: blue
9+
icon: check-square
10+
11+
inputs:
12+
action:
13+
required: false
14+
description: 'The check action to run - analyze-local for deps-based projects, analyze for others'
15+
default: 'analyze-local'
16+
mvn_project:
17+
required: false
18+
description: 'Required for `analyze` - the maven group-id/project-id of the library to check; ex.: io.aviso/pretty'
19+
mvn_version:
20+
required: false
21+
description: 'Required for `analyze` - the maven version of the library to check; ex.: 0.1.29-SNAPSHOT'
22+
23+
24+
runs:
25+
using: docker
26+
image: Dockerfile
27+
args:
28+
- -e action=${{ inputs.action }}
29+
- -e mvn_project=${{ inputs.mvn_project }}
30+
- -e mvn_version=${{ inputs.mvn_version }}

check.sh

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
set -x
2+
set -e
3+
die {
4+
echo "ERROR: $1"
5+
exit -1;
6+
}
7+
8+
if [ "$action" -eq "analyze" ]; then
9+
echo "Running 'analyze :project $mvn_project :version $mvn_version' to check a libary installed into a Maven repo"
10+
[ -n "$mvn_project" ] || die 'Missing argument mvn_project that is required for action=analyze'
11+
[ -n "$mvn_version" ] || die 'Missing argument mvn_version that is required for action=analyze'
12+
clojure -Tcljdoc :download true analyze :project \""$mvn_project"\" :version \""$mvn_version"\"
13+
else
14+
echo "Running 'analyze-local' to check the deps.edn based project in the current directory..."
15+
clojure -Tcljdoc analyze-local
16+
fi

0 commit comments

Comments
 (0)