Skip to content

Merge pull request #83 from Dewberry/patch/separate-config-struct #142

Merge pull request #83 from Dewberry/patch/separate-config-struct

Merge pull request #83 from Dewberry/patch/separate-config-struct #142

Workflow file for this run

name: E2E tests
on:
push:
branches: [main]
pull_request:
workflow_dispatch:
jobs:
newman-tests:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v3
- name: Create env file
run: |
touch .env
echo API_NAME='github-testing-process-api' >> .env
echo STORAGE_SERVICE='minio' >> .env
echo STORAGE_BUCKET='api-storage' >> .env
echo STORAGE_METADATA_PREFIX='metadata' >> .env
echo STORAGE_RESULTS_PREFIX='results' >> .env
echo STORAGE_LOGS_PREFIX='logs' >> .env
echo PLUGINS_LOAD_DIR='plugins' >> .env
echo PLUGINS_DIR='/.data/plugins' >> .env
echo TMP_JOB_LOGS_DIR='/.data/tmp/logs' >> .env
echo MINIO_ACCESS_KEY_ID=user >> .env
echo MINIO_SECRET_ACCESS_KEY=password >> .env
echo MINIO_S3_ENDPOINT=http://minio:9000 >> .env
echo MINIO_S3_REGION='us-east-1' >> .env
echo MINIO_ROOT_USER=user >> .env
echo MINIO_ROOT_PASSWORD=password >> .env
echo DB_SERVICE='postgres' >> .env
echo POSTGRES_CONN_STRING='postgres://user:password@postgres:5432/db?sslmode=disable' >> .env
echo POSTGRES_PASSWORD='password' >> .env
echo POSTGRES_USER='user' >> .env
echo POSTGRES_DB='db' >> .env
echo PG_LOG_CHECKPOINTS='off' >> .env
echo AWS_ACCESS_KEY_ID=${{ secrets.AWS_ACCESS_KEY_ID }} >> .env
echo AWS_SECRET_ACCESS_KEY=${{ secrets.AWS_SECRET_ACCESS_KEY }} >> .env
echo AWS_REGION=${{ secrets.AWS_DEFAULT_REGION }} >> .env
echo BATCH_LOG_STREAM_GROUP='/aws/batch/job' >> .env
- name: Build the test images
run: |
cd plugin-examples
chmod +x build.sh
./build.sh &
- name: Build the docker-compose stack
run: docker-compose -f docker-compose.prod.yml build
- name: Create network
run: docker network create process_api_net
- name: Run the docker-compose stack
run: docker-compose -f docker-compose.prod.yml up -d
- name: Create bucket
run: >
docker run
--network process_api_net
-e MINIO_ROOT_USER=user
-e MINIO_ROOT_PASSWORD=password
-e STORAGE_BUCKET=api-storage
--entrypoint /bin/sh
minio/mc:RELEASE.2023-08-18T21-57-55Z
-c "mc alias set myminio http://minio:9000 \$MINIO_ROOT_USER \$MINIO_ROOT_PASSWORD && mc mb myminio/\${STORAGE_BUCKET}"
- name: Wait for API server to be ready
run: |
attempts=0
max_attempts=12 # This will wait for 2 minutes (10 seconds * 12)
while true; do
if curl -s http://localhost:80; then
echo "API server is ready!"
break
fi
attempts=$((attempts+1))
if [ $attempts -eq $max_attempts ]; then
echo "Max attempts reached. Exiting..."
exit 1
fi
echo "Waiting for API server to be ready. Attempt: $attempts"
sleep 10
done
- name: Run newman tests
run: >
docker run --network="host" -v /home/runner/work/process-api/process-api/tests/e2e:/etc/newman/ postman/newman:5.3.1-alpine run tests.postman_collection.json
--env-var "url=localhost:80" --reporters cli --bail --color on
# # Uncomment to print logs for debugging
# - name: Display docker-compose logs
# run: |
# docker-compose logs
# cat .data/api/logs/api.jsonl
# if: always()