ci: Explicitly install leiningen on ubuntu-latest #56
Workflow file for this run
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: build | |
on: [push, pull_request] | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
java: ['8', '11', '17'] | |
clojure: ['1.8', '1.9', '1.10', '1.11'] | |
name: Test with Java ${{ matrix.java }} and Clojure ${{ matrix.clojure }} | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/cache@v3 | |
with: | |
path: ~/.m2/repository | |
key: ${{ runner.os }}-lein-${{ hashFiles('**/project.clj') }} | |
restore-keys: | | |
${{ runner.os }}-lein- | |
- name: Setup Java | |
uses: actions/setup-java@v3 | |
with: | |
distribution: 'adopt' | |
java-version: ${{ matrix.java }} | |
- name: Setup Clojure | |
uses: DeLaGuardo/[email protected] | |
with: | |
lein: latest | |
- name: Install dependencies | |
run: lein deps | |
- name: Run tests | |
run: lein with-profile +${{ matrix.clojure }} test | |
- name: Run cljs tests | |
run: lein with-profile +${{ matrix.clojure }} doo node test once | |
coverage: | |
needs: [test] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/cache@v3 | |
with: | |
path: ~/.m2/repository | |
key: ${{ runner.os }}-lein-${{ hashFiles('**/project.clj') }} | |
restore-keys: | | |
${{ runner.os }}-lein- | |
- name: Setup Java | |
uses: actions/setup-java@v3 | |
with: | |
distribution: 'adopt' | |
java-version: '17' | |
- name: Setup Clojure | |
uses: DeLaGuardo/[email protected] | |
with: | |
lein: latest | |
- name: Install dependencies | |
run: lein deps | |
- name: Generate code coverage | |
run: lein cloverage --codecov | |
- uses: codecov/codecov-action@v3 | |
with: | |
files: ./target/coverage/codecov.json | |
get-version: | |
runs-on: ubuntu-latest | |
outputs: | |
version: ${{ steps.get-version.outputs.version }} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Get version | |
id: get-version | |
run: | | |
echo "version=$(head -n 1 project.clj | sed -e 's/^(defproject.*\"\(.*\)\"$/\1/')" \ | |
>> "$GITHUB_OUTPUT" | |
deploy: | |
if: ${{ github.event_name == 'push' && | |
github.ref == 'refs/heads/master' && | |
endsWith(needs.get-version.outputs.version, '-SNAPSHOT') }} | |
needs: [test, get-version] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Setup Java | |
uses: actions/setup-java@v3 | |
with: | |
distribution: 'adopt' | |
java-version: '17' | |
- name: Setup Clojure | |
uses: DeLaGuardo/[email protected] | |
with: | |
lein: latest | |
- name: Deploy | |
env: | |
CLOJARS_USERNAME: ${{ secrets.CLOJARS_USERNAME }} | |
CLOJARS_PASSWORD: ${{ secrets.CLOJARS_PASSWORD }} | |
run: lein deploy snapshots |