name: divina test

on:
  push:
    branches:
      - test
jobs:
  lint:
    environment: test
    runs-on: ubuntu-latest
    container: jhurdle/divina:test
    steps:
      - uses: actions/checkout@v2
      - name: Set up Python ${{ matrix.python-version }}
        uses: actions/setup-python@v2
        with:
          python-version: ${{ matrix.python-version }}
      - name: Lint with flake8
        run: |
          # stop the build if there are Python syntax errors or undefined names
          flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
          # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
          flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
  test:
    environment: test
    runs-on: ubuntu-latest
    container: jhurdle/divina:test
    steps:
      - uses: actions/checkout@v2
      - name: Set up Python ${{ matrix.python-version }}
        uses: actions/setup-python@v2
        with:
          python-version: ${{ matrix.python-version }}
      - name: Test with pytest
        run: |
          python3 -m pytest
        env:
          AWS_ACCESS_KEY_ID: '${{ secrets.AWS_ACCESS_KEY_ID }}'
          AWS_SECRET_ACCESS_KEY: '${{ secrets.AWS_SECRET_ACCESS_KEY }}'
          AWS_DEFAULT_REGION: '${{ secrets.AWS_DEFAULT_REGION }}'
          ACCOUNT_NUMBER: '${{ secrets.ACCOUNT_NUMBER }}'