Scheduler Domain #98
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: Scheduler Domain | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- main | |
paths: | |
- "scheduler/**" | |
schedule: | |
- cron: "0 22 * * *" # At 22:00. | |
env: | |
DEBUG: false | |
jobs: | |
migrate: | |
name: Run Database Migrations | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: superfly/flyctl-actions/setup-flyctl@master | |
- run: flyctl proxy 5432:5432 -a checkstatusgovbr-db &> /dev/null & | |
env: | |
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }} | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: "3.10" | |
- name: Execute alembic migrations | |
run: | | |
pip install -U pip | |
pip install poetry | |
poetry install | |
poetry run alembic upgrade head | |
working-directory: api | |
env: | |
POETRY_VIRTUALENVS_CREATE: false | |
DATABASE_URL: ${{ secrets.DATABASE_URL }} | |
availability: | |
needs: migrate | |
name: Run Availability Domains | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: superfly/flyctl-actions/setup-flyctl@master | |
- run: flyctl proxy 5432:5432 -a checkstatusgovbr-db &> /dev/null & | |
env: | |
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }} | |
- uses: actions/checkout@v2 | |
- name: Set up Node.js | |
uses: actions/setup-node@v2 | |
with: | |
node-version: "20.x" | |
- name: Install Dependencies | |
run: yarn install | |
- name: Execute ping | |
run: yarn start ping | |
working-directory: scheduler | |
env: | |
DATABASE_URL: ${{ secrets.DATABASE_URL }} | |
update_cancelled_domains: | |
needs: migrate | |
name: Update Cancelled Domains | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: superfly/flyctl-actions/setup-flyctl@master | |
- run: flyctl proxy 5432:5432 -a checkstatusgovbr-db &> /dev/null & | |
env: | |
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }} | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: "3.10" | |
- name: Execute update_cancelled_domains | |
run: | | |
pip install -U pip | |
pip install poetry | |
poetry install | |
python src/main.py update_cancelled_domains | |
working-directory: scheduler_py | |
env: | |
POETRY_VIRTUALENVS_CREATE: false | |
DATABASE_URL: ${{ secrets.DATABASE_URL }} | |
PYTHONPATH: ../ |