Skip to content
This repository was archived by the owner on Apr 29, 2026. It is now read-only.

Better log handling for student activity section #669

Better log handling for student activity section

Better log handling for student activity section #669

Workflow file for this run

name: Test, Build, and Push Images
on: [push, pull_request]
jobs:
ci_tests:
runs-on: ubuntu-latest
services:
mysql:
image: mysql:8.0
env:
MYSQL_ROOT_PASSWORD: testpass
MYSQL_DATABASE: materia_test
ports:
- 3306:3306
options: >-
--health-cmd="mysqladmin ping -h 127.0.0.1"
--health-interval=10s
--health-timeout=5s
--health-retries=5
steps:
- name: Checkout code
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 app/requirements.txt
- name: Run tests
working-directory: app
env:
MYSQL_HOST: 127.0.0.1
MYSQL_PORT: 3306
MYSQL_USER: root
MYSQL_PASSWORD: testpass
MYSQL_DATABASE: materia_test
BASE_URL: http://localhost
SESSION_DRIVER: db
run: python manage.py test
build_and_upload_images:
needs: ci_tests
if: startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-latest
permissions:
contents: write
packages: write
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Docker meta for Python
id: meta_python
uses: docker/metadata-action@v5
with:
images: ghcr.io/${{ github.repository_owner }}/materia-django/python
tags: |
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=sha
type=raw,value=dev,enable=${{ startsWith(github.ref, 'refs/tags/v') && (contains(github.ref, '-alpha') || contains(github.ref, '-rc')) }}
- name: Docker meta for Nginx
id: meta_nginx
uses: docker/metadata-action@v5
with:
images: ghcr.io/${{ github.repository_owner }}/materia-django/nginx
tags: |
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=sha
type=raw,value=dev,enable=${{ startsWith(github.ref, 'refs/tags/v') && (contains(github.ref, '-alpha') || contains(github.ref, '-rc')) }}
- name: Docker meta for FakeS3
id: meta_fakes3
uses: docker/metadata-action@v5
with:
images: ghcr.io/${{ github.repository_owner }}/materia-django/fakes3
tags: |
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=sha
type=raw,value=dev,enable=${{ startsWith(github.ref, 'refs/tags/v') && (contains(github.ref, '-alpha') || contains(github.ref, '-rc')) }}
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Create .env to satisfy build requirements
run: |
cd docker
if [ ! -f .env ]; then
touch .env
fi
- name: Build Images
run: |
cd docker
docker compose build --no-cache nginx python fakes3
- name: Tag and Push Python Images
run: |
cd docker
IMAGE_NAME=$(docker images --format "{{.Repository}}:{{.Tag}}" | grep "materia-django-python")
echo "${{ steps.meta_python.outputs.tags }}" | while IFS= read -r tag; do
[ -n "$tag" ] && docker tag "$IMAGE_NAME" "$tag" && docker push "$tag"
done
- name: Tag and Push Nginx Images
run: |
cd docker
IMAGE_NAME=$(docker images --format "{{.Repository}}:{{.Tag}}" | grep "materia-django-nginx")
echo "${{ steps.meta_nginx.outputs.tags }}" | while IFS= read -r tag; do
[ -n "$tag" ] && docker tag "$IMAGE_NAME" "$tag" && docker push "$tag"
done
- name: Tag and Push FakeS3 Images
run: |
cd docker
IMAGE_NAME=$(docker images --format "{{.Repository}}:{{.Tag}}" | grep -E "fakes3|fake-s3")
echo "${{ steps.meta_fakes3.outputs.tags }}" | while IFS= read -r tag; do
[ -n "$tag" ] && docker tag "$IMAGE_NAME" "$tag" && docker push "$tag"
done