ci: improve clojure deps download & caching #99
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: Test | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
jobs: | |
build: | |
runs-on: ${{ matrix.os }}-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ ubuntu, windows ] | |
java-version: [ '11', '17', '21' ] | |
name: ${{matrix.os}} jdk${{matrix.java-version}} | |
steps: | |
# | |
# Tell git not to convert newlines on checkout for Windows | |
# | |
- name: Prepare git (Windows) | |
run: git config --global core.autocrlf false | |
if: matrix.os == 'windows' | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Clojure deps cache | |
uses: actions/cache@v4 | |
with: | |
path: | | |
~/.m2/repository | |
~/.deps.clj | |
~/.gitlibs | |
key: $${ runner.os }}-cljdeps-${{ hashFiles('deps.edn','bb.edn') }} | |
restore-keys: $${ runner.os }}-cljdeps- | |
- name: Setup Java | |
uses: actions/setup-java@v4 | |
with: | |
distribution: 'temurin' | |
java-version: ${{ matrix.java-version }} | |
# | |
# Install Babashka | |
# | |
- name: Install Babashka | |
uses: DeLaGuardo/[email protected] | |
with: | |
bb: 'latest' | |
# | |
# Install Clojure | |
# | |
- name: Install clojure (windows) | |
if: matrix.os == 'windows' | |
# On windows, deps.clj's deps.exe is used in place of clojure to avoid complexities of official clojure install | |
run: | | |
PowerShell -Command "iwr -useb https://raw.githubusercontent.com/borkdude/deps.clj/master/install.ps1 | iex" | |
Rename-Item $HOME\deps.clj\deps.exe clojure.exe | |
echo "$HOME\deps.clj" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append | |
- name: Install Clojure | |
if: matrix.os == 'ubuntu' | |
uses: DeLaGuardo/[email protected] | |
with: | |
cli: 'latest' | |
- name: Bring down ClojureTools early | |
run: clojure -Sdescribe | |
- name: Tools Versions | |
run: | | |
echo "bb --version" | |
bb --version | |
echo "node --version" | |
node --version | |
echo "java -version" | |
java -version | |
echo "clojure -Sdescribe" | |
clojure -Sdescribe | |
- name: Download Clojure Dependencies | |
run: bb download-deps | |
- name: Run CI Tests | |
run: bb ci-test |