[ADD] test back job

This commit is contained in:
Quentin TREHEUX
2023-03-03 04:52:24 +01:00
parent f5b0927b95
commit 4454dfadfc
+70
View File
@@ -0,0 +1,70 @@
name: Test_Back
on:
workflow_call:
jobs:
## Test Backend ##
Test_Back:
runs-on: ubuntu-latest
timeout-minutes: 15
environment: Staging
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
fetch-depth: 0
- name: Copy env file to github secret env file
run: |
touch .env
echo "POSTGRES_USER=user" >> .env
echo "POSTGRES_PASSWORD=eip" >> .env
echo "POSTGRES_NAME=chromacase" >> .env
echo "POSTGRES_HOST=db" >> .env
echo "DATABASE_URL=postgresql://user:eip@db:5432/chromacase" >> .env
echo "JWT_SECRET=wow" >> .env
echo "POSTGRES_DB=chromacase" >> .env
echo "API_URL=http://localhost:80/api" >> .env
echo "SCORO_URL=ws://localhost:6543" >> .env
- name: Start the service
run: docker-compose up -d back db
- name: Perform healthchecks
run: |
docker-compose ps -a
wget --retry-connrefused http://localhost:3000 # /healthcheck
- name: Run robot tests
run: |
pip install -r back/test/robot/requirements.txt
robot -d out back/test/robot/
- uses: actions/upload-artifact@v3
if: always()
with:
name: results
path: out
- name: Write results to Pull Request and Summarry
if: always() && github.event_name == 'pull_request'
uses: joonvena/robotframework-reporter-action@v2.1
with:
report_path: out/
gh_access_token: ${{ secrets.GITHUB_TOKEN }}
only_summary: false
- name: Write results to Summarry
if: always() && github.event_name != 'pull_request'
uses: joonvena/robotframework-reporter-action@v2.1
with:
report_path: out/
gh_access_token: ${{ secrets.GITHUB_TOKEN }}
only_summary: true
- name: Remove .env && stop the service
run: docker-compose down && rm .env