Skip to content

test: add transport layer tests with ASGI mocking #1

test: add transport layer tests with ASGI mocking

test: add transport layer tests with ASGI mocking #1

Workflow file for this run

name: CI/CD Pipeline
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
env:
REGISTRY: ghcr.io
# github.repository as <account>/<repo>
IMAGE_NAME: ${{ github.repository }}
jobs:
# Job 1: Run Unit Tests
test:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python 3.11
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Run Tests
env:
AGILEDAY_TENANT_ID: "test-tenant"
AGILEDAY_API_TOKEN: "test-token"
run: pytest tests/
# Job 2: Build and Push Docker Image to GHCR
build-and-push:
needs: test
runs-on: ubuntu-latest
# Only run this job on push to main, not on pull requests
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
# PERMISSIONS are required for GHCR to write packages
permissions:
contents: read
packages: write
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
# This step ensures the image name is lowercase (required by GHCR)
- name: Lowercase Image Name
run: |
echo "IMAGE_NAME=${IMAGE_NAME,,}" >>${GITHUB_ENV}
- name: Build and push
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest