Update makefile to publish coverage report #723
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
name: DKV CI | |
on: | |
push: | |
branches: | |
- master | |
pull_request: | |
# branches: | |
# - master | |
jobs: | |
dkv_server_job: | |
runs-on: ubuntu-20.04 | |
name: Build Docker Server & Run Tests | |
services: | |
registry: | |
image: registry:2 | |
ports: | |
- 5000:5000 | |
steps: | |
# To use this repository's private action, | |
# you must check out the repository | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Prepopulate Docker file | |
run: | | |
echo "COPY . /code" >> Dockerfile | |
cat ./Dockerfile | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
with: | |
driver-opts: network=host | |
- name: Cache Docker layers | |
uses: actions/cache@v3 | |
with: | |
path: /tmp/.buildx-cache | |
key: ${{ runner.os }}-buildx-${{ github.sha }} | |
restore-keys: | | |
${{ runner.os }}-buildx- | |
- name: Build Docker Container | |
uses: docker/build-push-action@v3 | |
with: | |
# using "load: true" forces the docker driver | |
# not necessary here, because we set it before | |
#load: true | |
push: true | |
tags: localhost:5000/${{ github.repository_owner }}/dkv:latest | |
context: . | |
file: ./Dockerfile | |
cache-from: type=local,src=/tmp/.buildx-cache | |
cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max | |
build-args: | | |
BASE=ubuntu:20.04 | |
CI=true | |
- name: Run tests | |
run: | | |
docker run -i localhost:5000/${{ github.repository_owner }}/dkv:latest bash -c "cd /code && GOOS=linux GOARCH=amd64 make test" | |
- name: Build dkvsrv binary | |
run: | | |
rm -rf bin || true | |
mkdir -p bin | |
chmod 777 bin | |
docker run -v $(pwd)/bin:/code/bin -i localhost:5000/${{ github.repository_owner }}/dkv:latest bash -c "cd /code && GOOS=linux GOARCH=amd64 make build" | |
- name: Upload dkvsrv binary | |
uses: actions/upload-artifact@v3 | |
with: | |
name: bin-dkvsrv | |
path: bin/dkvsrv | |
retention-days: 3 | |
- name: Move cache | |
run: | | |
rm -rf /tmp/.buildx-cache | |
mv /tmp/.buildx-cache-new /tmp/.buildx-cache | |
dkv_java_client_job: | |
runs-on: ubuntu-20.04 | |
needs: dkv_server_job | |
name: Build Java Client | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up JDK | |
uses: actions/setup-java@v3 | |
with: | |
java-version: '8' | |
distribution: 'adopt' | |
- name: Cache Maven packages | |
uses: actions/cache@v3 | |
with: | |
path: ~/.m2 | |
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }} | |
restore-keys: ${{ runner.os }}-m2 | |
- name: Create binary directory | |
run: | | |
mkdir -p bin | |
chmod 777 bin | |
- name: Download dkvsrv binary | |
uses: actions/download-artifact@v3 | |
with: | |
name: bin-dkvsrv | |
path: bin | |
- name: Update dkvsrv permissions | |
run: | | |
chmod +x bin/dkvsrv | |
ls -lRth bin | |
- name : Install goreman | |
run : | | |
go install github.com/mattn/goreman@latest | |
echo "$HOME/go/bin" >> $GITHUB_PATH | |
- name : Start DKV Cluster | |
run : | | |
echo "$PATH" | |
goreman -exit-on-error -f clients/java/dkv-client/src/test/resources/Procfile start & | |
sleep 10 | |
- name: Build with Maven | |
run: | | |
cd clients/java/dkv-client | |
mvn clean install |