Initial commit #2
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: | |
branches: | |
- main | |
- develop | |
paths: | |
- '.github/workflows/**' | |
- 'src/**' | |
- '.cljstyle' | |
- 'bb.edn' | |
- 'build.clj' | |
- 'deps.edn' | |
- 'tests.edn' | |
- 'version' | |
pull_request: | |
branches: | |
- main | |
- develop | |
paths: | |
- '.github/workflows/**' | |
- 'src/**' | |
- '.cljstyle' | |
- 'bb.edn' | |
- 'build.clj' | |
- 'deps.edn' | |
- 'tests.edn' | |
- 'version' | |
jobs: | |
build: | |
if: "!contains(github.event.head_commit.message, 'skip ci')" | |
strategy: | |
matrix: | |
include: | |
- os: ubuntu-latest | |
name: linux | |
static: false | |
- os: ubuntu-latest | |
name: linux | |
static: true | |
- os: macos-latest | |
name: macos | |
static: false | |
runs-on: ${{ matrix.os }} | |
steps: | |
# Git | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
# Variables | |
- name: Setup variables | |
id: xdeps | |
run: | | |
XDEPS_VERSION=$(cat version) | |
echo "version=${XDEPS_VERSION}" >> $GITHUB_OUTPUT | |
# Tools | |
- name: Setup GraalVM | |
if: "matrix.static == false" | |
uses: graalvm/setup-graalvm@v1 | |
with: | |
version: 'latest' | |
java-version: '17' | |
components: 'native-image' | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Setup GraalVM | |
if: "matrix.static == true" | |
uses: graalvm/setup-graalvm@v1 | |
with: | |
version: 'latest' | |
java-version: '17' | |
components: 'native-image' | |
native-image-musl: true | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Install native dev tools | |
if: matrix.os == 'ubuntu-latest' | |
run: | | |
sudo apt-get update | |
sudo apt-get -y install build-essential zlib1g-dev | |
- name: Install musl | |
if: "matrix.os == 'ubuntu-latest' && matrix.static == true" | |
run: | | |
sudo apt-get -y install musl | |
- name: Setup clojure tools | |
uses: DeLaGuardo/[email protected] | |
with: | |
bb: latest | |
cli: latest | |
clj-kondo: latest | |
cljstyle: latest | |
- name: Cache deps | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/.m2/repository | |
~/.gitlibs | |
~/.clojure | |
~/.cpcache | |
key: ${{ matrix.os}}-deps-${{ hashFiles('deps.edn') }} | |
restore-keys: ${{ matrix.name }}-deps- | |
# Linters & tests | |
- name: Run linters | |
run: bb lint | |
- name: Run tests | |
run: bb test | |
- name: Upload coverage | |
uses: actions/upload-artifact@v4 | |
with: | |
path: coverage | |
name: coverage-${{ steps.xdeps.outputs.version }}-${{ matrix.name }}${{ matrix.static == true && '-static' }} | |
# - name: Publish coverage | |
# uses: codecov/codecov-action@v3 | |
# with: | |
# token: ${{ secrets.CODECOV_TOKEN }} | |
# files: ./coverage/codecov.json | |
# flags: unit,integration | |
# os: ${{ matrix.name }} | |
# fail_ci_if_error: false | |
# verbose: true | |
# | |
# Uberjar | |
- name: Build uberjar | |
run: bb build uberjar | |
- name: Upload uberjar | |
uses: actions/upload-artifact@v4 | |
with: | |
path: target/xdeps.jar | |
name: xdeps-${{ steps.xdeps.outputs.version }}.jar | |
# Native image | |
- name: Build native image | |
if: "matrix.static == false" | |
run: bb build native-image | |
- name: Check artifact | |
if: "matrix.static == false" | |
run: ./target/xdeps | |
- name: Upload artifact | |
if: "matrix.static == false" | |
uses: actions/upload-artifact@v4 | |
with: | |
path: target/xdeps | |
name: xdeps-${{ steps.xdeps.outputs.version }}-${{ matrix.name }}-amd64 | |
# Native image (static) | |
- name: Build static native image | |
if: "matrix.static == true" | |
run: bb build native-image static | |
- name: Check static artifact | |
if: "matrix.static == true" | |
run: ./target/xdeps | |
- name: Upload static artifact | |
if: "matrix.static == true" | |
uses: actions/upload-artifact@v4 | |
with: | |
path: target/xdeps | |
name: xdeps-${{ steps.xdeps.outputs.version }}-${{ matrix.name }}-static-amd64 |