-
Notifications
You must be signed in to change notification settings - Fork 0
118 lines (98 loc) · 4.04 KB
/
Copy pathplugin-integration.yml
File metadata and controls
118 lines (98 loc) · 4.04 KB
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
name: Build and use plugin
on:
push:
workflow_dispatch:
jobs:
build:
runs-on: ${{ matrix.operating-system }}
environment:
name: ${{ github.ref_name }}
strategy:
matrix:
operating-system: [ubuntu-latest]
versions: [ { jdk: 17, mapping-service: v1.0.5 }, { jdk: 21, mapping-service: latest } ]
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Extract branch name
shell: bash
run: echo "branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> $GITHUB_OUTPUT
id: extract_branch
- name: Set up JDK
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: ${{ matrix.versions.jdk }}
- name: Build with Gradle
run: |
JAR_VERSION=$(./mappingservice-plugin/gradlew printVersion -q -p ./mappingservice-plugin/)
JAR_VERSION=${JAR_VERSION##*$'\n'}
./mappingservice-plugin/gradlew clean jar -p ./mappingservice-plugin/
echo "JAR_VERSION=${JAR_VERSION}"
mv -v ./mappingservice-plugin/build/libs/ApeHePlugin-$JAR_VERSION-plain.jar ./mappingservice-plugin/build/libs/ApeHeplugin.jar
env:
VERSION_OVERRIDE_BY_BRANCH: ${{ steps.extract_branch.outputs.branch }}
- name: Upload job artifact
uses: actions/upload-artifact@v4
with:
name: jar-jdk${{ matrix.versions.jdk }}
path: ./mappingservice-plugin/build/libs/ApeHeplugin.jar
test:
runs-on: ${{ matrix.operating-system }}
environment:
name: ${{ github.ref_name }}
strategy:
fail-fast: false
matrix:
operating-system: [ubuntu-latest]
versions: [ { jdk: 17, mapping-service: v1.0.5 }, { jdk: 21, mapping-service: latest } ]
needs: build
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Extract branch name
shell: bash
run: echo "branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> $GITHUB_OUTPUT
id: extract_branch
- name: Download built jar
uses: actions/download-artifact@v4
with:
name: jar-jdk${{ matrix.versions.jdk }}
path: ./plugins
- name: Run Docker Container
run: |
docker run -d -p 8095:8095 -e PIP_BREAK_SYSTEM_PACKAGES=1 -v ./plugins/ApeHeplugin.jar:/spring/mapping-service/plugins/ApeHeplugin.jar --name mapping4docker ghcr.io/kit-data-manager/mapping-service:${{ matrix.versions.mapping-service }}
echo "Waiting for mapping service to be healthy..."
while true; do
if ! docker ps | grep -q mapping4docker; then
echo "Docker container stopped unexpectedly. Aborting."
exit 1
fi
if curl -f http://localhost:8095/actuator/info; then
echo "Service is running."
break
fi
echo "Waiting..."
docker logs --tail 20 mapping4docker
sleep 5
done
- name: Install Hurl & Prepare JSON
run: |
curl -LO https://github.com/Orange-OpenSource/hurl/releases/download/6.0.0/hurl_6.0.0_amd64.deb
sudo dpkg -i hurl_6.0.0_amd64.deb
sudo apt install -y dos2unix
# Fetch mappingType dynamically
mappingType=$(curl -s http://localhost:8095/api/v1/mappingAdministration/types | jq -r '.[0].id')
echo "Using mappingType: $mappingType"
echo "{\"mappingId\":\"96\",\"mappingType\":\"$mappingType\",\"title\":\"apeHe from CI test\",\"description\":\"\",\"acl\":[]}" > record.json
echo '{"entry.title.value": "entry.title"}' > document.json
unix2dos -n ./mappingservice-plugin/integrationtests/basic.hurl ./mappingservice-plugin/integrationtests/basic_crlf.hurl
- name: Run Tests with Hurl
run: |
hurl --variable host=http://localhost:8095 --test ./mappingservice-plugin/integrationtests/basic_crlf.hurl --verbose --file-root .
env:
VERSION_OVERRIDE_BY_BRANCH: ${{ steps.extract_branch.outputs.branch }}
- name: Clean up temp files
run: rm -f record.json document.json
- name: Stop Docker Container
run: docker stop mapping4docker