-
Notifications
You must be signed in to change notification settings - Fork 0
39 lines (35 loc) · 1.37 KB
/
tests-main.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
name: Tests for Main Merge
on:
pull_request:
branches:
- main
jobs:
tests-on-main:
runs-on: ubuntu-latest
env:
# Set environment variables globally for all steps within the job
GOOGLE_PROJECT_ID: ${{ vars.GOOGLE_PROJECT_ID }}
GOOGLE_EARTH_ENGINE_SERVICE_ACCOUNT_CREDENTIALS: ${{ secrets.GOOGLE_EARTH_ENGINE_SERVICE_ACCOUNT_CREDENTIALS }}
GOOGLE_EARTH_ENGINE_SERVICE_ACCOUNT_EMAIL: ${{ secrets.GOOGLE_EARTH_ENGINE_SERVICE_ACCOUNT_EMAIL }}
ENVIRONMENT: ${{ vars.ENVIRONMENT }}
steps:
- uses: actions/checkout@v3
# Build and the run the backend docker image
- name: Build and Run the Docker image (backend)
working-directory: ./backend
run: |
docker buildx build --platform linux/amd64 -t thf-climate-backend .
docker run -d -p 8000:8000 --name thf-climate-backend thf-climate-backend
- name: Wait for the application to start
working-directory: ./backend
run: |
timeout 30 bash -c 'until curl -s http://127.0.0.1:8000/; do sleep 1; done'
# Run the tests against the local application
- name: Install dependencies and Run tests
working-directory: ./backend
env:
API_BASE_URL: "http://127.0.0.1:8000"
run: |
python -m pip install --upgrade pip
pip install -r requirements-dev.txt
pytest