Skip to content

Commit

Permalink
Initial release (#1)
Browse files Browse the repository at this point in the history
* chore: initial release
  • Loading branch information
dainiusjocas authored Jan 22, 2021
1 parent 23dc5be commit b25f433
Show file tree
Hide file tree
Showing 92 changed files with 4,594 additions and 0 deletions.
64 changes: 64 additions & 0 deletions .github/workflows/linux-executable.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: Upload Release Artifact Executable Linux

on:
push:
# Sequence of patterns matched against refs/tags
tags:
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10

jobs:
build-binary-executable:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v1

- name: Cache maven deps
uses: actions/cache@v1
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-native-${{ hashFiles('**/deps.edn') }}
restore-keys: |
${{ runner.os }}-maven-native-
- name: setup-graalvm-ce
uses: rinx/[email protected]
with:
graalvm-version: "20.1.0"
java-version: "java11"

- name: setup-native-image
run: |
gu install native-image
- name: Install clojure tools-deps
uses: DeLaGuardo/setup-clojure@master
with:
tools-deps: 1.10.1.469

- name: Compile native binary
run: |
clojure -A:native-ket
tar zcvf ket-linux.tar.gz ket
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
draft: false
prerelease: false
- name: Upload Release Asset
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
asset_path: ./ket-linux.tar.gz
asset_name: ket-linux.tar.gz
asset_content_type: application/octet-stream
70 changes: 70 additions & 0 deletions .github/workflows/macos-executable.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
name: Upload Release Artifact Executable Macos

on:
push:
# Sequence of patterns matched against refs/tags
tags:
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10

jobs:
build-binary-executable:

runs-on: macos-latest

steps:
- uses: actions/checkout@v1

- name: Cache maven deps
uses: actions/cache@v1
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-native-${{ hashFiles('**/deps.edn') }}
restore-keys: |
${{ runner.os }}-maven-native-
- name: setup-graalvm-ce-native-image
run: |
GRAALVM_TGZ_URI="https://github.com/graalvm/graalvm-ce-builds/releases/download/vm-20.1.0/graalvm-ce-java11-darwin-amd64-20.1.0.tar.gz"
curl -sL $GRAALVM_TGZ_URI --output graalvm.tar.gz
tar -zxvf graalvm.tar.gz
ls -alh .
./graalvm-ce-java11-20.1.0/Contents/Home/bin/gu install native-image
export GRAALVM_HOME=$(pwd)/graalvm-ce-java11-20.1.0/Contents/Home/
export JAVA_HOME=${GRAALVM_HOME}
export PATH=${GRAALVM_HOME}/bin:$PATH
- name: Install clojure tools-deps
uses: DeLaGuardo/setup-clojure@master
with:
tools-deps: 1.10.1.469

- name: Compile native binary
run: |
export GRAALVM_HOME=$(pwd)/graalvm-ce-java11-20.1.0/Contents/Home/
echo $GRAALVM_HOME
export PATH=${GRAALVM_HOME}/bin:$PATH
clojure -A:native-ket
chmod +x ket
tar zcvf ket-macos.tar.gz ket
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
draft: false
prerelease: false
- name: Upload Release Asset
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
RELEASE_VERSION: $(echo $GITHUB_REF | cut -d / -f 3)
with:
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
asset_path: ./ket-macos.tar.gz
asset_name: ket-macos.tar.gz
asset_content_type: application/octet-stream
79 changes: 79 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
name: Tests

on: [push]

jobs:
unit-test:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v1

- name: Cache maven deps
uses: actions/cache@v1
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/deps.edn') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Prepare java
uses: actions/setup-java@v1
with:
java-version: 1.11

- name: Install clojure tools-deps
uses: DeLaGuardo/setup-clojure@master
with:
tools-deps: 1.10.1.469

- name: Unit Tests
run: clojure -A:test -e integration

integration-test:
name: Integration Tests
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
# Set N number of parallel jobs you want to run tests on.
# Use higher number if you have slow tests to split them on more parallel jobs.
# Remember to update ci_node_index below to 0..N-1
ci_node_total: [2]
# set N-1 indexes for parallel jobs
# When you run 2 parallel jobs then first job will have index 0, the second job will have index 1 etc
ci_node_index: [0]
java: ["1.8", "11", "14"]
elasticsearch: ["elasticsearch:6.8.8", "elasticsearch:7.8.0"]
services:
elasticsearch:
image: ${{ matrix.elasticsearch }}
ports:
- 9200/tcp
options: -e="discovery.type=single-node" --health-cmd="curl http://localhost:9200/_cluster/health" --health-interval=10s --health-timeout=5s --health-retries=10
steps:
- uses: actions/checkout@v1

- name: Cache maven deps
uses: actions/cache@v1
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/deps.edn') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Prepare java
uses: actions/setup-java@v1
with:
java-version: ${{ matrix.java }}

- name: Install clojure tools-deps
uses: DeLaGuardo/setup-clojure@master
with:
tools-deps: 1.10.1.469

- name: Integration Tests
env:
ES_HOST: http://localhost:${{ job.services.elasticsearch.ports[9200] }}
run: |
echo $ES_HOST
clojure -A:test -i integration -e kafka
10 changes: 10 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
.idea/
**/*.iml
.cpcache
classes
.nrepl-port
.env
es-tool
target/
.clj-kondo
.lsp
30 changes: 30 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
include dockerfiles/docker.mk

.PHONY: lint
lint:
clojure -M:clj-kondo

.PHONY: unit-test
unit-test:
clojure -M:test --exclude :integration

.PHONY: integration-test
integration-test:
clojure -M:test --include :integration

.PHONY: run-dev-env
run-dev-env: start-stack

ES_TEST:=-p integration-tests -f dockerfiles/docker-compose.es.test.yml -f dockerfiles/docker-compose.kafka-base.yml
.PHONY: run-integration-tests
run-integration-tests:
docker-compose $(ES_TEST) pull
docker-compose $(ES_TEST) down
docker-compose $(ES_TEST) build
docker-compose $(ES_TEST) up --remove-orphans --abort-on-container-exit --exit-code-from tools-test

build-ket:
docker build -f dockerfiles/Dockerfile.executable-builder -t ket-native-image .
docker rm ket-native-image-build || true
docker create --name ket-native-image-build ket-native-image
docker cp ket-native-image-build:/usr/src/app/ket ket
Loading

0 comments on commit b25f433

Please sign in to comment.