Skip to content

Build data unificado #46

Build data unificado

Build data unificado #46

Workflow file for this run

name: Build data mexico
on:
push:
branches: [ "mexico" ]
pull_request:
branches: [ "main" ]
workflow_dispatch:
permissions:
contents: read
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
path: bridge
- uses: actions/checkout@v4
with:
repository: abrimos-info/api-politica
path: api
ref: mexico
- name: Set up Python 3.10
uses: actions/setup-python@v3
with:
python-version: "3.10"
- name: Install dependencies
run: |
cd bridge
python -m pip install --upgrade pip
echo "pip"
pip install -r requirements.txt
mkdir csv_db_officeholders
mkdir deleted
echo '${{ secrets.GCP_CREDENTIALS }}' > credentials.json
echo { \"token_type\": \"Bearer\", \"token_value\": \"1\" } > token.json
- name: Start api-politica
run: |
# stop the build if there are Python syntax errors or undefined names
cd api
echo "pip api"
pip install -r requirements.txt
echo { \"token_type\": \"Bearer\", \"token_value\": \"1\" } > token.json
python db_create.py 1 && python application.py &
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
cd ..
- name: Correr pipeline de carga de bridge a api
run: |
cd bridge
python pipeline.py local mexico2024.json
- name: Exportar datos de api a json
run: |
echo "Export"
curl -s -H "Authorization: Bearer 1" http://localhost:5000/export-min/ > gob_export_min_mx.json
curl -s -H "Authorization: Bearer 1" http://localhost:5000/area/ > gob_area_mx.json
curl -s -H "Authorization: Bearer 1" http://localhost:5000/party/ > gob_party_mx.json
curl -s -H "Authorization: Bearer 1" http://localhost:5000/chamber/ > gob_chamber_mx.json
curl -s -H "Authorization: Bearer 1" http://localhost:5000/contest/ > gob_contest_mx.json
curl -s -H "Authorization: Bearer 1" http://localhost:5000/coalition/ > gob_coalition_mx.json
curl -s -H "Authorization: Bearer 1" http://localhost:5000/membership/ > gob_membership_mx.json
curl -s -H "Authorization: Bearer 1" http://localhost:5000/role/ > gob_role_mx.json
curl -s -H "Authorization: Bearer 1" http://localhost:5000/person/ > gob_person_mx.json
- name: Get current date
run: |
echo "DATE=$(date +'%Y-%m-%d')" >> $GITHUB_OUTPUT
id: "date"
- uses: actions/upload-artifact@v4
with:
name: gob_json-elecciones_mx-${{steps.date.outputs.DATE}}
path: |
gob_*.json
bridge/Documentacion_API_2024.pdf
- uses: actions/upload-artifact@v4
with:
name: gob_csv-elecciones_mx-${{steps.date.outputs.DATE}}
path: |
./bridge/csv_db/*.csv
bridge/Documentacion_API_2024.pdf