Add air-pollutant-map on new tab #47
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: 'API: tests & prod deploy' | |
on: | |
pull_request: | |
branches: | |
- main | |
push: | |
branches: | |
- main | |
paths: | |
- 'api/**' | |
- 'Dockerfile' | |
- '.dockerignore' | |
- '.github/workflows/api-test-deploy-prod.yml' | |
env: | |
AZURE_ACR_NAME: sykeprtrprodacr.azurecr.io # set separately to jobs.tests.container.image | |
AZURE_WEBAPP_NAME: syke-prtr-fastapi-p-cont | |
jobs: | |
tests: | |
name: Test API | |
runs-on: ubuntu-latest | |
container: | |
image: sykeprtrdevacr.azurecr.io/fin-prtr:tests | |
credentials: | |
username: ${{ secrets.PROD_AZURE_CREDENTIALS_CLIENT_ID }} | |
password: ${{ secrets.PROD_AZURE_CREDENTIALS_CLIENT_SECRET }} | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Test PRTR API | |
run: | | |
cd api/ | |
python -m pytest tests/ -vv | |
build-deploy-prod: | |
name: Build & deploy prod | |
if: github.ref == 'refs/heads/main' | |
runs-on: ubuntu-latest | |
needs: tests | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: azure/docker-login@v1 | |
with: | |
login-server: ${{ env.AZURE_ACR_NAME }} | |
username: ${{ secrets.PROD_AZURE_CREDENTIALS_CLIENT_ID }} | |
password: ${{ secrets.PROD_AZURE_CREDENTIALS_CLIENT_SECRET }} | |
- uses: azure/login@v1 | |
with: | |
creds: ${{ secrets.PROD_AZURE_CREDENTIALS }} | |
- name: Build & push image | |
run: | | |
docker build . \ | |
-t ${{ env.AZURE_ACR_NAME }}/fin-prtr:latest \ | |
-t ${{ env.AZURE_ACR_NAME }}/fin-prtr:${{ github.sha }} | |
docker push ${{ env.AZURE_ACR_NAME }}/fin-prtr:latest | |
docker push ${{ env.AZURE_ACR_NAME }}/fin-prtr:${{ github.sha }} | |
- name: 'Deploy to Azure WebApp' | |
uses: azure/webapps-deploy@v2 | |
with: | |
app-name: ${{ env.AZURE_WEBAPP_NAME }} | |
images: '${{ env.AZURE_ACR_NAME }}/fin-prtr:${{ github.sha }}' | |
- name: logout | |
run: | | |
az logout |