Merge pull request #16 from pmonks/dev #116
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: CI | |
on: [push, pull_request] | |
jobs: | |
skip_check: | |
runs-on: ubuntu-latest | |
outputs: | |
should_skip: ${{ steps.skip_check.outputs.should_skip }} | |
steps: | |
- id: skip_check | |
uses: fkirc/skip-duplicate-actions@master | |
run_ci_matrix: | |
needs: skip_check | |
if: ${{ needs.skip_check.outputs.should_skip != 'true' }} | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
java-version: [ 8, 11, 17, 21 ] | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-java@v4 | |
with: | |
distribution: 'temurin' | |
java-version: ${{ matrix.java-version }} | |
- uses: DeLaGuardo/[email protected] | |
with: | |
cli: latest | |
- uses: actions/cache@v4 | |
with: | |
path: | | |
~/.m2/repository | |
~/.gitlibs | |
~/.clojure | |
~/.cpcache | |
key: ${{ runner.os }}-${{ hashFiles('**/deps.edn') }} | |
- name: Run CI checks | |
run: clojure -Srepro -J-Dclojure.main.report=stderr -T:build ci | |
# Adapted from https://brunoscheufler.com/blog/2022-04-09-the-required-github-status-check-that-wasnt | |
after_ci_matrix: | |
needs: run_ci_matrix | |
runs-on: ubuntu-latest | |
if: success() | |
outputs: | |
success: ${{ steps.setoutput.outputs.success }} | |
steps: | |
- id: setoutput | |
run: echo "::set-output name=success::true" | |
CI: | |
runs-on: ubuntu-latest | |
if: always() | |
needs: [skip_check, run_ci_matrix, after_ci_matrix] | |
steps: | |
- run: | | |
skipped="${{ needs.skip_check.outputs.should_skip }}" | |
passed="${{ needs.after_ci_matrix.outputs.success }}" | |
if [[ $skipped == "true" ]]; then | |
echo "CI matrix skipped" | |
exit 0 | |
elif [[ $passed == "true" ]]; then | |
echo "CI matrix passed" | |
exit 0 | |
else | |
echo "CI matrix failed" | |
exit 1 | |
fi |