Skip to content

Commit

Permalink
Github CI (#50)
Browse files Browse the repository at this point in the history
  • Loading branch information
kingster authored May 3, 2021
1 parent 0a9c9ff commit 406f151
Show file tree
Hide file tree
Showing 2 changed files with 81 additions and 1 deletion.
81 changes: 81 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
name: DKV CI

on:
push:
branches:
- master
pull_request:
branches:
- master

jobs:
dkv_server_job:
runs-on: ubuntu-latest
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@v2
- name: Prepopulate Docker file
run: |
echo "COPY . /code" >> Dockerfile
cat ./Dockerfile
# This is the a separate action that sets up buildx runner
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
with:
driver-opts: network=host
# So now you can use Actions' own caching!
- name: Cache Docker layers
uses: actions/cache@v2
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@v2
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
- 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: Move cache
run: |
rm -rf /tmp/.buildx-cache
mv /tmp/.buildx-cache-new /tmp/.buildx-cache
dkv_java_client_job:
runs-on: ubuntu-latest
name: Build Java Client
steps:
- uses: actions/checkout@v2
- name: Set up JDK 9
uses: actions/setup-java@v2
with:
java-version: '9'
distribution: 'adopt'
- name: Cache Maven packages
uses: actions/cache@v2
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2
- name: Build with Maven
run: |
cd clients/java/dkv-client
mvn clean install -DskipTests -Dmaven.test.skip=true
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,3 @@ crashlytics-build.properties

.DS_Store
bin/

0 comments on commit 406f151

Please sign in to comment.