forked from stellar/anchor-platform
-
Notifications
You must be signed in to change notification settings - Fork 0
141 lines (120 loc) · 5.27 KB
/
sub_gradle_test_and_build.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
133
134
135
136
137
138
139
140
141
name: Gradle Build and Test
on:
# allows this workflow to be called from another workflow
workflow_dispatch:
workflow_call:
jobs:
gradle_test_and_build:
name: Gradle Test and Build
runs-on: ubuntu-22.04
# write to PR permission is required for jacocoTestReport Action to update comment
permissions:
contents: read
pull-requests: write
steps:
# Checkout the code
- uses: actions/checkout@v3
# This is to add to DNS entries to access the services started by docker-compose.
# This should be deprecated. Refer to: https://stackoverflow.com/questions/47762339/how-to-correctly-set-up-docker-network-to-use-localhost-connection/47763442#47763442
- name: Set up hostnames (/etc/hosts)
run: |
sudo echo "127.0.0.1 db" | sudo tee -a /etc/hosts
sudo echo "127.0.0.1 zookeeper" | sudo tee -a /etc/hosts
sudo echo "127.0.0.1 kafka" | sudo tee -a /etc/hosts
sudo echo "127.0.0.1 sep24-reference-ui" | sudo tee -a /etc/hosts
sudo echo "127.0.0.1 reference-server" | sudo tee -a /etc/hosts
sudo echo "127.0.0.1 wallet-server" | sudo tee -a /etc/hosts
sudo echo "127.0.0.1 platform" | sudo tee -a /etc/hosts
sudo echo "127.0.0.1 host.docker.internal" | sudo tee -a /etc/hosts
- name: Build and run the stack with docker compose
env:
TEST_PROFILE_NAME: default
run: docker-compose -f service-runner/src/main/resources/docker-compose-test.yaml up -d --build
# Check the docker containers
- name: Check running containers
run: docker ps
# Prepare Stellar Validation Tests
- name: Pull Stellar Validation Tests Docker Image
run: docker pull stellar/anchor-tests:v0.5.12 &
# Set up JDK 11
- name: Set up JDK 11
uses: actions/setup-java@v3
with:
java-version: '11'
distribution: 'adopt'
# Gradle test is now printing the test messages to GitHub Actions log.
# It is not necessary to print the reports.
- name: Gradle test and build. (unit tests, integration tests, end-2-end tests and build)
env:
run_docker: false
run: ./gradlew clean build jacocoTestReport --no-daemon --stacktrace -x spotlessApply -x spotlessKotlinApply -x javadoc -x javadocJar -x sourcesJar
- name: Add coverage to PR
id: jacoco
uses: madrapps/[email protected]
with:
paths: ${{ github.workspace }}/**/build/reports/jacoco/test/jacocoTestReport.xml
token: ${{ secrets.GITHUB_TOKEN }}
min-coverage-overall: 40
min-coverage-changed-files: 60
title: Code Coverage
update-comment: true
- name: Stop docker containers
env:
TEST_PROFILE_NAME: default
run: docker-compose -f service-runner/src/main/resources/docker-compose-test.yaml down
- name: Start docker containers
env:
TEST_PROFILE_NAME: default
run: docker-compose -f service-runner/src/main/resources/docker-compose-test.yaml up -d
- name: Run sep server, observer, java reference server and kotlin reference server
env:
run_docker: false
run_all_servers: false
run_sep_server: true
run_platform_server: true
run_observer: true
run_kotlin_reference_server: true
# Running wallet server is not required for sep tests. However, running wallet server
# and kotlin reference server at the same time causes `ktor` to block the JVM.
# If we need to run both `ktor` servers, we will need to run them in separate JVMs.
run_wallet_server: false
SEP1_TOML_VALUE: service-runner/src/main/resources/config/stellar.host.docker.internal.toml
SEP10_HOME_DOMAIN: host.docker.internal:8080
run: |
pwd
cp service-runner/build/libs/anchor-platform-runner-*.jar service-runner/build/libs/anchor-platform-runner.jar
java -jar service-runner/build/libs/anchor-platform-runner.jar -t &
- name: Wait for sep server to start and get ready
uses: mydea/action-wait-for-api@v1
with:
url: "http://localhost:8080/.well-known/stellar.toml"
expected-status: "200"
timeout: "300"
interval: "1"
- name: Run Stellar validation tool
run: |
docker run --network host -v ${GITHUB_WORKSPACE}/platform/src/test/resources://config stellar/anchor-tests:v0.5.12 --home-domain http://host.docker.internal:8080 --seps 1 10 12 24 31 38 --sep-config //config/stellar-anchor-tests-sep-config.json --verbose
analyze:
name: CodeQL Analysis
runs-on: ubuntu-22.04
permissions:
actions: read
contents: read
security-events: write
strategy:
fail-fast: false
matrix:
language: [ 'java', 'python' ]
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
- name: Autobuild
uses: github/codeql-action/autobuild@v2
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
with:
category: "/language:${{matrix.language}}"