Skip to content

Commit

Permalink
More GH Actions tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
camsaul committed Aug 12, 2024
1 parent 29588ad commit a332923
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 88 deletions.
34 changes: 34 additions & 0 deletions .github/actions/setup-clojure/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Setup Clojure
inputs:
clojure-version:
required: true
default: "1.11.4"
java-version:
required: true
default: "17"
cache-key:
required: true

runs:
using: composite
steps:
- name: Prepare JDK
uses: actions/setup-java@v3
with:
java-version: ${{ inputs.java-version }}
distribution: 'temurin'
- name: Setup Clojure
uses: DeLaGuardo/[email protected]
with:
cli: ${{ inputs.clojure-version }}
- name: Restore cache
uses: actions/cache@v3
with:
path: |
~/.m2/repository
~/.gitlibs
~/.deps.clj
key: v1-${{ hashFiles('./deps.edn') }}-${{ inputs.cache-key }}
restore-keys: |
v1-${{ hashFiles('./deps.edn') }}-
v1-
19 changes: 3 additions & 16 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,23 +13,10 @@ jobs:
- uses: actions/[email protected]
with:
fetch-depth: 0
- name: Prepare JDK 17
uses: actions/setup-java@v3
- name: Setup Java & Clojure
uses: ./.github/actions/setup-clojure
with:
java-version: 17
distribution: 'temurin'
- name: Setup Clojure
uses: DeLaGuardo/[email protected]
with:
cli: 1.11.1.1413
- name: Restore cache
uses: actions/cache@v3
with:
path: |
~/.m2/repository
~/.gitlibs
~/.deps.clj
key: deploy
cache-key: deploy
- name: Build JAR
run: clojure -T:build build
env:
Expand Down
87 changes: 15 additions & 72 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,10 @@ jobs:
DOWNLOAD_URL: https://github.com/clj-kondo/clj-kondo/releases/download
steps:
- uses: actions/checkout@v4
- name: Prepare JDK 17
uses: actions/setup-java@v3
- name: Setup Java & Clojure
uses: ./.github/actions/setup-clojure
with:
java-version: 17
distribution: 'temurin'
- name: Setup Clojure
uses: DeLaGuardo/[email protected]
with:
cli: 1.11.1.1155
cache-key: kondo
- name: Install clj-kondo
run: |
curl -OL ${DOWNLOAD_URL}/v${CLJ_KONDO_VERSION}/clj-kondo-${CLJ_KONDO_VERSION}-linux-static-amd64.zip
Expand Down Expand Up @@ -52,23 +47,10 @@ jobs:
timeout-minutes: 10
steps:
- uses: actions/checkout@v4
- name: Prepare JDK 17
uses: actions/setup-java@v3
with:
java-version: 17
distribution: 'temurin'
- name: Setup Clojure
uses: DeLaGuardo/[email protected]
with:
cli: 1.11.1.1155
- name: Restore cache
uses: actions/cache@v3
- name: Setup Java & Clojure
uses: ./.github/actions/setup-clojure
with:
path: |
~/.m2/repository
~/.gitlibs
~/.deps.clj
key: tests-postgres
cache-key: tests
- run: clojure -X:dev:test
name: Run tests
env:
Expand All @@ -78,71 +60,32 @@ jobs:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v4
- name: Prepare JDK 17
uses: actions/setup-java@v3
with:
java-version: 17
distribution: 'temurin'
- name: Setup Clojure
uses: DeLaGuardo/[email protected]
with:
cli: 1.11.1.1155
- name: Restore cache
uses: actions/cache@v3
- name: Setup Java & Clojure
uses: ./.github/actions/setup-clojure
with:
path: |
~/.m2/repository
~/.gitlibs
~/.deps.clj
key: whitespace-linter
cache-key: whitespace-linter
- run: clojure -T:whitespace-linter
name: Run whitespace linter

check:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v4
- name: Prepare JDK 17
uses: actions/setup-java@v3
- name: Setup Java & Clojure
uses: ./.github/actions/setup-clojure
with:
java-version: 17
distribution: 'temurin'
- name: Setup Clojure
uses: DeLaGuardo/[email protected]
with:
cli: 1.11.1.1155
- name: Restore cache
uses: actions/cache@v3
with:
path: |
~/.m2/repository
~/.gitlibs
~/.deps.clj
key: check
cache-key: check
- run: clojure -M:check
name: Check namespaces

codecov:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v4
- name: Prepare JDK 17
uses: actions/setup-java@v3
with:
java-version: 17
distribution: 'temurin'
- name: Setup Clojure
uses: DeLaGuardo/[email protected]
with:
cli: 1.11.1.1155
- name: Restore cache
uses: actions/cache@v3
- name: Setup Java & Clojure
uses: ./.github/actions/setup-clojure
with:
path: |
~/.m2/repository
~/.gitlibs
~/.deps.clj
key: codecov
cache-key: codecov
- run: clojure -X:dev:test-h2:cloverage
name: Run tests with Cloverage
- name: Upload results to codecov.io
Expand Down

0 comments on commit a332923

Please sign in to comment.