This repository has been archived by the owner on Dec 26, 2023. It is now read-only.
fix(deps): update beta #108
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: Run tests on any Push event | |
on: | |
pull_request: | |
branches: | |
- "main" | |
jobs: | |
skip-draft: | |
name: skip draft | |
runs-on: ubuntu-latest | |
timeout-minutes: 1 | |
steps: | |
- name: fail on draft | |
if: github.event.pull_request.draft == true | |
run: echo "is a draft PR, failing..." && exit 1 | |
- name: success | |
run: echo "is not a draft PR" | |
lint: | |
needs: skip-draft | |
runs-on: ubuntu-latest | |
container: "python:3.10.8-slim" | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/cache@v3 | |
with: | |
path: '**/.venv' | |
key: ${{ runner.os }}-modules-${{ hashFiles('**/poetry.lock') }} | |
- name: Install poetry | |
run: pip install poetry==1.2.0 | |
- name: Check dependencies | |
run: poetry lock --check | |
- name: Add poe (cli helper) | |
run: poetry self add 'poethepoet[poetry_plugin]' | |
- name: Install dependencies | |
run: poetry install | |
- name: Check code format (PEP8) | |
run: poe format:check | |
- name: Check import order (PEP8) | |
run: poe isort:check | |
- name: Analysing the code with pylint | |
run: poe lint:check | |
test: | |
env: | |
DATABASE_HOST: postgres | |
needs: skip-draft | |
runs-on: ubuntu-latest | |
container: "python:3.10.8-slim" | |
services: | |
# Label used to access the service container | |
postgres: | |
# Docker Hub image | |
image: postgres:15.1 | |
# Provide the password for postgres | |
env: | |
POSTGRES_DB: oipie_tests | |
POSTGRES_PASSWORD: password | |
POSTGRES_USER: oipie | |
# Set health checks to wait until postgres has started | |
ports: | |
- 5432:5432 | |
options: >- | |
--health-cmd pg_isready | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/cache@v3 | |
with: | |
path: '**/.venv' | |
key: ${{ runner.os }}-modules-${{ hashFiles('**/poetry.lock') }} | |
- name: Install poetry | |
run: pip install poetry==1.2.0 | |
- name: Check dependencies | |
run: poetry lock --check | |
- name: Add poe (cli helper) | |
run: poetry self add 'poethepoet[poetry_plugin]' | |
- name: Install dependencies | |
run: poetry install | |
- name: Run migrations | |
run: poe migration:test:up | |
- name: Run tests | |
run: poe test | |
docker-build: | |
needs: skip-draft | |
name: Build Docker Container | |
runs-on: ubuntu-latest | |
timeout-minutes: 5 | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Build and push docker image | |
uses: docker/[email protected] | |
with: | |
context: . | |
file: ./Dockerfile | |
push: false | |
tags: api-core:latest |