Skip to content

馃 (chore): bump m2c to latest (#2073) #3338

馃 (chore): bump m2c to latest (#2073)

馃 (chore): bump m2c to latest (#2073) #3338

Workflow file for this run

name: PR
on:
push:
branches:
- main
pull_request:
jobs:
backend_test_docker_dev:
name: backend tests (docker dev container)
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v6
- name: Build decompme_backend image
run: |-
docker build backend --target dev -t decompme_backend
- name: Run tests
run: |-
sudo sysctl -w kernel.apparmor_restrict_unprivileged_unconfined=0
sudo sysctl -w kernel.apparmor_restrict_unprivileged_userns=0
# NOTE: CI does not run as 'ubuntu' user
export USER_1000=$(getent passwd 1000 | cut -d: -f1)
for dir in backend/.venv sandbox local_files compilers libraries; do
mkdir -p "$dir"
sudo chown "${USER_1000}:${USER_1000}" "$dir"
done
docker run \
-v $(pwd):/decomp.me \
-v $(pwd)/local_files:/local_files \
-v $(pwd)/compilers:/compilers \
-v $(pwd)/libraries:/libraries \
--security-opt apparmor=unconfined \
--security-opt seccomp=unconfined \
--cap-drop all \
--cap-add setuid \
--cap-add setgid \
--cap-add setfcap \
--tmpfs /sandbox/tmp:exec,uid=1000,gid=1000,size=64M,mode=0700 \
--entrypoint /bin/bash \
-e COMPILER_BASE_PATH=/compilers \
-e LIBRARY_BASE_PATH=/libraries \
-e LOCAL_FILE_DIR=/local_files \
-e USE_SANDBOX_JAIL=on \
-e SANDBOX_DISABLE_PROC=true \
-e TIMEOUT_SCALE_FACTOR=10 \
-e DUMMY_COMPILER=1 \
decompme_backend \
-c 'cd /decomp.me/backend && \
uv sync && \
uv run compilers/download.py --compilers-dir ${COMPILER_BASE_PATH} && \
uv run libraries/download.py --libraries-dir ${LIBRARY_BASE_PATH} && \
uv run python manage.py test'
backend_test_docker_prod:
name: backend tests (docker prod container)
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v6
- name: Build decompme_backend image
run: |-
docker build backend --target prod -t decompme_backend
- name: Fetch compilers and libraries
run: |-
python3 -m pip install requests
python3 backend/compilers/download.py
python3 backend/libraries/download.py
export USER_1000=$(getent passwd 1000 | cut -d: -f1)
sudo chown -R ${USER_1000}:${USER_1000} backend/compilers
sudo chown -R ${USER_1000}:${USER_1000} backend/libraries
- name: Run tests
run: |-
sudo sysctl -w kernel.apparmor_restrict_unprivileged_unconfined=0
sudo sysctl -w kernel.apparmor_restrict_unprivileged_userns=0
export USER_1000=$(getent passwd 1000 | cut -d: -f1)
mkdir -p local_files && sudo chown ${USER_1000}:${USER_1000} local_files
docker run \
-v $(pwd)/local_files:/local_files \
-v $(pwd)/backend/compilers:/compilers \
-v $(pwd)/backend/libraries:/libraries \
--security-opt apparmor=unconfined \
--security-opt seccomp=unconfined \
--cap-drop all \
--cap-add setuid \
--cap-add setgid \
--cap-add setfcap \
--tmpfs /sandbox/tmp:exec,uid=1000,gid=1000,size=64M,mode=0700 \
--entrypoint /bin/bash \
-e LOCAL_FILE_DIR=/local_files \
-e COMPILER_BASE_PATH=/compilers \
-e LIBRARY_BASE_PATH=/libraries \
-e USE_SANDBOX_JAIL=on \
-e SANDBOX_DISABLE_PROC=true \
-e TIMEOUT_SCALE_FACTOR=10 \
-e DUMMY_COMPILER=1 \
-e DATABASE_URL=sqlite:///:memory: \
-e SECRET_KEY=secret-key-secret-key-secret-key-secret-key-secret-key-secret-key \
decompme_backend \
-c 'uv run python manage.py test'
docker_compose_test:
name: test docker compose
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v6
- name: Fetch compilers and libraries
run: |
python3 -m pip install requests
python3 backend/compilers/download.py
python3 backend/libraries/download.py
export USER_1000=$(getent passwd 1000 | cut -d: -f1)
sudo chown -R ${USER_1000}:${USER_1000} backend/compilers
sudo chown -R ${USER_1000}:${USER_1000} backend/libraries
- name: Setup dummy production env
run: |
echo 'POSTGRES_USER=decompme' >> docker.prod.env
echo 'POSTGRES_PASSWORD=decompme' >> docker.prod.env
echo 'SECRET_KEY=secret-key-secret-key-secret-key-secret-key-secret-key-secret-key' >> docker.prod.env
echo 'DATABASE_URL=psql://decompme:decompme@postgres:5432/decompme' >> docker.prod.env
echo 'CONN_MAX_AGE=60' >> docker.prod.env
echo 'CONN_HEALTH_CHECKS="true"' >> docker.prod.env
echo 'SANDBOX_DISABLE_PROC="true"' >> docker.prod.env
echo 'ALLOWED_HOSTS="backend,backend-green,backend-blue,localhost,127.0.0.1"' >> docker.prod.env
echo 'USE_SANDBOX_JAIL="on"' >> docker.prod.env
echo 'CI=true' >> docker.prod.env
echo 'ACTIVE_SLOT=blue' >> .deploy.env
echo 'BLUE_TAG=latest' >> .deploy.env
echo 'GREEN_TAG=latest' >> .deploy.env
echo 'NGINX_TAG=latest' >> .deploy.env
- name: Comment out SSL server configuration from nginx
run: |
sed -i '/{{HTTPS_SERVER_BLOCK_START}}/,/{{HTTPS_SERVER_BLOCK_END}}/s/^/#/' nginx/production/default.conf
- name: Prepare production runtime config
run: |
cp ./nginx/production/runtime/geo.conf.example ./nginx/production/runtime/geo.conf
cp ./nginx/production/runtime/upstream.conf.example ./nginx/production/runtime/upstream.conf
- name: Build production images
run: |
docker compose -f docker-compose.prod.yaml build nginx backend-blue frontend-blue
- name: Ensure production services
run: |
timeout 60s python3 deploy.py ensure || true
- name: View docker compose logs (blue)
run: |
timeout 15s docker compose -f docker-compose.prod.yaml logs -f || true
- name: Check docker compose status (blue)
run: |
docker compose -f docker-compose.prod.yaml ps
- name: Deploy green slot
run: |
python3 deploy.py deploy --no-pull latest green
- name: View docker compose logs (green)
run: |
timeout 15s docker compose -f docker-compose.prod.yaml logs -f || true
- name: Check docker compose status (green)
run: |
docker compose -f docker-compose.prod.yaml ps
- name: Shut everything down
if: always()
run: |
docker compose -f docker-compose.prod.yaml down
- name: Print out image sizes
if: always()
run: |
docker image ls
frontend_lint:
name: biome
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Setup Node.js 24
uses: actions/setup-node@v6
with:
node-version: 24
cache: yarn
cache-dependency-path: frontend/yarn.lock
- name: Install frontend dependencies
run: |
cd frontend
yarn --frozen-lockfile
- name: Run Biome
run: |
cd frontend
yarn lint
- name: Run frontend tests
run: |
cd frontend
yarn test
mypy:
name: mypy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Install uv
uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b
with:
version: "latest"
- name: Setup Python 3.14
uses: actions/setup-python@v6
with:
python-version: "3.14"
- run: |-
cd backend
uv sync
uv run mypy
ruff:
name: ruff
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Install uv
uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b
with:
version: "latest"
- name: Setup Python 3.14
uses: actions/setup-python@v6
with:
python-version: "3.14"
- run: |-
cd backend
uv sync
uv run ruff check .
uv run ruff format --check .