Skip to content

Implemented basic CI workflow #10

Implemented basic CI workflow

Implemented basic CI workflow #10

Workflow file for this run

name: CI

Check failure on line 1 in .github/workflows/ci.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/ci.yml

Invalid workflow file

(Line: 9, Col: 5): Unexpected value 'jobs', (Line: 45, Col: 31): Unrecognized named-value: 'github'. Located at position 1 within expression: github.actor, (Line: 46, Col: 31): Unrecognized named-value: 'secrets'. Located at position 1 within expression: secrets.GITHUB_TOKEN, (Line: 51, Col: 24): Unrecognized named-value: 'github'. Located at position 1 within expression: github.repository_owner, (Line: 1, Col: 1): Required property is missing: jobs
on:
push:
branches: ["*"]
pull_request:
branches: ["*"]
jobs:
build-and-test:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
# Get code
- name: Checkout repository
uses: actions/checkout@v4
# Set up Python
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11"
# Install dependencies
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r backend/requirements.txt
# Run tests
# - name: Run tests
# run: |
# pytest backend/tests/
# Log in to Github Container Registry
- name: Log in to GHCR
if: github.ref == 'refs/heads/main'
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
# Build and push Docker image (for main only)
- name: Build and push Docker image
if: github.ref == 'refs/heads/main'
run: |
IMAGE_NAME=ghcr.io/${{ github.repository_owner }}/eventrelay
IMAGE_TAG=${{ github.sha }}
docker build \
-f backend/Dockerfile \
-t $IMAGE_NAME:latest \
-t $IMAGE_NAME:$IMAGE_TAG \
backend
docker push $IMAGE_NAME:latest
docker push $IMAGE_NAME:$IMAGE_TAG