66 lines
1.5 KiB
YAML
66 lines
1.5 KiB
YAML
name: CI/CD Pipeline
|
|
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
pull_request:
|
|
branches: [main]
|
|
|
|
jobs:
|
|
test:
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Set up Python
|
|
uses: actions/setup-python@v4
|
|
with:
|
|
python-version: "3.11"
|
|
|
|
- name: Install dependencies
|
|
run: |
|
|
python -m pip install --upgrade pip
|
|
pip install -r requirements.txt
|
|
|
|
- name: Run tests
|
|
run: |
|
|
python -m pytest tests/ -v
|
|
|
|
# - name: Run linting
|
|
# run: |
|
|
# python -m flake8 web/ tests/ --max-line-length=120
|
|
|
|
- name: Build Docker image
|
|
run: |
|
|
docker build -t jobs-app .
|
|
|
|
- name: Run container tests
|
|
run: |
|
|
docker run --rm jobs-app python -m pytest tests/ -v
|
|
|
|
- name: Push Docker image to gitea registry
|
|
uses: docker/build-push-action@v4
|
|
env:
|
|
REGISTRY_USERNAME: ${{ secrets.REGISTRY_USERNAME }}
|
|
REGISTRY_PASSWORD: ${{ secrets.REGISTRY_PASSWORD }}
|
|
with:
|
|
context: .
|
|
push: true
|
|
tags: git.allucanget.biz/allucanget/jobs:latest
|
|
|
|
# deploy:
|
|
# runs-on: ubuntu-latest
|
|
# needs: test
|
|
# if: github.ref == 'refs/heads/main'
|
|
|
|
# steps:
|
|
# - name: Checkout code
|
|
# uses: actions/checkout@v4
|
|
|
|
# - name: Deploy to production
|
|
# run: |
|
|
# echo "Deploying to production..."
|
|
# docker-compose up -d
|