-
Notifications
You must be signed in to change notification settings - Fork 26
117 lines (114 loc) · 3.48 KB
/
main.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
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