Cognito authentication #11
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
name: API Test and deploy | |
on: | |
push: | |
paths: | |
- 'services/tasks_api/**' | |
- '.github/workflows/api.yml' | |
env: # new | |
SERVERLESS_ACCESS_KEY: ${{ secrets.SERVERLESS_ACCESS_KEY }} | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
AWS_DEFAULT_REGION: eu-west-1 | |
APP_ENVIRONMENT: development | |
jobs: | |
test: | |
strategy: | |
fail-fast: false | |
matrix: | |
python-version: [3.11] | |
poetry-version: [1.3.2] | |
os: [ubuntu-latest] | |
runs-on: ${{ matrix.os }} | |
defaults: | |
run: | |
working-directory: services/tasks_api | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-python@v3 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install poetry | |
uses: abatilo/[email protected] | |
with: | |
poetry-version: ${{ matrix.poetry-version }} | |
- name: Install dependencies | |
run: poetry install --no-root | |
- name: Run tests | |
run: poetry run pytest tests.py --cov=./ --cov-report=xml | |
- name: Upload coverage to Codecov | |
uses: codecov/codecov-action@v3 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
code-quality: | |
strategy: | |
fail-fast: false | |
matrix: | |
python-version: [3.11] | |
poetry-version: [1.3.2] | |
os: [ubuntu-latest] | |
runs-on: ${{ matrix.os }} | |
defaults: | |
run: | |
working-directory: services/tasks_api | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-python@v3 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install poetry | |
uses: abatilo/[email protected] | |
with: | |
poetry-version: ${{ matrix.poetry-version }} | |
- name: Install dependencies | |
run: poetry install --no-root | |
- name: Run black | |
run: poetry run black . --check | |
- name: Run isort | |
run: poetry run isort . --check-only | |
- name: Run flake8 | |
run: poetry run flake8 . | |
- name: Run bandit | |
run: poetry run bandit . | |
deploy-development: # new | |
needs: [ test, code-quality ] | |
strategy: | |
fail-fast: false | |
matrix: | |
python-version: [3.11] | |
poetry-version: [1.3.2] | |
node-version: [18] | |
os: [ubuntu-latest] | |
runs-on: ${{ matrix.os }} | |
defaults: | |
run: | |
working-directory: services/tasks_api | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@v3 | |
- name: Set up Python 3.9 | |
uses: actions/setup-python@v3 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install poetry | |
uses: abatilo/[email protected] | |
with: | |
poetry-version: ${{ matrix.poetry-version }} | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ matrix.node-version }} | |
- name: Install Serverless Framework | |
run: npm install -g serverless | |
- name: Install NPM dependencies | |
run: npm install | |
- name: Deploy | |
run: sls deploy --stage development --verbose |