GithubHelp home page GithubHelp logo

isabella232 / semaphore-demo-clojure-luminus Goto Github PK

View Code? Open in Web Editor NEW

This project forked from semaphoreci-demos/semaphore-demo-clojure-luminus

0.0 0.0 0.0 193 KB

A Semaphore demo CI/CD pipeline using Clojure and Luminus

Dockerfile 0.64% Clojure 71.23% HTML 21.25% CSS 6.88%

semaphore-demo-clojure-luminus's Introduction

guestbook

generated using Luminus version "3.10.40"

Prerequisites

You will need Leiningen 2.0 or above installed.

Running

lein deps
lein run

Tests

lein test

Semaphore integration

Semaphore config is stored in .semaphore/semaphore.yml. The file defines steps that will be run on every push to the repo. Currently, there are 3 jobs:

  1. Setup – installs dependencies and caches them.
  2. Tests – runs tests.
  3. Build – builds an uberjar and caches it for further deployment.

There's also one promotion defined in the config. Promotions are used to describe deployment steps and their configs are stored separately. In .semaphore/production-deploy.yml there's only one job, that restores cached uberjar and lists files in the current directory to demonstrate that the uberjar was successfully restored. This is just an example. Depending on your deployment procedures, commands described in this job would be different.

Caching on Semaphore

Semaphore provides the following commands to work with caching:

  1. cache store KEY PATH – stores the content of PATH at specified KEY.
  2. cache restore KEY – restores the content stored at KEY.

Since these commands use tar under the hood, cached data cannot be restored at absolute path. For example, caching /home/semaphore/.m2 will result in a tar archive having home/semaphore/.m2 path, with the leading / omitted. That's why after restoring caches with absolute paths, they must be moved to their (absolute) paths. For example, here's how dependencies installed via Leiningen are cached and restored:

$ cache store lein-deps-$(checksum project.clj) ~/.m2 # ~/.m2 wil be expanded to /home/semaphore/.m2
$ cache restore lein-deps-$(checksum project.clj) # will extract a tar archive to the current folder
$ mv home/semaphore/.m2 ~/.m2

Caching uberjar

Semaphore doesn't overwrite identical keys when caching. If you want to have a static key (like uberjar-latest), you will have to remove it every time before calling cache store:

$ cache delete uberjar-latest
$ cache store uberjar-latest target/uberjar/uberjar.jar

Continuous deployment

To make deployments automatically triggered when all jobs finish successfully, add this option to a promotion config:

auto_promote_on:
  - result: passed

semaphore-demo-clojure-luminus's People

Contributors

jeiwan avatar markoa avatar tomfern avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.