Gem2Browser/.forgejo/workflows/test.yml

69 lines
2.5 KiB
YAML
Raw Permalink Normal View History

2025-01-18 18:49:10 -08:00
name: Test web app
on: [push,workflow_dispatch]
jobs:
2025-01-19 11:56:00 -08:00
flask:
name: Test server with Flask Dev Mode
2025-01-19 12:33:11 -08:00
runs-on: docker
2025-01-19 11:56:00 -08:00
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
- name: Install dependencies
2025-01-19 12:33:11 -08:00
run: apt update && apt install python3-pip curl wget -y && pip install --break-system-packages flask pyOpenSSL
2025-01-19 11:56:00 -08:00
- name: Run server
run: python3 server.py > log.log &
- name: Test server homepage
run: curl 127.0.0.1:2009
- name: Test server relay
run: curl 127.0.0.1:2009/gem?gemini=gem.swee.codes
- name: Test server certificate generation
2025-01-19 12:10:44 -08:00
run: wget http://127.0.0.1:2009/gencert.zip && unzip gencert.zip
2025-01-19 11:56:00 -08:00
- name: Kill server
if: always()
run: pkill python3
- name: Show logs
if: always()
run: cat log.log
hypercorn:
2025-01-19 12:06:30 -08:00
name: Test server with Hypercorn (ASGI)
2025-01-18 18:49:10 -08:00
runs-on: docker
steps:
- uses: actions/checkout@v4
2025-01-18 19:57:29 -08:00
- uses: actions/setup-python@v5
2025-01-18 18:49:10 -08:00
- name: Install dependencies
2025-01-18 18:55:46 -08:00
run: apt update && apt install python3-pip curl wget -y && pip install --break-system-packages flask hypercorn pyOpenSSL
2025-01-18 18:54:10 -08:00
- name: Run server
2025-01-18 22:13:44 -08:00
run: hypercorn --bind=127.0.0.1:1234 server:app > log.log &
2025-01-18 18:54:10 -08:00
- name: Test server homepage
2025-01-19 11:56:00 -08:00
run: curl 127.0.0.1:1234
2025-01-18 18:54:10 -08:00
- name: Test server relay
2025-01-19 11:56:00 -08:00
run: curl 127.0.0.1:1234/gem?gemini=gem.swee.codes
2025-01-18 18:55:46 -08:00
- name: Test server certificate generation
2025-01-19 11:56:00 -08:00
run: wget http://127.0.0.1:1234/gencert.zip && unzip gencert.zip
2025-01-18 18:54:10 -08:00
- name: Kill server
2025-01-18 18:59:02 -08:00
if: always()
2025-01-18 22:15:44 -08:00
run: pkill hypercorn
2025-01-19 12:06:30 -08:00
- name: Show logs
if: always()
run: cat log.log
gunicorn:
name: Test server with Gunicorn (WSGI)
runs-on: docker
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
- name: Install dependencies
run: apt update && apt install python3-pip curl wget -y && pip install --break-system-packages flask gunicorn pyOpenSSL
- name: Run server
2025-01-19 12:10:44 -08:00
run: gunicorn -w 4 -b 127.0.0.1:1234 'server:app' > log.log &
2025-01-19 12:06:30 -08:00
- name: Test server homepage
run: curl 127.0.0.1:1234
2025-01-19 12:10:44 -08:00
- name: Test server relay
run: curl 127.0.0.1:1234/gem?gemini=gem.swee.codes
- name: Test server certificate generation
run: wget http://127.0.0.1:1234/gencert.zip && unzip gencert.zip
2025-01-19 12:06:30 -08:00
- name: Kill server
if: always()
run: pkill gunicorn
2025-01-18 18:59:02 -08:00
- name: Show logs
if: always()
run: cat log.log