dev: clojure GitHub CI workflow #1
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
name: Clojure CLI | |
on: | |
push: | |
branches: [ "live" ] | |
pull_request: | |
branches: [ "live" ] | |
jobs: | |
workflow: | |
name: workflow-name | |
runs-on: ubuntu-latest | |
steps: | |
- run: echo "🚀 Job automatically triggered by ${{ github.event_name }}" | |
- run: echo "🐧 Job running on ${{ runner.os }} server" | |
- run: echo "🐙 Using ${{ github.ref }} branch from ${{ github.repository }} repository" | |
- name: Checkout Code | |
uses: actions/checkout@v3 | |
with: | |
token: "${{ secrets.PAT || secrets.GITHUB_TOKEN }}" | |
fetch-depth: 0 # fetch all history | |
- run: echo "🐙 ${{ github.repository }} repository was cloned to the runner." | |
- name: Prepare java | |
uses: actions/setup-java@v3 | |
with: | |
distribution: 'temurin' | |
java-version: '17' | |
- name: Install clojure tools | |
uses: DeLaGuardo/[email protected] | |
with: | |
cli: 1.11.1.1413 # Clojure CLI based on tools.deps | |
cljstyle: 0.15.0 # cljstyle | |
clj-kondo: 2022.10.05 # Clj-kondo | |
- name: Cache clojure dependencies | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/.m2/repository | |
~/.gitlibs | |
# List all files containing dependencies: | |
key: clojure-deps-${{ hashFiles('deps.edn') }} | |
restore-keys: clojure-deps- | |
- name: Run Unit tests | |
run: clojure -X:test/run :fail-fast? false | |
- name: "Lint with clj-kondo" | |
run: clj-kondo --lint deps.edn src resources test --config .clj-kondo/config-ci.edn | |
- name: "Check Clojure Style" | |
run: cljstyle check --report | |
- name: Package Clojure project | |
run: clojure -T:build/task uberjar | |
# Summary and status | |
- run: echo "🎨 Workflow name completed" | |
- run: echo "🍏 Job status is ${{ job.status }}." |