Build data unificado #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
# This workflow will install Python dependencies, run tests and lint with a single version of Python | |
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python | |
name: Build data unificado | |
on: | |
push: | |
branches: [ "feature-unificado" ] | |
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: feature-unificada | |
- name: Set up Python 3.10 unificado | |
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 unificado.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_unificado.json | |
curl -s -H "Authorization: Bearer 1" http://localhost:5000/area/ > gob_area_unificado.json | |
curl -s -H "Authorization: Bearer 1" http://localhost:5000/party/ > gob_party_unificado.json | |
curl -s -H "Authorization: Bearer 1" http://localhost:5000/chamber/ > gob_chamber_unificado.json | |
curl -s -H "Authorization: Bearer 1" http://localhost:5000/contest/ > gob_contest_unificado.json | |
curl -s -H "Authorization: Bearer 1" http://localhost:5000/coalition/ > gob_coalition_unificado.json | |
curl -s -H "Authorization: Bearer 1" http://localhost:5000/membership/ > gob_membership_unificado.json | |
curl -s -H "Authorization: Bearer 1" http://localhost:5000/role/ > gob_role_unificado.json | |
curl -s -H "Authorization: Bearer 1" http://localhost:5000/person/ > gob_person_unificado.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_unificado-${{steps.date.outputs.DATE}} | |
path: | | |
gob_*.json | |
bridge/Documentacion_API_2024.pdf | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: gob_csv-elecciones_unificado-${{steps.date.outputs.DATE}} | |
path: | | |
./bridge/csv_db/*.csv | |
bridge/Documentacion_API_2024.pdf | |