Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 0 additions & 44 deletions .github/workflows/build-and-push.yml

This file was deleted.

59 changes: 59 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: CI Pipeline

on:
push:
branches: [ '**' ] # На все пуши (включая main)
pull_request:
branches: [ main ] # На PR в main

permissions:
contents: read
packages: write # нужно для Docker push в GHCR

jobs:
test:
name: Run Pytest
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.12'

- name: Install dependencies
run: |
pip install -r requirements.txt
pip install pytest

- name: Run tests
run: pytest

docker:
name: Build and push Docker image
runs-on: ubuntu-latest
needs: test # Выполняется только если тесты прошли
if: github.event_name == 'pull_request'
steps:
- uses: actions/checkout@v4

- name: Log in to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Set lowercase owner
id: vars
run: |
OWNER_LC=$(echo "${GITHUB_REPOSITORY%/*}" | tr '[:upper:]' '[:lower:]')
echo "owner=${OWNER_LC}" >> "$GITHUB_OUTPUT"

- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: ghcr.io/${{ steps.vars.outputs.owner }}/science-helper:latest
45 changes: 0 additions & 45 deletions .github/workflows/tests-and-merge.yml

This file was deleted.