Integración Continua y Despliegue Continuo 21-22

De Wiki de EGC
Revisión del 10:29 13 dic 2021 de Ajramirez (discusión | contribuciones) (Prerrequisitos)
Saltar a: navegación, buscar

Página_Principal -> 2021/2022 -> Prácticas - 21/22

Prerrequisitos

name: Python application

on: [push]

jobs:
  build:
    runs-on: ubuntu-latest

    services:
      postgres:
        image: postgres:10.8
        env:
          POSTGRES_USER: decide
          POSTGRES_PASSWORD: decide
          POSTGRES_DB: decide
        ports:
          - 5432:5432
        # needed because the postgres container does not provide a healthcheck
        options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5

    steps:
    - uses: actions/checkout@v1
    - name: Set up Python 3.8
      uses: actions/setup-python@v1
      with:
        python-version: 3.8
    - name: psycopg2 prerequisites
      run: sudo apt-get install libpq-dev
    - name: Install dependencies
      run: |
        python -m pip install --upgrade pip
        pip install -r requirements.txt
        pip install codacy-coverage
    - name: Run migrations
      run: cd decide;python manage.py migrate
    - name: Run tests     
      run: cd decide;coverage run --branch --source=. ./manage.py test census --keepdb; coverage xml;
    - name: Codacy Coverage Reporter
      uses: codacy/codacy-coverage-reporter-action@v1.1.0
      with:
          project-token: ${{ secrets.CODACY_PROJECT_TOKEN }}
          coverage-reports: decide/coverage.xml
  deploy:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v1
    - uses: akhileshns/heroku-deploy@v3.12.12 # This is the action
      with:
          heroku_api_key: ${{secrets.HEROKU_API_KEY}}
          heroku_app_name: " <<your app name>>"
          heroku_email: " <<your email>>"