Fix CI/CD #197
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 | |
jobs: | |
checks: | |
runs-on: ubuntu-latest | |
container: python:3.12 | |
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@v2 | |
- 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@v1 | |
with: | |
path: ~/.local/share/virtualenvs | |
key: ${{ runner.os }}-pipenv-${{ hashFiles('**/Pipfile.lock') }} | |
- name: Install dependencies | |
if: steps.cache-pipenv.outputs.cache-hit != 'true' | |
run: | | |
pipenv install --system --deploy --dev | |
- name: Run Linters and Checks | |
run: | | |
pre-commit run --all | |
- name: Run tests | |
run: | | |
pytest --cov=src | |
build_and_publish: | |
runs-on: ubuntu-latest | |
needs: [checks] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Build and publish app | |
uses: openzim/docker-publish-action@v6 | |
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 }} |