add ui testing to pipeline #50
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
# Docs for the Azure Web Apps Deploy action: https://github.com/Azure/webapps-deploy | |
# More GitHub Actions for Azure: https://github.com/Azure/actions | |
name: Deploy Stack | |
on: | |
push: | |
branches: | |
- "main" | |
workflow_dispatch: | |
env: | |
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }} | |
jobs: | |
test-api: | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Test api | |
working-directory: ./catchemall/web-api | |
run: ./test.sh | |
test-ui: | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Test api | |
working-directory: ./catchemall/ui | |
run: ./test.sh | |
build-push-api: | |
needs: test-api | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Log in to registry | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ secrets.CONTAINER_USERNAME }} | |
password: ${{ secrets.CONTAINER_PASSWORD }} | |
- name: Web Api - Build and Push | |
uses: docker/build-push-action@v3 | |
with: | |
push: true | |
tags: ${{ secrets.REPOSITORY_NAME }}/catchemall-api:${{ github.sha }}, ${{ secrets.REPOSITORY_NAME }}/catchemall-api | |
context: ./catchemall/web-api | |
file: ./catchemall/web-api/Dockerfile | |
build-push-ui: | |
runs-on: ubuntu-22.04 | |
needs: test-ui | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Log in to registry | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ secrets.CONTAINER_USERNAME }} | |
password: ${{ secrets.CONTAINER_PASSWORD }} | |
- name: UI - Build and Push | |
uses: docker/build-push-action@v3 | |
with: | |
push: true | |
tags: ${{ secrets.REPOSITORY_NAME }}/catchemall-ui:${{ github.sha }}, ${{ secrets.REPOSITORY_NAME }}/catchemall-ui | |
context: ./catchemall/ui | |
file: ./catchemall/ui/Dockerfile | |
deploy: | |
needs: [build-push-api, build-push-ui] | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: superfly/flyctl-actions/setup-flyctl@master | |
- name: Log in to registry | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ secrets.CONTAINER_USERNAME }} | |
password: ${{ secrets.CONTAINER_PASSWORD }} | |
- run: | | |
docker pull ${{ secrets.REPOSITORY_NAME }}/catchemall-ui:${{ github.sha }} | |
docker pull ${{ secrets.REPOSITORY_NAME }}/catchemall-api:${{ github.sha }} | |
- name: deploy ui | |
run: | | |
flyctl deploy --image ${{ secrets.REPOSITORY_NAME }}/catchemall-ui:${{ github.sha }} \ | |
--local-only catchemall/ui \ | |
--image-label ${{ github.ref_name }} | |
- name: deploy webapi | |
run: | | |
flyctl deploy --image ${{ secrets.REPOSITORY_NAME }}/catchemall-api:${{ github.sha }} \ | |
--local-only catchemall/web-api \ | |
--image-label ${{ github.ref_name }} |