fix indention issues #27
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: CI/CD | |
on: [push, pull_request] | |
jobs: | |
build: | |
environment: | |
name: test | |
env: | |
DB_HOST: ${{secrets.DB_HOST}} | |
DB_PORT: ${{vars.DB_PORT}} | |
DB_PASSWORD: ${{secrets.DB_PASSWORD}} | |
DB_DATABASE: ${{vars.DB_DATABASE}} | |
DB_DATABASE_TESTING: ${{vars.DB_DATABASE_TESTING}} | |
DB_USER: ${{vars.DB_USER}} | |
AUTH_SECRET_KEY: ${{secrets.AUTH_SECRET_KEY}} | |
AUTH_ALGORITHM: ${{secrets.AUTH_ALGORITHM}} | |
ACCESS_TOKEN_EXPIRE_MINUTES: ${{vars.ACCESS_TOKEN_EXPIRE_MINUTES}} | |
SYMPTOM_SERVICE_URL: ${{vars.SYMPTOM_SERVICE_URL}} | |
MAIL_SERVICE_URL: ${{secrets.MAIL_SERVICE_URL}} | |
MAIL_SERVICE_API_KEY: ${{secrets.MAIL_SERVICE_API_KEY}} | |
API_URL: ${{secrets.API_URL}} | |
services: | |
postgres: | |
image: postgres | |
env: | |
POSTGRES_USER: ${{vars.DB_USER}} | |
POSTGRES_PASSWORD: ${{secrets.DB_PASSWORD}} | |
POSTGRES_DB: ${{secrets.DB_DATABASE_TESTING}} | |
ports: | |
- 5432:5432 | |
options: >- | |
--health-cmd pg_isready | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
runs-on: ubuntu-latest | |
steps: | |
- name: initialize github actions | |
uses: actions/checkout@v2 | |
- name: install python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: "3.10" | |
- name: update pip | |
run: python -m pip install --upgrade pip | |
- name: install dependencies | |
run: pip install -r requirements.txt | |
- name: test | |
run: | | |
pip install pytest | |
pytest | |
deploy: | |
needs: [ build ] | |
environment: | |
name: prod | |
env: | |
DB_HOST: ${{secrets.DB_HOST}} | |
DB_PORT: ${{secrets.DB_PORT}} | |
DB_PASSWORD: ${{secrets.DB_PASSWORD}} | |
DB_DATABASE: ${{secrets.DB_DATABASE}} | |
DB_DATABASE_TESTING: ${{secrets.DB_DATABASE_TESTING}} | |
DB_USER: ${{secrets.DB_USER}} | |
AUTH_SECRET_KEY: ${{secrets.AUTH_SECRET_KEY}} | |
AUTH_ALGORITHM: ${{secrets.AUTH_ALGORITHM}} | |
ACCESS_TOKEN_EXPIRE_MINUTES: ${{secrets.ACCESS_TOKEN_EXPIRE_MINUTES}} | |
MAIL_SERVICE_URL: ${{secrets.MAIL_SERVICE_URL}} | |
MAIL_SERVICE_API_KEY: ${{secrets.MAIL_SERVICE_API_KEY}} | |
API_URL: ${{secrets.API_URL}} | |
SYMPTOM_SERVICE_URL: ${{secrets.SYMPTOM_SERVICE_URL}} | |
runs-on: ubuntu-latest | |
permissions: | |
id-token: write #This is required for requesting the OIDC JWT Token | |
steps: | |
- name: Checkout to the branch | |
uses: actions/checkout@v2 | |
- name: Azure Login | |
uses: azure/login@v1 | |
with: | |
client-id: ${{ secrets.HEALTHMATEAPI_AZURE_CLIENT_ID }} | |
tenant-id: ${{ secrets.HEALTHMATEAPI_AZURE_TENANT_ID }} | |
subscription-id: ${{ secrets.HEALTHMATEAPI_AZURE_SUBSCRIPTION_ID }} | |
- name: Build and push container image to registry | |
uses: azure/container-apps-deploy-action@v1 | |
with: | |
appSourcePath: ${{ github.workspace }} | |
registryUrl: jtmarilao.azurecr.io | |
registryUsername: ${{ secrets.HEALTHMATEAPI_REGISTRY_USERNAME }} | |
registryPassword: ${{ secrets.HEALTHMATEAPI_REGISTRY_PASSWORD }} | |
containerAppName: healthmate-api | |
resourceGroup: capstone | |
imageToBuild: jtmarilao.azurecr.io/healthmate-api:latest | |
dockerfilePath: Dockerfile |