forked from zio/zio-http
-
Notifications
You must be signed in to change notification settings - Fork 0
177 lines (152 loc) · 6.8 KB
/
ci2.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
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
name: ZIO-HTTP Conformance Testing
on:
pull_request:
branches: ["**"]
push:
branches: ["**"]
tags: [v*]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
JDK_JAVA_OPTIONS: "-Xms4G -Xmx8G -XX:+UseG1GC -Xss10M -XX:ReservedCodeCacheSize=1G -XX:NonProfiledCodeHeapSize=512m -Dfile.encoding=UTF-8"
SBT_OPTS: "-Xms4G -Xmx8G -XX:+UseG1GC -Xss10M -XX:ReservedCodeCacheSize=1G -XX:NonProfiledCodeHeapSize=512m -Dfile.encoding=UTF-8"
jobs:
build:
name: Build, Test, and Conformance
strategy:
matrix:
os: [ubuntu-latest]
scala: [2.12.19, 2.13.14, 3.3.3]
java: [17, 21]
runs-on: ${{ matrix.os }}
timeout-minutes: 60
steps:
- name: Checkout current branch
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: ${{ matrix.java }}
cache: sbt
# Step 3: Install PostgreSQL
- name: Set up PostgreSQL
run: |
sudo apt-get update
sudo apt-get install -y postgresql postgresql-contrib
sudo service postgresql start
cd /tmp
sudo -u postgres psql -c "ALTER USER postgres PASSWORD 'postgres';"
sudo -u postgres psql -c "CREATE USER runner WITH PASSWORD 'runnerpassword';"
sudo -u postgres psql -c "ALTER USER runner CREATEDB;"
sudo -u postgres psql -c "CREATE DATABASE runner OWNER runner;"
sudo -u postgres psql -c "\l"
# Step 5: Build and Test ZIO-HTTP (Include testing)
- name: Build and Test ZIO-HTTP
run: |
sbt clean compile
# sbt test
- name: Run ZIO HTTP server
run: |
sbt "project zioHttpExample" "runMain example.HelloWorld" &
sleep 10 # Give the server time to start
# Step 7: Install Docker and Docker Compose (needed for local servers)
- name: Install Docker
run: |
sudo apt-get update
sudo apt-get install -y apt-transport-https ca-certificates curl software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
echo "deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt-get update
sudo apt-get install -y docker-ce docker-ce-cli containerd.io docker-compose
sudo service docker start
sleep 10
sudo docker ps
- name: Verify Docker Installation
run: docker --version
docker info
# Step 8: Install Poetry and Dependencies
- name: Install Poetry and Dependencies
run: |
sudo apt-get install -y python3 python3-pip
pip install poetry
git clone --recurse-submodules https://github.com/cispa/http-conformance
cd http-conformance
poetry install
# Step 9: Patch dpkt Library
- name: Patch dpkt Library
run: |
cd http-conformance
sh fix_dpkt.sh
- name: Make curl Request to ZIO HTTP Server
run: |
curl -v http://localhost:8080 # Check the "Hello World!" route
curl -v http://localhost:8080/json # Check the JSON route
- name: Create .env File for Testbed
run: |
mv http-conformance/.env.example http-conformance/testbed/.env
echo "PGPORT=5432" >> http-conformance/testbed/.env
echo "PGHOST=127.0.0.1" >> http-conformance/testbed/.env
echo "PGUSER=runner" >> http-conformance/testbed/.env
echo "PGPASSWORD=runnerpassword" >> http-conformance/testbed/.env
echo "zio_http_http_port=8080" >> http-conformance/testbed/.env
- name: Set All Environment Variables for Testbed
run: |
echo "openresty_http_port=8088" >> $GITHUB_ENV
echo "openresty_https_port=8443" >> $GITHUB_ENV
echo "apache_http_port=8081" >> $GITHUB_ENV
echo "apache_https_port=8444" >> $GITHUB_ENV
echo "nginx_http_port=8082" >> $GITHUB_ENV
echo "nginx_https_port=8445" >> $GITHUB_ENV
echo "jetty_http_port=8083" >> $GITHUB_ENV
echo "jetty_https_port=8446" >> $GITHUB_ENV
echo "tomcat_http_port=8086" >> $GITHUB_ENV
echo "tomcat_https_port=8447" >> $GITHUB_ENV
echo "openlitespeed_http_port=8085" >> $GITHUB_ENV
echo "openlitespeed_https_port=8448" >> $GITHUB_ENV
echo "openlitespeed_admin_port=8449" >> $GITHUB_ENV
echo "caddy_http_port=8090" >> $GITHUB_ENV
echo "caddy_https_port=8450" >> $GITHUB_ENV
echo "node_http_port=8091" >> $GITHUB_ENV
echo "traefik_http_port=8092" >> $GITHUB_ENV
echo "traefik_https_port=8451" >> $GITHUB_ENV
- name: Set Docker Host
run: echo "DOCKER_HOST=unix:///var/run/docker.sock" >> $GITHUB_ENV
# Step 10: Start Testbed Servers (Docker Compose)
- name: Start Testbed Servers (Docker Compose)
run: |
cd http-conformance/testbed
docker compose up -d
echo "Docker Compose services started:"
docker compose ps
# Step 11: Run HTTP Conformance Tests
- name: Set Up Jetty Base and Enable HTTP/2
run: |
cd http-conformance/testbed
docker exec --user root testbed-jetty-1 bash -c "mkdir -p /usr/local/jetty-base && cp -r /usr/local/jetty/etc /usr/local/jetty-base/"
docker exec --user root testbed-jetty-1 bash -c "java -jar /usr/local/jetty/start.jar --add-to-start=ssl,http2,https,test-keystore"
docker compose restart jetty
- name: Test PostgreSQL Connection
run: |
PGPASSWORD=postgres psql -U postgres -d postgres -h localhost -c "\dt"
- name: Run HTTP Conformance Tests and Setup Schema
run: |
cd http-conformance
poetry run python run_checks.py --mode=local --max_workers=20
# Step 12: Start JupyterLab for Result Analysis
- name: Install JupyterLab and Start Analysis
run: |
cd http-conformance
poetry run pip install jupyterlab
# Run JupyterLab
poetry run jupyter lab --no-browser --port=8888 &
sleep 10
# Analyze the results using provided Jupyter Notebooks
poetry run jupyter nbconvert --execute --inplace --to notebook --allow-errors helpers/analysis_stats.ipynb
poetry run jupyter nbconvert --execute --inplace --to notebook --allow-errors helpers/analysis_paper.ipynb
- name: Upload Analysis Notebooks
uses: actions/upload-artifact@v3
with:
name: analysis-reports
path: http-conformance/helpers/*.ipynb