Skip to content

jjpark987/codescript-problems

Repository files navigation

CodeScript Problems

This repository contains the code problems and the github actions workflow for CodeScript.

Getting Started

Prerequisites

  • Git
  • GitHub Runner
  • Python 3.13.5
  • MySQL
  • Docker

Installation

  1. Clone the repository
git clone git@github.com:jjpark987/codescript-db.git
  1. Create a virtual environment if there isn't one already
python -m venv .venv
  1. Activate virtual environment
source .venv/bin/activate
  1. Install dependencies
pip install -r requirements.txt

Scripts

Database

Posting Problems to Database

  • Make sure codescript-fastapi is running

  • To parse and post /python/main.py

python -m python.scripts.db.post_problems
  • To parse and post a problem
python -m python.scripts.db.post_problems --file "python/problems/combinatorics/counting/new_problem.py"
  • To parse and post all problems in problems/
python -m python.scripts.db.post_problems --all

Uploading Images to Google Cloud Storage

  • To upload an image
python -m python.scripts.db.upload_images --file "python/images/new_image.png"
  • To upload all images
python -m python.scripts.db.upload_images --all

Repository

Renaming Problems

  • To rename a problem
python -m python.scripts.repo.rename_problems --file "python/main.py"
  • To rename all problems
python -m python.scripts.repo.rename_problems --all

Renaming Images

  • To rename an image
python -m python.scripts.repo.rename_images --file "python/main.py"
  • To rename all images
python -m python.scripts.repo.rename_images --all

Copy/Paste/Rename app/main.py

  • To copy and paste main.py into the subcategory directory and rename it to the problem title
python -m python.scripts.repo.copy_main

Docker

  • Build image, create container, and activate in the foreground
docker compose up --build --abort-on-container-exit

GitHub Action

  1. Verify Docker Desktop is running in the background

  2. Verify GitHub Runner from ~/actions-runner is running in the background

  • Verify runner from ~/actions-runner
cd ~/Projects/codescript/actions-runner && ./svc.sh status
  • Start runner from ~/actions-runner
cd ~/Projects/codescript/actions-runner && ./svc.sh start
  1. Add new files to python/problems/ and images/ to trigger GitHub Action workflow

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published