Update install.sh #20
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This workflow will install Python dependencies, run tests and lint with a single version of Python | |
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python | |
name: custom-http-server CI | |
on: | |
push: | |
branches: [main] | |
pull_request: | |
branches: [main] | |
schedule: | |
- cron: '0 0 1 * *' # At 00:00 UTC on the 1st of every month | |
workflow_dispatch: | |
jobs: | |
test-server: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-latest, windows-latest] | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.x' | |
- name: Run server with --path . on port 8080 | |
working-directory: ./custom-http-server | |
run: | | |
echo "Launching server with --path . on port 8080" | |
python3 custom_http_server.py --path . --port 8080 & | |
SERVER_PID=$! | |
sleep 3 | |
echo "Requesting root path..." | |
curl --fail http://localhost:8080 | |
kill $SERVER_PID | |
shell: bash | |
- name: Run server with --path /tmp on port 8081 | |
working-directory: ./custom-http-server | |
run: | | |
echo "Creating dummy file in /tmp" | |
echo "Hello from /tmp" > /tmp/test.txt | |
echo "Launching server with --path /tmp on port 8081" | |
python3 custom_http_server.py --path /tmp --port 8081 & | |
SERVER_PID=$! | |
sleep 3 | |
echo "Requesting /test.txt..." | |
curl --fail http://localhost:8081/test.txt | |
kill $SERVER_PID | |
shell: bash |