forked from duncdrum/distroless-exist
-
Notifications
You must be signed in to change notification settings - Fork 0
132 lines (113 loc) · 4.14 KB
/
ci-java11.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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
name: Java 11
on: [push, pull_request]
env:
TEST_TAG: ${{ secrets.DOCKER_USERNAME }}/existdb:exist-ci
EXIST_VER: 6.0.1
jobs:
build:
name: Build and Test Images
runs-on: ubuntu-latest
# NOTE (DP): Test on PRs and pushes
if: github.ref == 'refs/heads/main' || github.base_ref == 'main'
steps:
# SETUP
- uses: actions/checkout@v2
with:
fetch-depth: 1
- name: Set up JDK 11
uses: actions/setup-java@v2
with:
distribution: temurin
java-version: '11'
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
with:
platforms: linux/amd64,linux/arm64
# platforms: all
- name: Login to Docker Hub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Make buildkit default
uses: docker/setup-buildx-action@v1
id: buildx
with:
install: true
- name: Install bats and Saxon
run: sudo apt-get install bats libsaxonb-java
- name: Check local images
run: docker image ls
- name: Modify logging config
run: saxonb-xslt -s:dump/exist-distribution-${{ env.EXIST_VER }}/etc/log4j2.xml -xsl:log4j2-docker.xslt -o:log4j2.xml
# BUILD
- name: Build default images for testing on CI
uses: docker/build-push-action@v2
with:
context: .
file: ./Dockerfile
load: true
tags: ${{ env.TEST_TAG }}
- name: Build debug images for testing on CI
uses: docker/build-push-action@v2
with:
context: .
build-args: DISTRO_TAG=debug
file: ./Dockerfile
load: true
tags: ${{ env.TEST_TAG }}-debug
# - name: Build nonroot images for testing on CI
# uses: docker/build-push-action@v2
# with:
# context: .
# build-args: DISTRO_TAG=nonroot
# file: ./Dockerfile
# load: true
# tags: ${{ env.TEST_TAG }}-nonroot
# TEST
- name: Start exist-ci container
run: |
docker run -dit -p 8080:8080 --name exist-ci --rm ${{ env.TEST_TAG }}
sleep 35s
- name: Check mem and cgroup config
run: |
docker logs exist-ci | grep -w "Approximate maximum amount of memory for JVM:"
docker logs exist-ci | grep -w "Number of processors available to JVM:"
# - name: Create empty autodeploy volume
# run: |
# docker volume create autodeploy
# docker volume ls
- name: Run tests
run: bats --tap test/bats/*.bats
# PUSH
- name: Build and publish :latest to Dockerhub
if: github.ref == 'refs/heads/main'
uses: docker/build-push-action@v2
with:
context: ./
platforms: linux/amd64,linux/arm64
file: ./Dockerfile
builder: ${{ steps.buildx.outputs.name }}
push: true
tags: |
${{ secrets.DOCKER_USERNAME }}/existdb:latest
${{ secrets.DOCKER_USERNAME }}/existdb:${{ env.EXIST_VER }}
${{ secrets.DOCKER_USERNAME }}/existdb:release
cache-from: type=registry,ref=${{ secrets.DOCKER_USERNAME }}/existdb:buildcache
cache-to: type=registry,ref=${{ secrets.DOCKER_USERNAME }}/existdb:buildcache,mode=max
- name: Build and publish :debug to Dockerhub
if: github.ref == 'refs/heads/main'
uses: docker/build-push-action@v2
with:
context: ./
platforms: linux/amd64,linux/arm64
file: ./Dockerfile
build-args: DISTRO_TAG=debug
builder: ${{ steps.buildx.outputs.name }}
push: true
tags: |
${{ secrets.DOCKER_USERNAME }}/existdb:debug
${{ secrets.DOCKER_USERNAME }}/existdb:${{ env.EXIST_VER }}-debug
${{ secrets.DOCKER_USERNAME }}/existdb:release-debug
cache-from: type=registry,ref=${{ secrets.DOCKER_USERNAME }}/existdb:buildcache
cache-to: type=registry,ref=${{ secrets.DOCKER_USERNAME }}/existdb:buildcache,mode=max