Skip to content

use bash shell

use bash shell #36

Workflow file for this run

name: CI
on:
workflow_dispatch:
pull_request:
paths:
- '**.java'
- '**.xml'
- '**.so'
- '**.jnilib'
- '**.dll'
- '.github/workflows/*.yml'
- 'VERSION'
- 'pom.xml'
push:
branches:
- '*'
paths:
- '**.java'
- '**.xml'
- '**.so'
- '**.jnilib'
- '**.dll'
- '.github/workflows/*.yml'
- 'VERSION'
- 'pom.xml'
jobs:
lint:
name: Check code formatting
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: 11
java-package: jdk
cache: 'maven'
- name: spotless:check
run: mvn --batch-mode --no-transfer-progress spotless:check
test:
name: test ${{ matrix.os }} jdk${{ matrix.java }}
strategy:
matrix:
os: [ ubuntu-latest ]
java: [ 11, 17, 19 ]
include:
- os: windows-latest
java: 19
- os: macos-latest
java: 19
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: ${{ matrix.java }}
java-package: jdk
cache: 'maven'
- name: Install tools for windows
if: matrix.os == 'windows-latest'
run: |
choco install wget --no-progress
- name: Source versions from VERSION file
run: cat VERSION >> $GITHUB_ENV
- name: Display version
run: echo $sqliteMCVersion $version $artifactVersion
- name: Build natives
run: make jni-header native
- name: Test
run: mvn --batch-mode --no-transfer-progress test
# test_graalvm:
# name: test ${{ matrix.os }} jdk${{ matrix.java }} GraalVM native-image
# strategy:
# matrix:
# os: [ ubuntu-latest, windows-latest, macos-latest ]
# java: [ 11, 17 ]
# runs-on: ${{ matrix.os }}
# steps:
# - uses: actions/checkout@v3
# - uses: graalvm/setup-graalvm@v1
# with:
# version: '22.3.0'
# java-version: ${{ matrix.java }}
# components: 'native-image'
# github-token: ${{ secrets.GITHUB_TOKEN }}
# - name: Test
# run: mvn --batch-mode --no-transfer-progress -P native test
test_multiarch:
name: test ${{ matrix.arch }} ${{ matrix.distro }} jdk${{ matrix.java }}
strategy:
matrix:
include:
# ARM v7
- arch: armv7
distro: ubuntu_latest
java: 11 # apt-get maven is 3.6.x, doesn't support Java 17
# ARM 64
- arch: aarch64
distro: ubuntu_latest
java: 11 # apt-get maven is 3.6.x, doesn't support Java 17
- arch: aarch64
distro: alpine_latest
java: 11
# PPC64
- arch: ppc64le
distro: ubuntu_latest
java: 11 # apt-get maven is 3.6.x, doesn't support Java 17
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: uraimo/run-on-arch-action@v2
name: Test
with:
arch: ${{ matrix.arch }}
distro: ${{ matrix.distro }}
# Not required, but speeds up builds
githubToken: ${{ github.token }}
# Install some dependencies in the container. This speeds up builds if
# you are also using githubToken. Any dependencies installed here will
# be part of the container image that gets cached, so subsequent
# builds don't have to re-install them. The image layer is cached
# publicly in your project's package repository, so it is vital that
# no secrets are present in the container state or logs.
install: |
case "${{ matrix.distro }}" in
ubuntu*|jessie|stretch|buster|bullseye)
apt-get update -q -y
apt-get install -q -y maven openjdk-${{ matrix.java }}-jdk openssl ca-certificates build-essential bash jq wget unzip curl gnupg
;;
alpine*)
apk update
apk add maven openjdk${{ matrix.java }} openssl ca-certificates build-base bash jq wget unzip curl gnupg
echo "INSTALL JAVA HOME: $(dirname $(dirname $(readlink -f $(which javac))))"
;;
esac
# We use the Github Action user, 1001:121, so that maven can access
# the /work directory and create target/classes
dockerRunArgs: |
--volume "${PWD}:/work"
--user 1001:121
env: |
SKIP_TEST_OSINFO: true
run: |
echo "Architecture: `uname -a`"
mvn --version
export JAVA_HOME=$(dirname $(dirname $(readlink -f $(which javac))))
cd /work && make jni-header native && mvn --batch-mode --no-transfer-progress test
# This will test the build process using an external amalgamation, as well as the
# Java tests with that native library, as some functions will not be available (extensions).
# Here we use the sqlite3 package installed by homebrew on Mac, which comes
# with the header file and library.
test_external_amalgamation:
name: test external amalgamation
runs-on: macos-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: 19
java-package: jdk
cache: 'maven'
- run: brew install sqlite3
- name: Find SQLite directory
run: |
BREW_SQLITE_PREFIX=`brew --prefix sqlite3`
echo "SQLITE_DIR=$(dirname ${BREW_SQLITE_PREFIX})/$(readlink ${BREW_SQLITE_PREFIX})" | tee -a $GITHUB_ENV
- name: Make native lib
run: |
make native SQLITE_OBJ=${{ env.SQLITE_DIR }}/lib/libsqlite3.dylib SQLITE_HEADER=${{ env.SQLITE_DIR }}/include/sqlite3.h
- name: Test
run: mvn --batch-mode --no-transfer-progress test
# release:
# name: Deploy
# needs: [ lint, test, test_graalvm, test_multiarch, test_external_amalgamation, test_graalvm ]
# if: github.repository_owner == 'xerial' && github.ref == 'refs/heads/master' # only perform on latest master
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v3
# if: ${{ github.event_name == 'push' }}
# # a workflow dispatch indicates a release, we need the full git history to generate the changelog
# - uses: actions/checkout@v3
# if: ${{ github.event_name == 'workflow_dispatch' }}
# with:
# fetch-depth: 0
# - name: Set up Apache Maven Central
# uses: actions/setup-java@v3
# with: # running setup-java again overwrites the settings.xml
# distribution: 'temurin'
# java-version: '8'
# java-package: jdk
# server-id: ossrh # Value of the distributionManagement/repository/id field of the pom.xml
# server-username: MAVEN_CENTRAL_USERNAME # env variable for username in deploy (1)
# server-password: MAVEN_CENTRAL_PASSWORD # env variable for token in deploy (2)
# gpg-private-key: ${{ secrets.GPG_KEY }} # Value of the GPG private key to import
# gpg-passphrase: MAVEN_CENTRAL_GPG_PASSPHRASE # env variable for GPG private key passphrase (3)
# - name: Get Project Version
# run: |
# echo "PROJECT_VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)" | tee -a $GITHUB_ENV
# - name: Cancel action for non SNAPSHOT push
# if: ${{ github.event_name == 'push' && !endsWith(env.PROJECT_VERSION, '-SNAPSHOT')}}
# uses: andymckay/[email protected]
# # from that point, push means we deploy snapshot, workflow_dispatch means we perform a release
# - name: Prepare release
# if: ${{ github.event_name == 'workflow_dispatch' }}
# run: |
# mvn --no-transfer-progress versions:set -DremoveSnapshot -DgenerateBackupPoms=false
# echo "RELEASE_VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)" | tee -a $GITHUB_ENV
# # The sonatype maven plugin will decide the right destination depending on whether the project is SNAPSHOT or not
# - name: Publish to Apache Maven Central
# run: mvn --batch-mode --no-transfer-progress deploy -P release -DskipTests
# env:
# MAVEN_CENTRAL_USERNAME: ${{ secrets.GLUON_NEXUS_USERNAME }} # must be the same env variable name as (1)
# MAVEN_CENTRAL_PASSWORD: ${{ secrets.GLUON_NEXUS_PASSWORD }} # must be the same env variable name as (2)
# MAVEN_CENTRAL_GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} # must be the same env variable name as (3)
# - name: Release commit and push
# if: ${{ github.event_name == 'workflow_dispatch' }}
# uses: EndBug/add-and-commit@v9
# with:
# message: 'chore(release): ${{ env.RELEASE_VERSION }} [skip ci]'
# tag: '${{ env.RELEASE_VERSION }} --force'
# default_author: github_actions
# - name: Create Github release with JReleaser
# if: ${{ github.event_name == 'workflow_dispatch' }}
# env:
# JRELEASER_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# run: |
# mvn --batch-mode --no-transfer-progress -DskipTests jreleaser:full-release
# - name: Prepare next snapshot
# if: ${{ github.event_name == 'workflow_dispatch' }}
# run: |
# mvn versions:set -DnextSnapshot -DgenerateBackupPoms=false
# - name: Next snapshot commit and push
# if: ${{ github.event_name == 'workflow_dispatch' }}
# uses: EndBug/add-and-commit@v9
# with:
# message: 'chore(release): prepare next snapshot [skip ci]'
# default_author: github_actions