Skip to content

Commit

Permalink
Merge pull request #50 from Willena/migrate_github_action
Browse files Browse the repository at this point in the history
* Tried updating github actions file
* Add CI tests for aarch64 and armv7 (xerial#658)
* multiarch test
* cleanup before PR
* revert file
* fix action version
* update CI badge on README.md (xerial#661)
* Switch to Temurin JDK builds as AdoptJDK has been discontinued (xerial#660)
* Update Eclipse settings to use Java 8 (xerial#664)
* Fix file descriptor (handle) leak when opening database fails (xerial#665)
xerial#431
* Add native libs for Android arm64, x86, x86_64 via dockcross (xerial#662)
* cleanup OSInfo.java with IDE suggestions
* add native build for android aarch64, x86 and x86_64
* add android native builds
* change native lib resolution for Android
* refactor for tests in OSInfo.java
* add missing test scope for mockito dep
* add new targets to native-all
* Use more specific types instead of String when fetching JDBC3ResultSet.getBigDecimal (xerial#666)
* detect musl by checking /proc/self/map_files (xerial#675)
* detect musl by checking /proc/self/map_files
* spotless:apply
* Update src/main/java/org/sqlite/util/OSInfo.java
Co-authored-by: Roman Parshikov <[email protected]>
* spotless:apply
Co-authored-by: Roman Parshikov <[email protected]>
* let's start by testsing ;)
* Let's try building natives
* Add missing packages
* Another try
* Maximise build space :)
* in fact might not be needed. Just removing dirs !
* Removed freebsd32 freebsd64 freebsd-arm64 temporarily
* Add missing Linux-aarch64 def
* Updated compile option for Android x86 and Android x64
* Added Package target and build binary zip !
* Now download specific SQLite3MC versions
* Updated existing "quick" tests
* Revert removing dependency in pom.xml
* Fixing build with theses changes ?
* Revert version upgrades in pom.xml
* Fixed CI errors (windows build)
* Small fix for strip
* Moved to curl as it works best
* Removed outdated version of OSInfo.class; Updated Makefile.common to rebuild it if missing.
* Applied spotless fixes
* Upgrade SQLite3MC to 1.3.4 - 3.36.0
* Configured credentials for auto-deploy

Co-authored-by: Gauthier <[email protected]>
Co-authored-by: Carl Dea <[email protected]>
Co-authored-by: Taro L. Saito <[email protected]>
Co-authored-by: Andy-2639 <[email protected]>
Co-authored-by: Andrey.Tarashevskiy <[email protected]>
Co-authored-by: Roman Parshikov <[email protected]>
  • Loading branch information
7 people authored Jan 15, 2022
2 parents f27db64 + bf07632 commit 93a7057
Show file tree
Hide file tree
Showing 32 changed files with 2,559 additions and 1,316 deletions.
71 changes: 71 additions & 0 deletions .github/workflows/build-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
name: build
on:
workflow_dispatch:
push:
tags:
- '*.*.*'

jobs:
build_natives:
permissions:
contents: write
name: Build natives libraries
runs-on: ubuntu-20.04
steps:
- name: Make space
run: sudo rm -rf /usr/share/dotnet /usr/local/lib/android /opt/ghc

- uses: actions/checkout@v2
- uses: actions/setup-java@v2
with:
distribution: 'adopt'
java-version: 11
java-package: jdk
cache: 'maven'
- name: Source versions from VERSION file
run: cat VERSION >> $GITHUB_ENV

- name: Display version
run: echo $sqliteMCVersion $version $artifactVersion

- name: Build binaries, test, and package
run: make all
- name: Package DLL binaries
run: zip -r ./sqlite-natives-$artifactVersion.zip ./src/main/resources/org/sqlite/native
- uses: actions/upload-artifact@v2
with:
name: SQLiteMC DLL Binaries
path: |
./sqlite-natives-${{ env.artifactVersion }}.zip
./target/*.jar
- name: Prepare GPG sign
if: startsWith(github.ref, 'refs/tags/')
run: |
openssl aes-256-cbc -K ${{ secrets.ENCRYPTED_KEY }} -iv ${{ secrets.ENCRYPTED_IV }} -in ./scripts/private.key.enc -out /tmp/private.key -d
gpg --version
gpg --batch --import /tmp/private.key
rm /tmp/private.key
- name: Deploy version
env:
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
if: startsWith(github.ref, 'refs/tags/')
run: make deploy
- name: Deploy Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
name: "SQLite-jdbc-${{ env.artifactVersion }}"
generate_release_notes: true
files: |
./sqlite-natives-${{ env.artifactVersion }}.zip
./target/sqlite-jdbc-${{ env.artifactVersion }}.jar"
./target/sqlite-jdbc-${{ env.artifactVersion }}-javadoc.jar"
./target/sqlite-jdbc-${{ env.artifactVersion }}-sources.jar"
./target/sqlite-jdbc-${{ env.artifactVersion }}.jar.asc"
./target/sqlite-jdbc-${{ env.artifactVersion }}-javadoc.jar.asc"
./target/sqlite-jdbc-${{ env.artifactVersion }}-sources.jar.asc"
./sqlite-natives-${{env.artifactVersion }}.zip"
75 changes: 72 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ jobs:
name: test ${{ matrix.os }} jdk${{ matrix.java }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
java: [8, 11, 16]
os: [ ubuntu-latest, windows-latest, macos-latest ]
java: [ 8, 11, 16 ]
exclude:
- os: windows-latest
java: 11
Expand All @@ -55,10 +55,25 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-java@v2
with:
distribution: 'adopt'
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 test

Expand All @@ -78,5 +93,59 @@ jobs:
- name: Install native-image component
run: |
gu install native-image
- 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 -Pnative test

test_multiarch:
name: test ${{ matrix.arch }} ${{ matrix.distro }} jdk${{ matrix.java }}
strategy:
matrix:
# armv6 cannot install the JDK properly via apt-get on Debian
arch: [ armv7, aarch64 ]
# no point adding Alpine, as we only have x86_64 binaries for it
distro: [ ubuntu20.04 ]
# cannot add Java 16, maven installed by apt-get is 3.6.x and does not support Java 16
# use only java 11, so we don't run too many CI jobs
java: [ 11 ]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: uraimo/[email protected]
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: |
apt-get update -y
apt-get install -y openssl ca-certificates maven openjdk-${{ matrix.java }}-jdk build-essential curl bash jq wget unzip curl gnupg
# 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
run: |
echo "Architecture: `uname -a`"
mvn --version
cd /work && make jni-header native && mvn test
6 changes: 3 additions & 3 deletions .settings/org.eclipse.jdt.core.prefs
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
#Thu Apr 28 10:35:24 JST 2011
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.5
org.eclipse.jdt.core.compiler.compliance=1.8
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
org.eclipse.jdt.core.compiler.source=1.5
org.eclipse.jdt.core.compiler.source=1.8
39 changes: 23 additions & 16 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ RESOURCE_DIR = src/main/resources

.phony: all package native native-all deploy

all: setversion jni-header package
all: jni-header package

deploy: setversion
deploy:
mvn package deploy -DperformRelease=true --settings settings.xml

MVN:=mvn
Expand All @@ -28,7 +28,9 @@ CCFLAGS:= -I$(SQLITE_OUT) -I$(SQLITE_INCLUDE) $(CCFLAGS)

$(SQLITE_ARCHIVE):
echo "Downloading Archive"
curl -s https://api.github.com/repos/utelle/SQLite3MultipleCiphers/releases | jq -r ".[].assets[] | select(.name | contains(\"$(version)-amalgamation\")) | .created_at |= fromdateiso8601 | .browser_download_url" | head -1 | wget -O $@ -i -
#curl -s https://api.github.com/repos/utelle/SQLite3MultipleCiphers/releases | jq -r ".[].assets[] | select(.name | contains(\"$(version)-amalgamation\")) | .created_at |= fromdateiso8601 | .browser_download_url" | head -1 | wget -O $@ -i -
#wget -O $@ https://github.com/utelle/SQLite3MultipleCiphers/releases/download/v$(sqliteMCVersion)/sqlite3mc-$(sqliteMCVersion)-sqlite-$(version)-amalgamation.zip
curl -SL "https://github.com/utelle/SQLite3MultipleCiphers/releases/download/v$(sqliteMCVersion)/sqlite3mc-$(sqliteMCVersion)-sqlite-$(version)-amalgamation.zip" > $@
#if [ ! -d "$(TARGET)/$(version)" ] ; then git clone https://github.com/utelle/SQLite3MultipleCiphers.git $(TARGET)/$(version); cd $(TARGET)/$(version); fi
@mkdir -p $(@D)

Expand All @@ -49,11 +51,8 @@ $(TARGET)/common-lib/NativeDB.h: src/main/java/org/sqlite/core/NativeDB.java
$(JAVAC) -d $(TARGET)/common-lib -sourcepath $(SRC) -h $(TARGET)/common-lib src/main/java/org/sqlite/core/NativeDB.java
mv target/common-lib/org_sqlite_core_NativeDB.h target/common-lib/NativeDB.h

setversion:
$(MVN) versions:set -DnewVersion=$(artifactVersion)

test: setversion
$(MVN) test
test:
mvn test

clean: clean-target clean-native clean-java clean-tests

Expand Down Expand Up @@ -125,18 +124,17 @@ $(SQLITE_OUT)/$(LIBNAME): $(SQLITE_HEADER) $(SQLITE_OBJ) $(SRC)/org/sqlite/core/
$(CC) $(CCFLAGS) -I $(TARGET)/common-lib -c -o $(SQLITE_OUT)/NativeDB.o $(SRC)/org/sqlite/core/NativeDB.c
$(CC) $(CCFLAGS) -o $@ $(SQLITE_OUT)/NativeDB.o $(SQLITE_OBJ) $(LINKFLAGS)
# Workaround for strip Protocol error when using VirtualBox on Mac
cp $@ /tmp/$(@F)
$(STRIP) /tmp/$(@F)
cp /tmp/$(@F) $@
#cp $@ $(_TMP)/$(@F)
$(STRIP) $@
#cp $(_TMP)/$(@F) $@

NATIVE_DIR=src/main/resources/org/sqlite/native/$(OS_NAME)/$(OS_ARCH)
NATIVE_TARGET_DIR:=$(TARGET)/classes/org/sqlite/native/$(OS_NAME)/$(OS_ARCH)
NATIVE_DLL:=$(NATIVE_DIR)/$(LIBNAME)

# For cross-compilation, install docker. See also https://github.com/dockcross/dockcross
# Freebsd disabled for now...
#native-all: native win32 win64 win-armv7 win-arm64 mac64 linux32 linux64 freebsd32 freebsd64 freebsd-arm64 linux-arm linux-armv6 linux-armv7 linux-arm64 linux-android-arm linux-ppc64 alpine-linux64
native-all: native win32 win64 win-armv7 win-arm64 mac64 linux32 linux64 linux-arm linux-armv6 linux-armv7 linux-arm64 linux-android-arm linux-ppc64 alpine-linux64
#native-all: native win32 win64 win-armv7 win-arm64 mac64 linux32 linux64 freebsd32 freebsd64 freebsd-arm64 linux-arm linux-armv6 linux-armv7 linux-arm64 linux-android-arm linux-android-arm64 linux-android-x86 linux-android-x64 linux-ppc64 alpine-linux64
native-all: native win32 win64 win-armv7 win-arm64 mac64 linux32 linux64 linux-arm linux-armv6 linux-armv7 linux-arm64 linux-android-arm linux-android-arm64 linux-android-x86 linux-android-x64 linux-ppc64 alpine-linux64

native: $(NATIVE_DLL)

Expand Down Expand Up @@ -176,7 +174,7 @@ freebsd-arm64: $(SQLITE_UNPACKED) jni-header
docker run $(DOCKER_RUN_OPTS) -v $$PWD:/workdir gotson/freebsd-cross-build:aarch64-11.4 sh -c 'make clean-native native OS_NAME=FreeBSD OS_ARCH=aarch64 CROSS_PREFIX=aarch64-unknown-freebsd11-'

alpine-linux64: $(SQLITE_UNPACKED) jni-header
docker run $(DOCKER_RUN_OPTS) -v $$PWD:/work xerial/alpine-linux-x86_64 bash -c 'make clean-native native OS_NAME=Linux-Alpine OS_ARCH=x86_64'
docker run $(DOCKER_RUN_OPTS) -v $$PWD:/work xerial/alpine-linux-x86_64 bash -c 'make clean-native native OS_NAME=Linux-Musl OS_ARCH=x86_64'

linux-arm: $(SQLITE_UNPACKED) jni-header
./docker/dockcross-armv5 -a $(DOCKER_RUN_OPTS) bash -c 'make clean-native native CROSS_PREFIX=armv5-unknown-linux-gnueabi- OS_NAME=Linux OS_ARCH=arm'
Expand All @@ -191,7 +189,16 @@ linux-arm64: $(SQLITE_UNPACKED) jni-header
./docker/dockcross-arm64 -a $(DOCKER_RUN_OPTS) bash -c 'make clean-native native CROSS_PREFIX=aarch64-unknown-linux-gnu- OS_NAME=Linux OS_ARCH=aarch64'

linux-android-arm: $(SQLITE_UNPACKED) jni-header
./docker/dockcross-android-arm -a $(DOCKER_RUN_OPTS) bash -c 'make clean-native native CROSS_PREFIX=/usr/arm-linux-androideabi/bin/arm-linux-androideabi- OS_NAME=Linux OS_ARCH=android-arm'
./docker/dockcross-android-arm -a $(DOCKER_RUN_OPTS) bash -c 'make clean-native native CROSS_PREFIX=/usr/arm-linux-androideabi/bin/arm-linux-androideabi- OS_NAME=Linux-Android OS_ARCH=arm'

linux-android-arm64: $(SQLITE_UNPACKED) jni-header
./docker/dockcross-android-arm64 -a $(DOCKER_RUN_OPTS) bash -c 'make clean-native native CROSS_PREFIX=/usr/aarch64-linux-android/bin/aarch64-linux-android- OS_NAME=Linux-Android OS_ARCH=aarch64'

linux-android-x86: $(SQLITE_UNPACKED) jni-header
./docker/dockcross-android-x86 -a $(DOCKER_RUN_OPTS) bash -c 'make clean-native native CROSS_PREFIX=/usr/i686-linux-android/bin/i686-linux-android- OS_NAME=Linux-Android OS_ARCH=x86'

linux-android-x64: $(SQLITE_UNPACKED) jni-header
./docker/dockcross-android-x86_64 -a $(DOCKER_RUN_OPTS) bash -c 'make clean-native native CROSS_PREFIX=/usr/x86_64-linux-android/bin/x86_64-linux-android- OS_NAME=Linux-Android OS_ARCH=x86_64'

linux-ppc64: $(SQLITE_UNPACKED) jni-header
./docker/dockcross-ppc64 -a $(DOCKER_RUN_OPTS) bash -c 'make clean-native native CROSS_PREFIX=powerpc64le-unknown-linux-gnu- OS_NAME=Linux OS_ARCH=ppc64'
Expand Down
Loading

0 comments on commit 93a7057

Please sign in to comment.