forked from kb-dk/MerMEId
-
Notifications
You must be signed in to change notification settings - Fork 5
132 lines (118 loc) · 4.13 KB
/
artifacts.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: Build artifacts and test Docker image
on:
push:
pull_request:
branches:
- develop
- main
jobs:
xar:
name: Build the MerMEId xar package
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
# fetch all history to include latest tag for the git revision info
fetch-depth: 0
- name: Set up JDK 11
uses: actions/setup-java@v3
with:
distribution: zulu
java-version: 11
- name: Build with Ant
run: ant clean xar
- name: Archive xar package
uses: actions/upload-artifact@v3
with:
name: xar-package
path: build/*.xar
- name: Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/') && github.event_name != 'pull_request'
with:
prerelease: true
files: |
build/*.xar
docker:
name: Build and test the Docker image
runs-on: ubuntu-latest
strategy:
matrix:
include:
- EXISTDB_IMAGE: duncdrum/existdb:6.0.1
IMAGE_TAG_SUFFIX:
PLATFORMS: |
linux/amd64
linux/arm64
- EXISTDB_IMAGE: acdhch/existdb:6.0.1-java11-ShenGC
IMAGE_TAG_SUFFIX: -java11-ShenGC
PLATFORMS: |
linux/amd64
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
# fetch all history to include latest tag for the git revision info
fetch-depth: 0
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Log in to GitHub Container registry
uses: docker/login-action@v2
if: github.event_name != 'pull_request'
with:
registry: ghcr.io
username: vifebot
password: ${{ secrets.VIFEBOTS_GITHUB_TOKEN }}
- name: Log in to DockerHub
uses: docker/login-action@v2
if: github.event_name != 'pull_request'
with:
username: vifebot
password: ${{ secrets.VIFEBOT_DOCKERHUB_TOKEN }}
# Extract metadata (tags, labels) for Docker
# https://github.com/docker/metadata-action
- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@v4
with:
images: |
ghcr.io/edirom/mermeid
edirom/mermeid
flavor: |
latest=${{ github.ref == 'refs/heads/main' }}
suffix=${{ matrix.IMAGE_TAG_SUFFIX }},onlatest=true
# Build without pushing
# subsequent steps will use this image from cache
# see https://github.com/docker/build-push-action/blob/master/docs/advanced/test-before-push.md
- name: Build and export to Docker
uses: docker/build-push-action@v3
with:
context: .
load: true
build-args: |
EXISTDB_IMAGE=${{ matrix.EXISTDB_IMAGE }}
tags: ${{ steps.meta.outputs.tags }}
- name: Run the Docker image
run: docker run --rm -p 8080:8080 -d ${{ fromJSON(steps.meta.outputs.json).tags[0] }}
- name: Check the deployed service URL
run: i=0 ; while (! curl --fail -sv http://localhost:8080/index.html) ; do if ((i > 20)) ; then echo ' **** timeout ... aborting **** ' ; exit 1 ; else sleep 5 ; echo waiting for container ... ; i=$((i+1)) ; fi ; done
- name: Run the maven tests
run: |
cd testing
mvn test
# Build and push Docker image with Buildx (don't push on PR)
# https://github.com/docker/build-push-action
- name: Build and push Docker image
uses: docker/build-push-action@v3
if: github.event_name != 'pull_request'
with:
context: .
platforms: ${{ matrix.PLATFORMS }}
build-args: |
EXISTDB_IMAGE=${{ matrix.EXISTDB_IMAGE }}
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}