-
Notifications
You must be signed in to change notification settings - Fork 60
105 lines (87 loc) · 4 KB
/
ebsictv3.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
name: EBSI Conformance Test v3.2
on:
workflow_call:
inputs:
artifact:
description: "Load image from this artifact (defaults to empty)"
required: false
type: string
path:
description: "Specifies the artifact path (defaults to empty)"
required: false
type: string
tag:
description: "Use this docker image tag (defaults to empty)"
required: false
type: string
jobs:
EBSI-Conformance-Test-v3:
name: Run
runs-on: ubuntu-latest
env:
use-artifact: ${{ inputs.artifact != '' && inputs.tag != '' }}
steps:
- name: The EBSI Conformance Test v3.2 job is starting
run: |
echo -e "🔎 The EBSI Conformance Test v3.2 job is starting\n"
- name: Check EBSI Conformance API Status
run: |
echo "Checking if the API is available..."
RESPONSE=$(curl -s -o /dev/null -w "%{http_code}" https://api-conformance.ebsi.eu/did-registry/v5/identifiers/did:ebsi:zf39qHTXaLrr6iy3tQhT3UZ)
if [ "$RESPONSE" -ne 200 ]; then
echo "EBSI Conformance API is down. Exiting workflow with success. ✅"
exit 0 # Exit the workflow successfully
else
echo "EBSI Conformance API is up. Proceeding with tests."
fi
- name: Docker
run: docker --version
- name: Download artifact
if: ${{ env.use-artifact }}
uses: actions/download-artifact@v4
with:
name: ${{ inputs.artifact }}
path: ${{ runner.temp }}
- name: Unzip ${{ inputs.artifact }}.tar.gz
if: ${{ env.use-artifact }}
run: gunzip ${{ runner.temp }}/${{ inputs.artifact }}.tar.gz
- name: Load Docker image from tarball
if: ${{ env.use-artifact }}
run: |
docker load --input ${{ runner.temp }}/${{ inputs.artifact }}.tar
- name: Check out repository code
uses: actions/checkout@v4
- name: Start ngrok tunnel
run: |
docker run --net=host -d -it -e NGROK_AUTHTOKEN=${{ secrets.NGROK_AUTH_TOKEN }} ngrok/ngrok:latest http 7002
sleep 2s
- name: Update config files and start Issuer API
run: |
NGROK_URL=$(curl --retry 5 --retry-delay 5 --retry-connrefused -s http://127.0.0.1:4040/api/tunnels | jq -r '.tunnels[0].public_url')
if [[ -z "$NGROK_URL" ]]; then
echo "Error: Failed to fetch ngrok URL. Exiting..."
exit 1
fi
echo "The ngork url is ${NGROK_URL}\n"
sed -i 's|readonly ISSUER_URL=".*"|readonly ISSUER_URL="'"${NGROK_URL}"'"|g' .github/workflows/ebsictv3/EBSICTV3-IssueToHolder.sh
sed -i 's|baseUrl = ".*"|baseUrl = "'"${NGROK_URL}"'"|g' waltid-services/waltid-issuer-api/config/issuer-service.conf
image="${{ inputs.tag }}"
if [[ "${{ env.use-artifact }}" != "true" ]]; then
image="waltid/issuer-api:latest"
docker build -t $image -f waltid-services/waltid-issuer-api/Dockerfile .
fi
docker run --net=host -d -v $PWD/waltid-services/waltid-issuer-api/config:/waltid-issuer-api/config --name waltid-issuer-api $image
curl --retry 5 --retry-delay 5 --retry-connrefused http://localhost:7002/livez
ISSUER_URL=$(curl --retry 5 --retry-delay 5 --retry-connrefused http://localhost:7002/draft11/.well-known/openid-credential-issuer | jq -r '.issuer')
if [[ "$ISSUER_URL" == "${NGROK_URL}/draft11" ]]; then
echo -e "\nIssuer URL is valid: ${ISSUER_URL}\n"
else
echo -e "\nIssuer URL is invalid (matches forbidden value): $ISSUER_URL and "${NGROK_URL}/draft11"\n"
exit 1
fi
- name: Execute test scripts
env:
EBSI_CT_PRIVATE_KEY_PARAM: "${{ secrets.EBSI_CT_PRIVATE_KEY_PARAM }}"
run: |
chmod +x .github/workflows/ebsictv3/EBSICTV3-IssueToHolder.sh
./.github/workflows/ebsictv3/EBSICTV3-IssueToHolder.sh