Skip to content

feat: Add project documentation, CI/CD workflows, and update Grafana … #20

feat: Add project documentation, CI/CD workflows, and update Grafana …

feat: Add project documentation, CI/CD workflows, and update Grafana … #20

Workflow file for this run

name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
test:
runs-on: ubuntu-latest
services:
postgres:
image: postgres:16-alpine
env:
POSTGRES_USER: observakit
POSTGRES_PASSWORD: test
POSTGRES_DB: observakit_test
ports:
- 5432:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Install dependencies
run: |
pip install -r backend/requirements.txt
pip install pytest pytest-cov ruff
- name: Lint with ruff
run: ruff check .
- name: Run tests
env:
METADATA_DB_HOST: localhost
METADATA_DB_PORT: 5432
METADATA_DB_USER: observakit
METADATA_DB_PASSWORD: test
METADATA_DB_NAME: observakit_test
run: |
PYTHONPATH=. pytest tests/ -v --cov=backend --cov-report=xml
- name: Upload coverage
uses: codecov/codecov-action@v4
if: always()
with:
file: ./coverage.xml
fail_ci_if_error: false
docker:
runs-on: ubuntu-latest
needs: test
steps:
- uses: actions/checkout@v4
- name: Validate Docker Compose
run: docker compose config --quiet
- name: Build backend image
run: docker compose build backend
release:
runs-on: ubuntu-latest
needs: [test, docker]
if: github.ref == 'refs/heads/main' && github.event_name == 'push' && !contains(github.event.head_commit.message, '[skip ci]')
permissions:
contents: write
steps:
- uses: actions/checkout@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Bump Version
run: |
chmod +x scripts/bump_version.sh
./scripts/bump_version.sh
- name: Commit and Push
run: |
git config --global user.name 'github-actions[bot]'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
git add VERSION
git commit -m "chore: bump version to $(cat VERSION) [skip ci]"
git push