2024 new data (csv-files) #112
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 & dev deploy' | |
on: | |
push: | |
branches-ignore: | |
- main | |
paths: | |
- 'api/**' | |
- 'Dockerfile' | |
- '.dockerignore' | |
- '.github/workflows/api-test-deploy-dev.yml' | |
env: | |
AZURE_ACR_NAME: sykeprtrdevacr.azurecr.io # set separately to jobs.tests.container.image | |
AZURE_WEBAPP_NAME: syke-prtr-fastapi-d-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-dev: | |
name: Build & deploy dev | |
if: github.ref == 'refs/heads/dev' | |
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.DEV_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 |