Skip to content

More styling work

More styling work #266

Workflow file for this run

name: Deployment
on:
push:
branches:
- main
- staging
jobs:
flake8-lint:
runs-on: ubuntu-latest
name: Lint
steps:
- name: Check out source repository
uses: actions/checkout@v2
- name: Set up Python environment
uses: actions/setup-python@v1
with:
python-version: "3.10"
- name: flake8 Lint
uses: py-actions/flake8@v1
with:
# ignore: "F401"
# exclude: "src/ignoreme.py"
max-line-length: "120"
path: "./"
pytest:
runs-on: ubuntu-latest
needs: flake8-lint
name: Unit Tests
env:
POLYGONSCAN_API_KEY: ${{ secrets.POLYGONSCAN_API_KEY }}
WEB3_INFURA_PROJECT_ID: ${{ secrets.WEB3_INFURA_PROJECT_ID }}
PREFECT_API_KEY: ${{ secrets.PREFECT_API_KEY }}
PREFECT_API_URL: ${{ secrets.PREFECT_API_URL }}
PYTHONUNBUFFERED: 1
steps:
- name: Check out source repository
uses: actions/checkout@v2
- name: Set up Python environment
uses: actions/setup-python@v1
with:
python-version: "3.10"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements1.txt -r requirements2.txt
# - name: Run tests with pytest
# run: pytest
- name: Run smoketest
run: bash scripts/smoketest.sh
build-docker:
name: Build Docker image
environment: ${{ github.ref_name }}
runs-on: ubuntu-latest
needs: pytest
steps:
- name: Check out source repository
uses: actions/checkout@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Install doctl
uses: digitalocean/action-doctl@v2
with:
token: ${{ secrets.DIGITALOCEAN_ACCESS_TOKEN }}
- name: Log in to DO Container Registry
run: doctl registry login --expiry-seconds 600
- name: Build and push
uses: docker/build-push-action@v2
with:
context: .
file: ./Dockerfile
push: true
tags: registry.digitalocean.com/${{ secrets.DIGITALOCEAN_CONTAINER_REPO }}/dash-apps:${{ github.sha }}
cache-from: type=gha
cache-to: type=gha
target: prod
deploy:
name: Deploy Digital Ocean App
environment: ${{ github.ref_name }}
runs-on: ubuntu-latest
needs: build-docker
env:
POLYGONSCAN_API_KEY: ${{ secrets.POLYGONSCAN_API_KEY }}
WEB3_INFURA_PROJECT_ID: ${{ secrets.WEB3_INFURA_PROJECT_ID }}
GITHUB_SHA: ${{ github.sha }}
DIGITALOCEAN_APP_NAME: ${{ secrets.DIGITALOCEAN_APP_NAME }}
DIGITALOCEAN_APP_DOMAIN: ${{ secrets.DIGITALOCEAN_APP_DOMAIN }}
DIGITALOCEAN_APP_DOMAIN_ALIAS: ${{ vars.DIGITALOCEAN_APP_DOMAIN_ALIAS }}
DIGITALOCEAN_SIZE_SLUG: ${{ vars.DIGITALOCEAN_SIZE_SLUG }}
PREFECT_API_KEY: ${{ secrets.PREFECT_API_KEY }}
PREFECT_API_URL: ${{ secrets.PREFECT_API_URL }}
ENV: ${{ secrets.ENV }}
GUNICORN_TIMEOUT: ${{ vars.GUNICORN_TIMEOUT }}
steps:
- name: Check out source repository
uses: actions/checkout@v2
# TODO update doctl to use 2fcbadcb46efd8dca0d93fbef2a3a8394f5981ba with the error code fix
- name: Install doctl
uses: digitalocean/action-doctl@v2
with:
token: ${{ secrets.DIGITALOCEAN_ACCESS_TOKEN }}
- name: Install envsubst
run: make install_envsubst
- name: Replace variables
run: make replace_variables
- name: Upsert app
uses: nick-fields/retry@v2
with:
timeout_minutes: 60
max_attempts: 10
command: doctl apps update ${{ secrets.DIGITALOCEAN_APP_ID }} --spec app-spec.yml --wait --verbose