Skip to content

Add tests and move formatting to api level (#8) #10

Add tests and move formatting to api level (#8)

Add tests and move formatting to api level (#8) #10

Workflow file for this run

name: Backend
on:
push:
branches:
- "*"
pull_request:
branches:
- "*"
types:
- closed
workflow_dispatch:
jobs:
lint_format:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.10
uses: actions/setup-python@v4
with:
python-version: "3.10"
- name: Install Python dependencies
working-directory: ./backend/src
run: |
python -m pip install --upgrade pip
pip install -r requirements-dev.txt
- name: Format check
working-directory: ./backend/src
run: make fmt-check
- name: Isort check
working-directory: ./backend/src
run: make isort-check
- name: Pylint
working-directory: ./backend/src
run: make pylint
test:
runs-on: ubuntu-latest
steps:
- run: echo "event name is:" ${{ github.event_name }}
- run: echo "event type is:" ${{ github.event.action }}
- uses: actions/checkout@v3
- name: Set up Python 3.10
uses: actions/setup-python@v4
with:
python-version: "3.10"
- name: Install deps
working-directory: ./backend/src
run: |
pip install -r requirements.txt
pip install -r requirements-dev.txt
- name: Test
working-directory: ./backend/src
run: |
make test-cov-ci
- name: Pytest coverage comment
uses: MishaKav/pytest-coverage-comment@main
with:
pytest-coverage-path: src/pytest-coverage.txt
junitxml-path: src/pytest.xml
aws_cdk:
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main'
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.10
uses: actions/setup-python@v4
with:
python-version: "3.10"
- name: Set up Node
uses: actions/setup-node@v3
with:
node-version: "18"
- name: Install Python dependencies and CDK
working-directory: ./backend
run: |
python -m pip install --upgrade pip
npm install -g aws-cdk
pip install -r requirements.txt
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@master
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: "eu-west-2"
- name: CDK deploy
working-directory: ./backend
env:
AWS_ACCOUNT: ${{ secrets.AWS_ACCOUNT }}
AWS_REGION: ${{ secrets.AWS_REGION }}
run: cdk deploy ServerlessBackendStack --parameters uploadBucketName=froodom-frontend --require-approval=never