Skip to content

DX Copilot

DX Copilot #139

Workflow file for this run

name: Build, deploy, test
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
test:
name: test
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Build and test
timeout-minutes: 10
run: |
echo ${{ github.sha }} > commit.txt
docker build -t ai-ml-web:latest -f ./Dockerfile-web .
docker swarm init
docker stack deploy ai-ml -c docker-compose.yml --prune
until [ $(docker inspect -f "{{json .State.Status }}" $(docker ps -a -q --filter ancestor=ai-ml-web --format="{{.ID}}" | head -n 1)) == '"running"' ]; do echo "Waiting for container to start..." && sleep 1; done
docker container exec -i $(docker ps -f name=ai-ml_web --format "{{.ID}}") pytest web
- uses: superfly/flyctl-actions/setup-flyctl@master
if: ${{ github.ref == 'refs/heads/main' }}
- name: Deploy to fly.io
timeout-minutes: 10
if: ${{ github.ref == 'refs/heads/main' }}
env:
FLY_API_TOKEN: ${{ secrets.FLY_ACCESS_TOKEN }}
run: flyctl deploy --local-only -i ai-ml-web:latest