Skip to content
Open

gha #35

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
36 changes: 36 additions & 0 deletions .github/actions/setup-leiningen/action.yml

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All actions should be pinned to a specific commit using ratchet. This is something infosec has requested for all GHA.

Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: 'Setup Leiningen'
description: 'Install system dependencies, JDK, and Leiningen for Clojure projects'
inputs:
java-version:
description: 'Java version to set up'
required: false
default: '17'
install-deps:
description: 'Whether to install Leiningen dependencies (lein deps and lein pom)'
required: false
default: 'false'
Comment on lines +8 to +11

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This appears to be unused.

runs:
using: 'composite'
steps:
- name: Install system dependencies
shell: bash
run: |
sudo apt-get update
sudo apt-get install -y gzip
Comment on lines +15 to +19

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this is needed


- name: Set up JDK
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: ${{ inputs.java-version }}

- name: Install Leiningen
uses: DeLaGuardo/setup-clojure@13.0
with:
lein: 'latest'

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Versions must all be pinned.


- name: Install Leiningen dependencies
if: inputs.install-deps == 'true'
shell: bash
run: |
lein pom
66 changes: 66 additions & 0 deletions .github/workflows/ci.yml

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Again, action versions should be pinned with ratchet.

Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
name: CI

on:
push:
branches:
- '**'
tags:
- '**'
pull_request:
branches:
- '**'

jobs:
build:
name: "Build & Test"
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup Leiningen
uses: ./.github/actions/setup-leiningen

- name: Run tests
run: lein test

test:
name: "Test (develop branch)"
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/develop'

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup Leiningen
uses: ./.github/actions/setup-leiningen
with:
install-deps: 'true'

- name: Run tests
run: lein test

publish:
name: "Publish to Clojars"
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/')

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup Leiningen
uses: ./.github/actions/setup-leiningen
with:
install-deps: 'true'

- name: Run tests
run: lein test

- name: Deploy to Clojars
env:
CLOJARS_USERNAME: ${{ vars.CLOJARS_USERNAME }}
CLOJARS_PASSWORD: ${{ secrets.CLOJARS_PASSWORD }}
run: lein deploy