Fix CI/CD #200
Workflow file for this run
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: CI/CD | |
on: | |
pull_request: | |
types: [opened, synchronize, reopened] | |
push: | |
branches: | |
- main | |
env: | |
DATABASE_URL: postgres://postgres:postgres@postgres:5432/test | |
APP_ENV: 🛠 | |
GITHUB_CLIENT_ID: test | |
GITHUB_CLIENT_SECRET: test | |
LINKEDIN_CLIENT_ID: test | |
LINKEIN_CLIENT_SECRET: test | |
MINIO_ACCESS_KEY: test | |
MINIO_SECRET_KEY: test | |
PIPENV_VENV_IN_PROJECT: 1 | |
jobs: | |
checks: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: pre-commit/action@v3.0.0 | |
tests: | |
runs-on: ubuntu-latest | |
container: python:3.12 | |
needs: [checks] | |
services: | |
postgres: | |
image: postgres | |
env: | |
POSTGRES_PASSWORD: postgres | |
POSTGRES_USER: postgres | |
POSTGRES_DB: test | |
options: >- | |
--health-cmd pg_isready | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install system dependencies | |
run: apt-get install -y libpq-dev | |
- name: Install pipenv | |
run: | | |
python -m pip install --upgrade pip pipenv wheel | |
- id: cache-pipenv | |
uses: actions/cache@v3 | |
with: | |
path: .venv | |
key: pipenv-${{ hashFiles('**/Pipfile.lock') }} | |
- name: Install dependencies | |
if: steps.cache-pipenv.outputs.cache-hit != 'true' | |
run: | | |
pipenv install --deploy --dev | |
- name: Run tests | |
run: | | |
pipenv run pytest --cov=src | |
build_and_publish: | |
runs-on: ubuntu-latest | |
needs: [tests] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Build and publish app | |
uses: openzim/docker-publish-action@v10 | |
with: | |
image-name: collinmutembei/people | |
on-master: latest | |
latest-on-tag: true | |
restrict-to: collinmutembei/people | |
registries: | | |
ghcr.io | |
credentials: | | |
GHCRIO_USERNAME=${{ github.repository_owner }} | |
GHCRIO_TOKEN=${{ secrets.CR_PAT }} | |
build-args: | | |
PROJECT_VERSION=latest | |
COMMIT_ID=${{ github.sha }} |