Add integration tests (#650)

This commit is contained in:
Elijah Ahianyo 2023-03-09 22:59:04 +00:00 committed by GitHub
parent 6e74cb00a3
commit 07d0604ca5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -4,7 +4,6 @@ on:
pull_request_review: pull_request_review:
types: [submitted] types: [submitted]
permissions: permissions:
contents: read contents: read
@ -35,8 +34,8 @@ jobs:
- name: Clone Pynecone Website Repo - name: Clone Pynecone Website Repo
uses: actions/checkout@v3 uses: actions/checkout@v3
with: with:
repository: pynecone-io/pcweb repository: pynecone-io/pynecone-examples
path: pcweb path: pynecone-examples
# Install poetry # Install poetry
- name: cache poetry install - name: cache poetry install
@ -58,17 +57,34 @@ jobs:
path: .venv path: .venv
key: python-${{ matrix.python-version }}-pydeps-${{ hashFiles('**/poetry.lock') }} key: python-${{ matrix.python-version }}-pydeps-${{ hashFiles('**/poetry.lock') }}
# Begin the integration test - name: Poetry Install
# Commenting this out for now while we improve it. run: poetry install --no-interaction --no-root
# - name: Poetry Install if: steps.cache-deps.outputs.cache-hit != 'true'
# run: poetry install --no-interaction --no-root - name: Install Requirements
# if: steps.cache-deps.outputs.cache-hit != 'true' working-directory: ./pynecone-examples/counter
# - name: Install Requirements run: poetry run pip install -r requirements.txt
# working-directory: ./pcweb - name: Init Website
# run: poetry run pip install -r requirements.txt working-directory: ./pynecone-examples/counter
# - name: Init Website run: poetry run pc init
# working-directory: ./pcweb - name: Run Website and check for errors
# run: poetry run pc init working-directory: ./pynecone-examples/counter
# - name: Run Website run: |
# working-directory: ./pcweb curl -fsSL https://bun.sh/install | bash -s -- bun-v0.5.5
# run: timeout 1m poetry run pc run || exit 0 timeout 2m poetry run pc run &
sleep 10
URL="127.0.0.1:3000"
# make the curl request and save the response and HTTP status code
RESPONSE=$(curl -s -w "\n%{http_code}" $URL)
# extract the HTTP status code from the response
HTTP_STATUS=$(echo "$RESPONSE" | tail -n1)
# check for errors based on the HTTP status code
if [[ $HTTP_STATUS -ge 400 ]]; then
echo "Error: HTTP status code $HTTP_STATUS"
exit 1
fi
echo "success with HTTP STATUS: $HTTP_STATUS"