111 remove local data source and use capx api instead #244
This file contains 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
name: Run tests | |
on: | |
workflow_dispatch: | |
pull_request: | |
push: | |
jobs: | |
build-and-test: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
env: | |
API_URL: https://balextest.itservices.manchester.ac.uk/api/skills/getAllGrouped | |
API_KEY: ${{ secrets.CAPX_API_KEY }} | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Test API response | |
run: | | |
response=$(curl -s -o /dev/null -w "%{http_code}" -H "x-api-key: $API_KEY" $API_URL) | |
if [ "$response" -ne 200 ]; then | |
echo "API response is not 200 OK. Response code: $response" | |
exit 1 | |
fi | |
- name: Test API response is valid JSON | |
run: | | |
response=$(curl -s -H "x-api-key: $API_KEY" $API_URL) | |
python3 -c 'import json; json.loads("""$response""")' | |
- name: Test image builds | |
run: | | |
docker compose -f compose.yml build | |
- name: Test container can start and is healthy | |
run: | | |
# Launch the project from docker-compose.yml and wait up to | |
# 30s for its built-in health check to return "healthy" | |
docker compose -f compose.yml up --wait --wait-timeout 30 | |
docker compose -f compose.yml down | |
- name: Run Pytest tests | |
run: | | |
docker compose -f compose.yml run --entrypoint "" web pytest |