@@ -2,11 +2,14 @@ name: build
2
2
3
3
on : [push, pull_request]
4
4
5
+ env :
6
+ _JAVA_OPTIONS : " -Xms512m -Xmx4g"
7
+ REPOSITORY_OWNER : ${{ github.repository }}
8
+ LD_LIBRARY_PATH : " /usr/lib/lp_solve"
9
+
5
10
jobs :
6
11
build :
7
-
8
12
runs-on : ubuntu-latest
9
-
10
13
steps :
11
14
- uses : actions/checkout@v2
12
15
with :
@@ -18,16 +21,36 @@ jobs:
18
21
uses : actions/setup-java@v1
19
22
with :
20
23
java-version : 1.8
24
+ - name : Cache SBT ivy cache
25
+ uses : actions/cache@v1
26
+ with :
27
+ path : ~/.ivy2/cache
28
+ key : ${{ runner.os }}-sbt-ivy-cache-${{ hashFiles('**/build.sbt') }}
29
+ - name : Cache SBT
30
+ uses : actions/cache@v1
31
+ with :
32
+ path : ~/.sbt
33
+ key : ${{ runner.os }}-sbt-${{ hashFiles('**/build.sbt') }}
21
34
- name : Install lp_solve
22
35
run : sudo apt update && sudo apt install -y bash lp-solve wget zip unzip && sudo rm -rf /var/lib/apt/lists/*
23
36
- name : Install lp_solve java
24
37
run : (cd /tmp && wget https://sourceforge.net/projects/lpsolve/files/lpsolve/5.5.2.5/lp_solve_5.5.2.5_java.zip && unzip lp_solve_5.5.2.5_java.zip && sudo cp lp_solve_5.5_java/lib/ux64/liblpsolve55j.so /usr/lib/lp_solve && sudo ldconfig && sudo rm -rf /tmp/lp_solve_5.5_java && rm /tmp/lp_solve_5.5.2.5_java.zip)
25
- - name : Docker login
26
- uses : azure/docker-login@v1
38
+ - name : Build for Scala 2.12
39
+ run : sbt ++2.12.10 clean compile
40
+ - name : Run Tests
41
+ run : sbt ++2.12.10 test
42
+
43
+ docker :
44
+ needs : build
45
+ runs-on : ubuntu-latest
46
+ steps :
47
+ - uses : actions/checkout@v2
27
48
with :
28
- login-server : ' docker.pkg.github.com'
29
- username : ${GITHUB_ACTOR}
30
- password : ${{ secrets.GITHUB_TOKEN }}
49
+ fetch-depth : 1
50
+ - name : Set up JDK 1.8
51
+ uses : actions/setup-java@v1
52
+ with :
53
+ java-version : 1.8
31
54
- name : Cache SBT ivy cache
32
55
uses : actions/cache@v1
33
56
with :
@@ -38,16 +61,14 @@ jobs:
38
61
with :
39
62
path : ~/.sbt
40
63
key : ${{ runner.os }}-sbt-${{ hashFiles('**/build.sbt') }}
41
- - name : Build for Scala 2.12
42
- run : sbt ++2.12.10 clean compile
43
- - name : Run Tests
44
- run : sbt ++2.12.10 test
64
+ - name : Docker login
65
+ uses : azure/docker-login@v1
66
+ with :
67
+ login-server : ' docker.pkg.github.com'
68
+ username : ${GITHUB_ACTOR}
69
+ password : ${{ secrets.GITHUB_TOKEN }}
45
70
- name : Create Docker Image
46
71
run : sbt ++2.12.10 docker
47
72
- name : Push docker images
48
- if : github.event_name != 'pull_request'
49
- run : sbt ++2.12.10 dockerPush
50
- env :
51
- _JAVA_OPTIONS : " -Xms512m -Xmx4g"
52
- REPOSITORY_OWNER : ${{ github.repository }}
53
- LD_LIBRARY_PATH : " /usr/lib/lp_solve"
73
+ if : github.event_name == 'push' && (contains(github.ref, 'develop') || contains(github.ref, 'master'))
74
+ run : sbt ++2.12.10 dockerPush
0 commit comments