Skip to content

Commit

Permalink
Improved GH Actions config
Browse files Browse the repository at this point in the history
  • Loading branch information
camsaul committed Aug 12, 2024
1 parent ac7f07d commit 1866199
Show file tree
Hide file tree
Showing 3 changed files with 88 additions and 142 deletions.
34 changes: 34 additions & 0 deletions .github/actions/setup/workflow.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Setup Java & Clojure
inputs:
clojure-version:
required: true
default: "1.11.1.1413"
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-
22 changes: 3 additions & 19 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,26 +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
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: v1-${{ hashFiles('./deps.edn') }}-deploy
restore-keys: |
v1-${{ hashFiles('./deps.edn') }}-
v1-
cache-key: deploy
- name: Build Toucan 2
run: clojure -T:build build
env:
Expand Down
174 changes: 51 additions & 123 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,41 @@ jobs:
kondo:
runs-on: ubuntu-20.04
timeout-minutes: 10
env:
CLJ_KONDO_VERSION: "2023.09.07"
DOWNLOAD_URL: https://github.com/clj-kondo/clj-kondo/releases/download
steps:
- uses: actions/[email protected]
- uses: DeLaGuardo/clojure-lint-action@master
with:
check-name: Run clj-kondo
clj-kondo-args: >-
--lint
src
test
toucan1/src
toucan1/test
github_token: ${{ secrets.GITHUB_TOKEN }}
- name: Setup Java & Clojure
uses: ./.github/actions/setup
with:
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
curl -OL ${DOWNLOAD_URL}/v${CLJ_KONDO_VERSION}/clj-kondo-${CLJ_KONDO_VERSION}-linux-static-amd64.zip.sha256
cat clj-kondo-${CLJ_KONDO_VERSION}-linux-static-amd64.zip.sha256 >> SHA256sum.txt
echo " clj-kondo-${CLJ_KONDO_VERSION}-linux-static-amd64.zip" >> SHA256sum.txt
sha256sum -c SHA256sum.txt
unzip -d /usr/local/bin clj-kondo-${CLJ_KONDO_VERSION}-linux-static-amd64.zip
- run: clj-kondo --version
- name: Copy Kondo config from deps
run: >-
clj-kondo
--copy-configs
--dependencies
--lint "$(clojure -A:dev -Spath)"
--skip-lint
--parallel
- name: Run clj-kondo
run: >-
clj-kondo
--parallel
--lint
src
test
toucan1/src
toucan1/test
tests-postgres:
runs-on: ubuntu-20.04
Expand All @@ -34,25 +57,10 @@ jobs:
postgresql db: 'toucan2'
postgresql user: 'cam'
postgresql password: 'cam'
- name: Prepare JDK 17
uses: actions/setup-java@v3
with:
java-version: 17
distribution: 'temurin'
- name: Setup Clojure
uses: DeLaGuardo/[email protected]
- name: Setup Java & Clojure
uses: ./.github/actions/setup
with:
cli: 1.11.1.1413
- name: Restore cache
uses: actions/cache@v3
with:
path: |
~/.m2/repository
~/.gitlibs
key: v1-${{ hashFiles('./deps.edn') }}-postgres
restore-keys: |
v1-${{ hashFiles('./deps.edn') }}-
v1-
cache-key: tests-postgres
- run: clojure -X:dev:test:test-postgres
name: Run tests
env:
Expand All @@ -72,26 +80,10 @@ jobs:
MYSQL_ALLOW_EMPTY_PASSWORD: yes
steps:
- uses: actions/[email protected]
- name: Prepare JDK 17
uses: actions/setup-java@v3
with:
java-version: 17
distribution: 'temurin'
- name: Setup Clojure
uses: DeLaGuardo/[email protected]
- name: Setup Java & Clojure
uses: ./.github/actions/setup
with:
cli: 1.11.1.1413
- name: Restore cache
uses: actions/cache@v3
with:
path: |
~/.m2/repository
~/.gitlibs
~/.deps.clj
key: v1-${{ hashFiles('./deps.edn') }}-mariadb
restore-keys: |
v1-${{ hashFiles('./deps.edn') }}-
v1-
cache-key: tests-mariadb
- run: clojure -X:dev:test:test-mariadb
name: Run tests
env:
Expand All @@ -102,26 +94,10 @@ jobs:
timeout-minutes: 10
steps:
- uses: actions/[email protected]
- 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.1413
- name: Restore cache
uses: actions/cache@v3
- name: Setup Java & Clojure
uses: ./.github/actions/setup
with:
path: |
~/.m2/repository
~/.gitlibs
~/.deps.clj
key: v1-${{ hashFiles('./deps.edn') }}-h2
restore-keys: |
v1-${{ hashFiles('./deps.edn') }}-
v1-
cache-key: tests-h2
- run: clojure -X:dev:test:test-h2
name: Run tests
env:
Expand All @@ -131,53 +107,21 @@ jobs:
runs-on: ubuntu-20.04
steps:
- uses: actions/[email protected]
- name: Prepare JDK 17
uses: actions/setup-java@v3
- name: Setup Java & Clojure
uses: ./.github/actions/setup
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: v1-${{ hashFiles('./deps.edn') }}-whitespace-linter
restore-keys: |
v1-${{ hashFiles('./deps.edn') }}-
v1-
cache-key: whitespace-linter
- run: clojure -T:whitespace-linter
name: Run whitespace linter

check:
runs-on: ubuntu-20.04
steps:
- uses: actions/[email protected]
- name: Prepare JDK 17
uses: actions/setup-java@v3
with:
java-version: 17
distribution: 'temurin'
- name: Setup Clojure
uses: DeLaGuardo/[email protected]
- name: Setup Java & Clojure
uses: ./.github/actions/setup
with:
cli: 1.11.1.1413
- name: Restore cache
uses: actions/cache@v3
with:
path: |
~/.m2/repository
~/.gitlibs
~/.deps.clj
key: v1-${{ hashFiles('./deps.edn') }}-check
restore-keys: |
v1-${{ hashFiles('./deps.edn') }}-
v1-
cache-key: check
- run: clojure -M:check
name: Check Toucan 2 core namespaces
- run: clojure -M:check
Expand All @@ -188,26 +132,10 @@ jobs:
runs-on: ubuntu-20.04
steps:
- uses: actions/[email protected]
- 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.1413
- name: Restore cache
uses: actions/cache@v3
- name: Setup Java & Clojure
uses: ./.github/actions/setup
with:
path: |
~/.m2/repository
~/.gitlibs
~/.deps.clj
key: v1-${{ hashFiles('./deps.edn') }}-codecov
restore-keys: |
v1-${{ hashFiles('./deps.edn') }}-
v1-
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 1866199

Please sign in to comment.