Skip to content

Create project #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jun 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
216 changes: 216 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,216 @@
version: 2.1

######################################################################
#
# Start of general purpose config. These can plausibly go into orbs
#
######################################################################

# Default settings for executors

defaults: &defaults
working_directory: ~/repo

# Runners for OpenJDK 8/11/16/17

executors:
openjdk8:
docker:
- image: circleci/clojure:openjdk-8-lein-2.9.5
environment:
LEIN_ROOT: "true" # we intended to run lein as root
JVM_OPTS: -Xmx3200m # limit the maximum heap size to prevent out of memory errors
<<: *defaults

openjdk8_deploy:
docker:
- image: circleci/clojure:openjdk-8-lein-2.9.5
environment:
LEIN_ROOT: "true" # we intended to run lein as root
JVM_OPTS: -Xmx3200m # limit the maximum heap size to prevent out of memory errors
<<: *defaults

openjdk11:
docker:
- image: circleci/clojure:openjdk-11-lein-2.9.5
environment:
LEIN_ROOT: "true" # we intended to run lein as root
JVM_OPTS: -Xmx3200m --illegal-access=deny # forbid reflective access (this flag doesn't exist for JDK8 or JDK17+)
<<: *defaults

openjdk17:
docker:
- image: circleci/clojure:openjdk-17-lein-2.9.5-buster
environment:
LEIN_ROOT: "true" # we intended to run lein as root
JVM_OPTS: -Xmx3200m
<<: *defaults

# Runs a given set of steps, with some standard pre- and post-
# steps, including restoring of cache, saving of cache.
#
# we also install `make` here.
#
# Adapted from https://github.com/lambdaisland/meta/blob/master/circleci/clojure_orb.yml

commands:
with_cache:
description: |
Run a set of steps with Maven dependencies and Clojure classpath cache
files cached.
This command restores ~/.m2 and .cpcache if they were previously cached,
then runs the provided steps, and finally saves the cache.
The cache-key is generated based on the contents of `deps.edn` present in
the `working_directory`.
parameters:
steps:
type: steps
files:
description: Files to consider when creating the cache key
type: string
default: "deps.edn project.clj build.boot"
cache_version:
type: string
description: "Change this value to force a cache update"
default: "1"
steps:
- run:
name: Install make
command: |
sudo apt-get install make
- run:
name: Generate Cache Checksum
command: |
for file in << parameters.files >>
do
find . -name $file -exec cat {} +
done | shasum | awk '{print $1}' > /tmp/clojure_cache_seed
- restore_cache:
key: clojure-<< parameters.cache_version >>-{{ checksum "/tmp/clojure_cache_seed" }}
- steps: << parameters.steps >>
- save_cache:
paths:
- ~/.m2
- .cpcache
key: clojure-<< parameters.cache_version >>-{{ checksum "/tmp/clojure_cache_seed" }}

# The jobs are relatively simple. One runs utility commands against
# latest stable JDK + Clojure, the other against specified versions

jobs:

util_job:
description: |
Running utility commands/checks (linter etc.)
Always uses Java LTS latest and Clojure 1.11
parameters:
steps:
type: steps
executor: openjdk17
environment:
VERSION: "1.11"
steps:
- checkout
- with_cache:
cache_version: "1.11"
steps: << parameters.steps >>

deploy:
executor: openjdk8_deploy
steps:
- checkout
- restore_cache:
keys:
- v2-dependencies-{{ checksum "project.clj" }}
# fallback to using the latest cache if no exact match is found
- v2-dependencies-
- run: lein with-profile -user,+test deps
- save_cache:
paths:
- ~/.m2
key: v2-dependencies-{{ checksum "project.clj" }}
- run:
name: Deploy
command: |
lein with-profile -user,+deploy run -m deploy-release make deploy

test_code:
description: |
Run tests against given version of JDK and Clojure
parameters:
jdk_version:
description: Version of JDK to test against
type: string
clojure_version:
description: Version of Clojure to test against
type: string
executor: << parameters.jdk_version >>
environment:
VERSION: << parameters.clojure_version >>
steps:
- checkout
- with_cache:
cache_version: << parameters.clojure_version >>|<< parameters.jdk_version >>
steps:
- run:
name: Running tests
command: make test

######################################################################
#
# End general purpose configs
#
######################################################################


# The ci-test-matrix does the following:
#
# - run tests against the target matrix
# - All our defined JDKs
# - Clojure 1.8, 1.9, 1.10, 1.11, master
# - linter, eastwood and cljfmt
# - runs code coverage report

workflows:
version: 2.1
ci-test-matrix:
jobs:
- test_code:
matrix:
parameters:
clojure_version: ["1.8", "1.9", "1.10", "1.11", "master"]
jdk_version: [openjdk8, openjdk11, openjdk17]
filters:
branches:
only: /.*/
tags:
only: /^v\d+\.\d+\.\d+(-alpha\d+)?$/
- util_job:
name: Code Linting
filters:
branches:
only: /.*/
tags:
only: /^v\d+\.\d+\.\d+(-alpha\d+)?$/
steps:
- run:
name: Running cljfmt
command: |
make cljfmt
- run:
name: Running clj-kondo
command: |
make kondo
- run:
name: Running Eastwood
command: |
make eastwood
- deploy:
requires:
- test_code
- "Code Linting"
filters:
branches:
ignore: /.*/
tags:
only: /^v\d+\.\d+\.\d+(-alpha\d+)?$/
35 changes: 35 additions & 0 deletions .circleci/deploy/deploy_release.clj
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
(ns deploy-release
(:require
[clojure.java.shell :refer [sh]]
[clojure.string :as str]))

(def release-marker "v")

(defn make-version [tag]
(str/replace-first tag release-marker ""))

(defn log-result [m]
(println m)
m)

(defn -main [& _]
(let [tag (System/getenv "CIRCLE_TAG")]
(if-not tag
(do
(println "No CIRCLE_TAG found.")
(System/exit 1))
(if-not (re-find (re-pattern release-marker) tag)
(do
(println (format "The `%s` marker was not found in %s." release-marker tag))
(System/exit 1))
(do
(apply println "Executing" *command-line-args*)
(->> [:env (-> {}
(into (System/getenv))
(assoc "PROJECT_VERSION" (make-version tag))
(dissoc "CLASSPATH"))]
(into (vec *command-line-args*))
(apply sh)
log-result
:exit
(System/exit)))))))
10 changes: 10 additions & 0 deletions .clj-kondo/config.edn
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{:linters {:discouraged-var {clojure.core/read-string {:message "Please prefer clojure.edn/read-string"}}
;; Enable some disabled-by-default linters.
:docstring-leading-trailing-whitespace {:level :warning}
:keyword-binding {:level :warning}
:reduce-without-init {:level :warning}
:redundant-fn-wrapper {:level :warning}
:shadowed-var {:level :warning}
:single-key-in {:level :warning}
:unsorted-required-namespaces {:level :warning}
:used-underscored-binding {:level :warning}}}
7 changes: 7 additions & 0 deletions .dir-locals.el
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
;;; Directory Local Variables
;;; For more information see (info "(emacs) Directory Variables")

((clojure-mode
(clojure-indent-style . :always-align)
(indent-tabs-mode . nil)
(fill-column . 80)))
33 changes: 33 additions & 0 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Contributing

Do you have an issue to report or an idea to submit? That's great!
We're eager to make Logjam better. Please
report issues to the [issue tracker][1] of the repository or submit
a pull request.

To help us, please, follow these guidelines:

## Issue reporting

* Check that the issue has not already been reported.
* Check that the issue has not already been fixed in the latest code
(a.k.a. `master`).
* Be clear, concise and precise in your description of the problem.

## Pull requests

* Read [how to properly contribute to open source projects on Github][2].
* Use a topic branch to easily amend a pull request later, if necessary.
* Write [good commit messages][3].
* Mention related tickets in the commit messages (e.g. `[Fix #N] Add command ...`)
* Update the [changelog][6].
* Use the same coding conventions as the rest of the project.
* [Squash related commits together][5].
* Open a [pull request][4] that relates to *only* one subject with a clear title and description in grammatically correct, complete sentences.

[1]: https://github.com/clojure-emacs/logjam/issues
[2]: http://gun.io/blog/how-to-github-fork-branch-and-pull-request
[3]: http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html
[4]: https://help.github.com/articles/using-pull-requests
[5]: http://gitready.com/advanced/2009/02/10/squashing-commits-with-rebase.html
[6]: https://github.com/clojure-emacs/logjam/blob/master/CHANGELOG.md
36 changes: 36 additions & 0 deletions .github/ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
*Use the template below when reporting bugs. Please, make sure that
you're running the latest stable version and that the problem
you're reporting hasn't been reported (and potentially fixed) already.*

*When requesting new features or improvements to existing features you can
discard the template completely. Just make sure to make a good case for your
request.*

**Remove all of the placeholder text in your final report!**

## Expected behavior

## Actual behavior

## Steps to reproduce the problem

*This is extremely important! Providing us with a reliable way to reproduce
a problem will expedite its solution.*

## Environment & Version information

### Version information

### Logjam version

### CIDER version information

_Optional_

*Include here the version string displayed when
CIDER's REPL is launched. Here's an example:*

```
;; CIDER 0.12.0snapshot (package: 20160331.421), nREPL 0.2.12
;; Clojure 1.8.0, Java 1.8.0_31
```
10 changes: 10 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
Before submitting a PR make sure the following things have been done (and denote this
by checking the relevant checkboxes):

- [ ] The commits are consistent with our [contribution guidelines](CONTRIBUTING.md)
- [ ] You've added tests (if possible) to cover your change(s)
- [ ] All tests are passing (run `lein do clean, test`)
- [ ] You've updated the changelog (if adding/changing user-visible functionality)
- [ ] You've updated the readme (if adding/changing user-visible functionality)

Thanks!
28 changes: 28 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/target
/lib
/classes
/checkouts
pom.xml
pom.xml.asc
*.jar
*.class
.lein-deps-sum
.lein-failures
.lein-plugins
.lein-repl-history
.nrepl-port
*~
\#*\#
.\#*
install.cmd
/install.sh
/deploy.sh
/.cljs_nashorn_repl/
/.cljs_rhino_repl/
/nashorn_code_cache/
/.cljs_rhino_repl/
/.cljs_node_repl/
/out/
/.lein-env
.inline-deps
.clj-kondo/.cache/
Empty file added CHANGELOG.md
Empty file.
Loading