-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
PIP-5 PIP-6 PIP-7 #done add cli compilation and dockerfile (#24)
* PIP-5 PIP-7 add cli compilation and dockerfile * trim modules * duplicated LRSQLs runtime strategy * single place to list modules, currently pegged to runtimer * PIP-7 slimmer docker * minimize docker java modules * PIP-7 ability to build + draft release * dont be so cavalier about unzipping I guess * forgot the -d * individual again * move the runtimes to the right places * add docker release
- Loading branch information
Showing
9 changed files
with
189 additions
and
4 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# exclude runtimes as we build our own on alpine | ||
/target/bundle/runtimes |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
name: Release | ||
|
||
# Draft Release on any tag | ||
on: | ||
push: | ||
tags: | ||
- '*' | ||
|
||
jobs: | ||
build_jre: | ||
uses: yetanalytics/runtimer/.github/workflows/runtimer.yml@cf8c77d465f08962cd7901005b8cf197a6149ac1 | ||
with: | ||
java-version: '11' | ||
java-distribution: 'temurin' | ||
java-modules: 'java.base,java.logging,java.naming,java.sql' | ||
|
||
build: | ||
needs: build_jre | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Get an env | ||
uses: yetanalytics/actions/setup-env@v0 | ||
|
||
- name: Cache Deps | ||
uses: actions/cache@v2 | ||
with: | ||
path: | | ||
~/.m2 | ||
~/.gitlibs | ||
key: ${{ runner.os }}-deps-${{ hashFiles('deps.edn') }} | ||
restore-keys: | | ||
${{ runner.os }}-cljdeps- | ||
- name: Build Xapipe | ||
run: make bundle BUNDLE_RUNTIMES=false | ||
|
||
- name: Log in to Docker Hub | ||
uses: docker/login-action@v1 | ||
with: | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_CI_TOKEN }} | ||
|
||
- name: Extract metadata (tags, labels) for Docker | ||
id: meta | ||
uses: docker/metadata-action@v3 | ||
with: | ||
images: yetanalytics/xapipe | ||
|
||
- name: Build and push Docker image | ||
uses: docker/build-push-action@v2 | ||
with: | ||
context: . | ||
push: true | ||
tags: ${{ steps.meta.outputs.tags }} | ||
|
||
- name: Download ubuntu-latest Artifact | ||
uses: actions/download-artifact@v2 | ||
with: | ||
name: ubuntu-20.04-jre | ||
|
||
- name: Download macOS-latest Artifact | ||
uses: actions/download-artifact@v2 | ||
with: | ||
name: macos-10.15-jre | ||
|
||
- name: Download windows-latest Artifact | ||
uses: actions/download-artifact@v2 | ||
with: | ||
name: windows-2019-jre | ||
|
||
- name: Unzip the runtimes | ||
run: | | ||
mkdir -p target/bundle/runtimes | ||
unzip ubuntu-20.04-jre.zip -d target/bundle/runtimes | ||
mv target/bundle/runtimes/ubuntu-20.04 target/bundle/runtimes/linux | ||
unzip macos-10.15-jre.zip -d target/bundle/runtimes | ||
mv target/bundle/runtimes/macos-10.15 target/bundle/runtimes/macos | ||
unzip windows-2019-jre.zip -d target/bundle/runtimes | ||
mv target/bundle/runtimes/windows-2019 target/bundle/runtimes/windows | ||
- name: Zip the bundle | ||
run: | | ||
cd target/bundle | ||
zip -r ../../xapipe.zip ./ | ||
- name: Craft Draft Release | ||
uses: softprops/action-gh-release@v1 | ||
with: | ||
body: "## Release Notes\nTODO: Create great release notes!" | ||
draft: true | ||
files: 'xapipe.zip' |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,3 +15,4 @@ pom.xml.asc | |
failures/ | ||
/store/ | ||
/.test_store/ | ||
/tmp/ |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
java.base,java.logging,java.naming,java.sql |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
FROM alpine:3.14 | ||
|
||
ADD target/bundle /xapipe | ||
ADD .java_modules /xapipe/.java_modules | ||
|
||
# replace the linux runtime via jlink | ||
RUN apk update \ | ||
&& apk upgrade \ | ||
&& apk add ca-certificates \ | ||
&& update-ca-certificates \ | ||
&& apk add --no-cache openjdk11 \ | ||
&& mkdir -p /xapipe/runtimes \ | ||
&& jlink --output /xapipe/runtimes/linux/ --add-modules $(cat /xapipe/.java_modules) \ | ||
&& apk del openjdk11 \ | ||
&& rm -rf /var/cache/apk/* | ||
|
||
WORKDIR /xapipe | ||
ENTRYPOINT ["/xapipe/bin/run.sh"] | ||
CMD ["--help"] |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,62 @@ | ||
.phony: test-lib bench | ||
.phony: test-lib bench clean bundle | ||
|
||
clean: | ||
rm -rf target classes | ||
|
||
test-lib: | ||
clojure -X:cli:test :dirs '["src/test"]' | ||
|
||
bench: | ||
clojure -Xtest:bench | ||
|
||
target/bundle/xapipe.jar: | ||
mkdir -p target/bundle | ||
clojure -Xuberjar | ||
|
||
target/bundle/bin: | ||
mkdir -p target/bundle/bin | ||
cp bin/*.sh target/bundle/bin | ||
chmod +x target/bundle/bin/*.sh | ||
|
||
# Make Runtime Environment (i.e. JREs) | ||
|
||
# The given tag to pull down from yetanalytics/runtimer release | ||
RUNTIME_TAG ?= 0.1.1-java-11-temurin | ||
RUNTIME_MACHINE ?= macos | ||
RUNTIME_MACHINE_BUILD ?= macos-10.15 | ||
RUNTIME_ZIP_DIR ?= tmp/runtimes/${RUNTIME_TAG} | ||
RUNTIME_ZIP ?= ${RUNTIME_ZIP_DIR}/${RUNTIME_MACHINE}.zip | ||
JAVA_MODULES ?= $(shell cat .java_modules) | ||
|
||
# DEBUG: Kept here for reference | ||
# target/bundle/runtimes: target/bundle/bin | ||
# mkdir target/bundle/runtimes | ||
# jlink --output target/bundle/runtimes/$(MACHINE_TYPE) --add-modules $(JAVA_MODULES) | ||
|
||
target/bundle/runtimes/%: | ||
mkdir -p ${RUNTIME_ZIP_DIR} | ||
mkdir -p target/bundle/runtimes | ||
[ ! -f ${RUNTIME_ZIP} ] && curl -L -o ${RUNTIME_ZIP} https://github.com/yetanalytics/runtimer/releases/download/${RUNTIME_TAG}/${RUNTIME_MACHINE_BUILD}-jre.zip || echo 'already present' | ||
unzip ${RUNTIME_ZIP} -d target/bundle/runtimes/ | ||
mv target/bundle/runtimes/${RUNTIME_MACHINE_BUILD} target/bundle/runtimes/${RUNTIME_MACHINE} | ||
|
||
target/bundle/runtimes/macos: RUNTIME_MACHINE = macos | ||
target/bundle/runtimes/macos: RUNTIME_MACHINE_BUILD = macos-10.15 | ||
|
||
target/bundle/runtimes/linux: RUNTIME_MACHINE = linux | ||
target/bundle/runtimes/linux: RUNTIME_MACHINE_BUILD = ubuntu-20.04 | ||
|
||
target/bundle/runtimes/windows: RUNTIME_MACHINE = windows | ||
target/bundle/runtimes/windows: RUNTIME_MACHINE_BUILD = windows-2019 | ||
|
||
target/bundle/runtimes: target/bundle/runtimes/macos target/bundle/runtimes/linux target/bundle/runtimes/windows | ||
|
||
BUNDLE_RUNTIMES ?= true | ||
|
||
ifeq ($(BUNDLE_RUNTIMES),true) | ||
target/bundle: target/bundle/xapipe.jar target/bundle/bin target/bundle/runtimes | ||
else | ||
target/bundle: target/bundle/xapipe.jar target/bundle/bin | ||
endif | ||
|
||
bundle: target/bundle |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#!/bin/sh | ||
|
||
#TODO: Add windows, possibly better macos targeting | ||
|
||
unameOut="$(uname -s)" | ||
case "${unameOut}" in | ||
Linux*) machine=linux;; | ||
*) machine=macos;; | ||
esac | ||
|
||
echo ${machine} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#!/bin/sh | ||
|
||
MACHINE=`bin/machine.sh` | ||
|
||
runtimes/$MACHINE/bin/java -server -jar xapipe.jar $@ |
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