243 lines
6.9 KiB
YAML
243 lines
6.9 KiB
YAML
name: build
|
|
|
|
on:
|
|
push:
|
|
paths-ignore:
|
|
- "**.md"
|
|
- "logo/**"
|
|
branches:
|
|
- master
|
|
pull_request:
|
|
paths-ignore:
|
|
- "**.md"
|
|
- "logo/**"
|
|
branches:
|
|
- master
|
|
|
|
# TODO: Add deploy if needed
|
|
jobs:
|
|
jvm:
|
|
if: ${{ false }} # Disabled
|
|
# if: "!contains(github.event.head_commit.message, 'skip ci')"
|
|
runs-on: ubuntu-latest
|
|
env:
|
|
LEIN_ROOT: "true"
|
|
BABASHKA_PLATFORM: linux # could be used in jar name
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
steps:
|
|
- name: Git checkout
|
|
uses: actions/checkout@v2
|
|
with:
|
|
fetch-depth: 1
|
|
submodules: 'true'
|
|
|
|
- name: Cache deps
|
|
uses: actions/cache@v2
|
|
id: cache-deps
|
|
with:
|
|
path: ~/.m2/repository
|
|
key: ${{ runner.os }}-maven-${{ hashFiles('project.clj') }}
|
|
restore-keys: ${{ runner.os }}-maven-
|
|
|
|
- name: Prepare java
|
|
uses: actions/setup-java@v2
|
|
with:
|
|
distribution: 'adopt-hotspot'
|
|
java-version: '11'
|
|
|
|
- name: Install clojure tools
|
|
uses: DeLaGuardo/setup-clojure@5.0
|
|
with:
|
|
cli: 1.10.3.1040
|
|
lein: 2.9.8
|
|
|
|
- name: Run tests
|
|
env:
|
|
BABASHKA_FEATURE_JDBC: "true"
|
|
BABASHKA_FEATURE_POSTGRESQL: "true"
|
|
run: |
|
|
script/test
|
|
script/run_lib_tests
|
|
|
|
- name: Run as lein command
|
|
run: echo '{:a 1}' | lein bb '(:a *in*)'
|
|
|
|
- name: Build uberjar
|
|
run: |
|
|
mkdir -p /tmp/release
|
|
script/uberjar
|
|
VERSION=$(cat resources/BABASHKA_VERSION)
|
|
jar=target/babashka-$VERSION-standalone.jar
|
|
cp $jar /tmp/release
|
|
java -jar $jar script/reflection.clj
|
|
reflection="babashka-$VERSION-reflection.json"
|
|
java -jar "$jar" --config .build/bb.edn --deps-root . release-artifact "$jar"
|
|
java -jar "$jar" --config .build/bb.edn --deps-root . release-artifact "$reflection"
|
|
|
|
- name: Babashka version
|
|
id: babashka-version
|
|
run: |
|
|
BABASHKA_VERSION=$(cat resources/BABASHKA_VERSION)
|
|
echo "##[set-output name=version;]${BABASHKA_VERSION}"
|
|
|
|
- uses: actions/upload-artifact@v1
|
|
with:
|
|
name: babashka-${{ steps.babashka-version.outputs.version }}-standalone.jar
|
|
path: target/babashka-${{ steps.babashka-version.outputs.version }}-standalone.jar
|
|
|
|
native:
|
|
if: "!contains(github.event.head_commit.message, 'skip ci')"
|
|
strategy:
|
|
matrix:
|
|
include:
|
|
- os: macos-12
|
|
name: macos
|
|
static: false
|
|
#- os: ubuntu-latest
|
|
# name: linux
|
|
# static: false
|
|
#- os: ubuntu-latest
|
|
# name: linux
|
|
# static: true
|
|
runs-on: ${{ matrix.os }}
|
|
env:
|
|
LEIN_ROOT: "true"
|
|
GRAALVM_VERSION: "22.3.0"
|
|
BABASHKA_PLATFORM: ${{ matrix.name }} # used in release script
|
|
BABASHKA_TEST_ENV: native
|
|
BABASHKA_XMX: "-J-Xmx6500m"
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
steps:
|
|
- name: Git checkout
|
|
uses: actions/checkout@v2
|
|
with:
|
|
fetch-depth: 1
|
|
submodules: 'true'
|
|
|
|
- name: Cache deps
|
|
uses: actions/cache@v2
|
|
id: cache-deps
|
|
with:
|
|
path: ~/.m2/repository
|
|
key: ${{ runner.os }}-maven-${{ hashFiles('project.clj') }}
|
|
restore-keys: ${{ runner.os }}-maven-
|
|
|
|
- name: Setup GraalVM
|
|
if: "matrix.static == false"
|
|
uses: graalvm/setup-graalvm@v1
|
|
with:
|
|
version: '22.3.0'
|
|
java-version: '11'
|
|
components: 'native-image'
|
|
github-token: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Setup GraalVM+musl
|
|
if: "matrix.static == true"
|
|
uses: graalvm/setup-graalvm@v1
|
|
with:
|
|
version: '22.3.0'
|
|
java-version: '11'
|
|
components: 'native-image'
|
|
native-image-musl: true
|
|
github-token: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Install clojure tools
|
|
uses: DeLaGuardo/setup-clojure@5.0
|
|
with:
|
|
cli: 1.10.3.1040
|
|
lein: 2.9.8
|
|
|
|
- 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: Babashka version
|
|
id: babashka-version
|
|
run: |
|
|
BABASHKA_VERSION=$(cat resources/BABASHKA_VERSION)
|
|
echo "##[set-output name=version;]${BABASHKA_VERSION}"
|
|
|
|
- name: Build uberjar
|
|
run: script/uberjar
|
|
|
|
- name: Build native image
|
|
if: "matrix.static == false"
|
|
run: script/compile
|
|
|
|
- name: Build static native image
|
|
if: "matrix.static == true"
|
|
env:
|
|
BABASHKA_STATIC: "true"
|
|
BABASHKA_MUSL: "true"
|
|
run: script/compile
|
|
|
|
- name: Test binary and libs
|
|
run: |
|
|
script/test
|
|
script/run_lib_tests
|
|
|
|
- name: Release
|
|
run: .circleci/script/release
|
|
|
|
- name: Upload artifact
|
|
uses: actions/upload-artifact@v2
|
|
with:
|
|
path: bb
|
|
name: babashka-${{ steps.babashka-version.outputs.version }}-${{ matrix.name }}-amd64
|
|
|
|
- name: Upload static artifact
|
|
if: "matrix.static == true"
|
|
uses: actions/upload-artifact@v2
|
|
with:
|
|
path: bb
|
|
name: babashka-${{ steps.babashka-version.outputs.version }}-${{ matrix.name }}-static-amd64
|
|
|
|
docker:
|
|
if: ${{ false }} # Disabled
|
|
# if: "!contains(github.event.head_commit.message, 'skip ci') && github.event_name == 'push' && github.ref == 'refs/heads/master'"
|
|
needs:
|
|
- native
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Git checkout
|
|
uses: actions/checkout@v2
|
|
with:
|
|
fetch-depth: 1
|
|
submodules: 'true'
|
|
|
|
- name: Babashka version
|
|
id: babashka-version
|
|
run: |
|
|
BABASHKA_VERSION=$(cat resources/BABASHKA_VERSION)
|
|
echo "##[set-output name=version;]${BABASHKA_VERSION}"
|
|
|
|
- name: Make release dir
|
|
run: mkdir -p /tmp/release
|
|
|
|
- name: Download linux binary
|
|
uses: actions/download-artifact@v2
|
|
with:
|
|
name: babashka-${{ steps.babashka-version.outputs.version }}-linux-amd64.zip
|
|
path: /tmp/release
|
|
|
|
- name: Download static linux binary
|
|
uses: actions/download-artifact@v2
|
|
with:
|
|
name: babashka-${{ steps.babashka-version.outputs.version }}-linux-static-amd64.zip
|
|
path: /tmp/release-static
|
|
|
|
- name: Set up Docker Buildx
|
|
id: buildx
|
|
uses: docker/setup-buildx-action@v2
|
|
|
|
- name: Build uberjar
|
|
run: script/uberjar
|
|
|
|
- name: Docker build
|
|
env:
|
|
DOCKERHUB_USER: "${{ secrets.DOCKERHUB_USER }}"
|
|
DOCKERHUB_PASS: "${{ secrets.DOCKERHUB_PASS }}"
|
|
PLATFORMS: linux/amd64,linux/arm64
|
|
run: java -jar ./target/babashka-$(cat resources/BABASHKA_VERSION)-standalone.jar .circleci/script/docker.clj
|