linter things #49
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: Check and Build | |
on: | |
- push | |
- pull_request | |
jobs: | |
test_and_lint: | |
runs-on: ubuntu-latest | |
env: | |
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | |
POSTGRES_PASSWORD: postgres | |
POSTGRES_USER: postgres | |
POSTGRES_SERVER: localhost:5432 | |
POSTGRES_DB: test | |
defaults: | |
run: | |
working-directory: . | |
services: | |
db: | |
image: postgres:15.1-alpine | |
ports: | |
- '5432:5432' | |
env: | |
POSTGRES_PASSWORD: postgres | |
POSTGRES_USER: postgres | |
POSTGRES_DB: test | |
options: >- | |
--health-cmd pg_isready | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
strategy: | |
matrix: | |
python-version: [3.11] | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v3 | |
with: | |
python-version: ${{ matrix.python-version }} | |
# FIX: rye in ci | |
# - name: Setup Rye | |
# run: pip install rye | |
- name: Install dependencies | |
run: pip install --no-cache-dir -r requirements-dev.lock | |
- name: Apply migrations | |
run: alembic upgrade head | |
- name: Run check | |
run: ruff check | |
# - name: Upload coverage to Codecov | |
# uses: codecov/codecov-action@v3 | |
# with: | |
# file: ./coverage.xml | |
# fail_ci_if_error: true | |
build: | |
needs: test_and_lint | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Login to Docker Hub | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Build and push backend | |
uses: docker/build-push-action@v4 | |
with: | |
context: . | |
file: ./docker/backend/Dockerfile | |
push: true | |
tags: ${{ secrets.DOCKERHUB_USERNAME }}/bibliograph-back:latest | |
# - name: Build and push frontend | |
# uses: docker/build-push-action@v4 | |
# with: | |
# context: . | |
# file: ./docker/frontend/Dockerfile | |
# push: true | |
# tags: ${{ secrets.DOCKERHUB_USERNAME }}/bibliograph-front:latest |