@@ -3,6 +3,9 @@ name: Node CI
33
44on : [push, pull_request]
55
6+ env :
7+ PIPING_SERVER_CHECK_VERSION : 0.11.0
8+
69jobs :
710 build :
811 runs-on : ubuntu-20.04
@@ -19,85 +22,33 @@ jobs:
1922 - run : npm run lint
2023 - run : npm run build
2124 - run : npm test
22- - name : Operational test
23- run : |
24- set -eux
25- # Create certificates
26- (mkdir /tmp/ssl_certs && cd /tmp/ssl_certs && openssl req -x509 -newkey rsa:4096 -keyout server.key -out server.crt -days 365 -sha256 -nodes --subj '/CN=localhost/')
27- # Run a server
28- node ./dist/src/index.js --http-port=8080 --enable-https=true --https-port=8443 --key-path=/tmp/ssl_certs/server.key --crt-path=/tmp/ssl_certs/server.crt &> /tmp/piping_log.txt &
29- # Wait for server running
30- sleep 1
31-
32- # Create a file to send
33- echo 'hello, world' > /tmp/hello.txt
34-
35- # Send and wait for a receiver
36- curl -T /tmp/hello.txt localhost:8080/mypath &
37- # Get data as a file
38- curl localhost:8080/mypath > /tmp/download.txt
39- # Print downloaded file
40- cat /tmp/download.txt
41- # Test the equality
42- diff /tmp/hello.txt /tmp/download.txt
43-
44- # Send and wait for a receiver
45- curl -kT /tmp/hello.txt https://localhost:8443/mypath &
46- # Get data as a file
47- curl -k https://localhost:8443/mypath > /tmp/download.txt
48- # Print downloaded file
49- cat /tmp/download.txt
50- # Test the equality
51- diff /tmp/hello.txt /tmp/download.txt
52- # Print server log
53- cat /tmp/piping_log.txt
25+ - name : Create certificates
26+ run : cd /tmp && mkdir ssl_certs && cd ssl_certs && openssl req -x509 -newkey rsa:4096 -keyout server.key -out server.crt -days 365 -sha256 -nodes --subj '/CN=localhost/'
27+ - name : Install piping-server-check
28+ run : cd /tmp && wget -O piping-server-check.deb https://github.com/nwtgck/piping-server-check/releases/download/v${PIPING_SERVER_CHECK_VERSION}/piping-server-check-${PIPING_SERVER_CHECK_VERSION}-linux-amd64.deb && sudo dpkg -i piping-server-check.deb
29+ - name : piping-server-check
30+ run : piping-server-check --http1.1 --http1.1-tls --h2 --tls-skip-verify --compromise post_cancel_post --compromise get_cancel_get --concurrency 100 --server-command="${SERVER_COMMAND}" --n-simultaneous-requests=60 --transfer-speed-byte $((1024 * 1024 * 1024 * 1024)) --transfer-span 3s --transfer-span 10s --transfer-span 1m
31+ env :
32+ SERVER_COMMAND : ' mkdir -p /tmp/logs && exec node ./dist/src/index.js --http-port=$HTTP_PORT --enable-https=true --https-port=$HTTPS_PORT --key-path=/tmp/ssl_certs/server.key --crt-path=/tmp/ssl_certs/server.crt 2>&1 | tee /tmp/logs/$SERVER_RUN_ID.log > /dev/stderr'
33+ timeout-minutes : 2
34+ - name : Show server logs from piping-server-check
35+ if : ${{ always() }}
36+ run : tail -n +1 /tmp/logs/*
5437
5538 docker_test :
5639 runs-on : ubuntu-20.04
5740 steps :
5841 - uses : actions/checkout@v3
5942 - run : docker build -t piping-server .
60- - name : Operational test with Docker image
61- run : |
62- set -eux
63- # Run a server
64- docker run -d -p 8080:80 --name=piping piping-server --http-port=80
65- # Wait for server running
66- sleep 1
67- # Create a file to send
68- echo 'hello, world' > /tmp/hello.txt
69- # Send and wait for a receiver
70- curl -T /tmp/hello.txt localhost:8080/mypath &
71- # Get data as a file
72- curl localhost:8080/mypath > /tmp/download.txt
73- # Print downloaded file
74- cat /tmp/download.txt
75- # Test the equality
76- diff /tmp/hello.txt /tmp/download.txt
77- # Print server log
78- docker logs piping
79- # Delete container
80- docker rm -f piping
81- - name : Operational test with Docker image for HTTPS
82- run : |
83- set -eux
84- # Create certificates
85- (mkdir ssl_certs && cd ssl_certs && openssl req -x509 -newkey rsa:4096 -keyout server.key -out server.crt -days 365 -sha256 -nodes --subj '/CN=localhost/')
86- # Run a server
87- docker run -d -p 8080:80 -p 8443:443 -v $PWD/ssl_certs:/ssl_certs --name=piping piping-server --http-port=80 --enable-https=true --https-port=443 --key-path=/ssl_certs/server.key --crt-path=/ssl_certs/server.crt
88- # Wait for server running
89- sleep 1
90- # Create a file to send
91- echo 'hello, world' > /tmp/hello.txt
92- # Send and wait for a receiver
93- curl -kT /tmp/hello.txt https://localhost:8443/mypath &
94- # Get data as a file
95- curl -k https://localhost:8443/mypath > /tmp/download.txt
96- # Print downloaded file
97- cat /tmp/download.txt
98- # Test the equality
99- diff /tmp/hello.txt /tmp/download.txt
100- # Print server log
101- docker logs piping
102- # Delete container
103- docker rm -f piping
43+ - name : Create certificates
44+ run : cd /tmp && mkdir ssl_certs && cd ssl_certs && openssl req -x509 -newkey rsa:4096 -keyout server.key -out server.crt -days 365 -sha256 -nodes --subj '/CN=localhost/'
45+ - name : Install piping-server-check
46+ run : cd /tmp && wget -O piping-server-check.deb https://github.com/nwtgck/piping-server-check/releases/download/v${PIPING_SERVER_CHECK_VERSION}/piping-server-check-${PIPING_SERVER_CHECK_VERSION}-linux-amd64.deb && sudo dpkg -i piping-server-check.deb
47+ - name : piping-server-check
48+ run : piping-server-check --http1.1 --http1.1-tls --h2 --tls-skip-verify --compromise post_cancel_post --compromise get_cancel_get --concurrency 100 --server-command="${SERVER_COMMAND}" --n-simultaneous-requests=60 --transfer-speed-byte $((1024 * 1024 * 1024 * 1024)) --transfer-span 3s --transfer-span 10s --transfer-span 1m
49+ env :
50+ SERVER_COMMAND : ' mkdir -p /tmp/logs && exec docker run --rm -p $HTTP_PORT:80 -p $HTTPS_PORT:443 -v /tmp/ssl_certs:/ssl_certs piping-server --http-port=80 --enable-https=true --https-port=443 --key-path=/ssl_certs/server.key --crt-path=/ssl_certs/server.crt 2>&1 | tee /tmp/logs/$SERVER_RUN_ID.log > /dev/stderr'
51+ timeout-minutes : 3
52+ - name : Show server logs from piping-server-check
53+ if : ${{ always() }}
54+ run : tail -n +1 /tmp/logs/*
0 commit comments