Skip to content

Commit 1d0b07c

Browse files
Merge pull request #1521 from virtualcell/openapi-spec-CI-test
Openapi spec ci test
2 parents 69e2dfc + 5728e27 commit 1d0b07c

5 files changed

Lines changed: 69 additions & 7 deletions

File tree

.github/workflows/ci_cd.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,7 @@ jobs:
174174
java -version
175175
if [ "${{ matrix.test-group }}" == "Quarkus" ]; then
176176
mvn --batch-mode clean install dependency:copy-dependencies -DskipTests=true
177+
./tools/validate-openapi-spec.sh
177178
cd vcell-rest
178179
mvn test
179180
else

docker/swarm/README_zeke_stack_on_linux.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,6 @@ Build and Generate Clients
4040
4141
``` bash
4242
pushd ../../
43-
mvn clean install dependency:copy-dependencies -DskipTests=true
44-
cp ./vcell-rest/target/generated/openapi.yaml ./tools/openapi.yaml
45-
./tools/generate.sh
43+
./tools/compile-and-build-clients.sh
4644
popd
4745
```

tools/compile-and-build-clients.sh

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#!/bin/bash
2+
3+
# Get the directory where the script is located
4+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
5+
6+
# Get the current working directory
7+
CURRENT_DIR="$(pwd)"
8+
9+
if [[ "$CURRENT_DIR" == "$SCRIPT_DIR" ]]; then
10+
pushd ../
11+
fi
12+
13+
mvn clean install dependency:copy-dependencies -DskipTests=true
14+
15+
# Check the result of the compile command
16+
if [[ $? -ne 0 ]]; then
17+
exit 1
18+
fi
19+
20+
cp ./vcell-rest/target/generated/openapi.yaml ./tools/openapi.yaml
21+
./tools/generate.sh
22+
23+
if [[ "$CURRENT_DIR" == "$SCRIPT_DIR" ]]; then
24+
popd || exit
25+
fi
26+

tools/validate-openapi-spec.sh

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
#!/bin/bash
2+
RED='\033[0;31m'
3+
NC='\033[0m' # No Color
4+
GREEN='\033[0;32m'
5+
6+
7+
# Get the directory where the script is located
8+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
9+
10+
# Get the current working directory
11+
CURRENT_DIR="$(pwd)"
12+
13+
if [[ "$CURRENT_DIR" == "$SCRIPT_DIR" ]]; then
14+
pushd ../
15+
fi
16+
17+
FILE="./tools/openapi.yaml"
18+
19+
echo "This test should only be done after the entire codebase has been compiled."
20+
21+
if [[ -z "$FILE" ]]; then
22+
echo "Error: OpenAPI file does not exist in tools directory."
23+
exit 1
24+
fi
25+
26+
cp ./vcell-rest/target/generated/openapi.yaml "$FILE"
27+
28+
# Check if the file has changes compared to HEAD
29+
if ! git diff --quiet -- "$FILE"; then
30+
echo ""
31+
echo -e "${RED}Error: The OpenAPI specification file has changed!"
32+
echo -e "This can mean some endpoint was created and did not generate clients, or "
33+
echo -e "an object internal to VCell has changed which the server uses as a DTO.${NC}"
34+
exit 1
35+
fi
36+
37+
echo -e "${GREEN}Success: OpenAPI spec is up to date.${NC}"
38+
39+
if [[ "$CURRENT_DIR" == "$SCRIPT_DIR" ]]; then
40+
popd || exit
41+
fi

vcell-rest/pom.xml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -163,10 +163,6 @@
163163
</exclusion>
164164
</exclusions>
165165
</dependency>
166-
<dependency>
167-
<groupId>org.jboss.logmanager</groupId>
168-
<artifactId>log4j2-jboss-logmanager</artifactId>
169-
</dependency>
170166
<dependency>
171167
<groupId>org.jboss.logmanager</groupId>
172168
<artifactId>log4j-jboss-logmanager</artifactId>

0 commit comments

Comments
 (0)