diff --git a/.forgejo/workflows/ci.yml b/.forgejo/workflows/ci.yml new file mode 100644 index 0000000..8f895c1 --- /dev/null +++ b/.forgejo/workflows/ci.yml @@ -0,0 +1,62 @@ +name: CI Test Suite + +on: [push, pull_request] + +jobs: + run-tests: + runs-on: docker + steps: + - name: 저장소 체크아웃 + uses: actions/checkout@v4 + + # 1. 기존 APT 캐시 복원 (가장 최근 상태 불러오기) + - name: Restore APT Cache + id: restore-apt + uses: actions/cache/restore@v4 + with: + path: /var/cache/apt/archives + key: linux-apt-temp + restore-keys: | + linux-apt- + + # 2. 포트란 컴파일러 및 MPI, 파이썬 시스템 패키지 설치 + - name: Install System Packages + run: | + if [ -f /etc/apt/apt.conf.d/docker-clean ]; then + echo 'Binary::apt::APT::Keep-Downloaded-Packages "true";' | tee /etc/apt/apt.conf.d/keep-cache + rm -f /etc/apt/apt.conf.d/docker-clean + fi + + apt-get update + apt-get install -y python3 python3-pip python3-venv gfortran openmpi-bin libopenmpi-dev + + apt-get autoclean -y + rm -f /var/cache/apt/archives/partial/* + + # 3. .deb 파일 해시 기반 APT 캐시 갱신 및 저장 + - name: Calculate APT Cache Hash + id: apt-hash + run: | + DEB_HASH=$(find /var/cache/apt/archives -name "*.deb" -type f -printf "%f\n" | sort | md5sum | awk '{print $1}') + echo "hash=$DEB_HASH" >> $GITHUB_OUTPUT + + - name: Save APT Cache + if: steps.restore-apt.outputs.cache-matched-key != format('linux-apt-{0}', steps.apt-hash.outputs.hash) + uses: actions/cache/save@v4 + with: + path: /var/cache/apt/archives + key: linux-apt-${{ steps.apt-hash.outputs.hash }} + + # 4. 파이썬 가상환경 생성 및 수식 최적화/파서 패키지 빌드 + - name: Setup Virtual Environment & Dependencies + run: | + python3 -m venv venv + . venv/bin/activate + pip install --upgrade pip + pip install lark sympy numpy jinja2 + + # 5. 자가 생성형 합성 격자 분석 수치 정밀도 테스트 실행 + - name: Run Analytical Synthetic Grid Verification Test + run: | + . venv/bin/activate + python3 code/code_gen/regression_verify_synthetic.py diff --git a/code/code_gen/regression_verify_synthetic.py b/code/code_gen/regression_verify_synthetic.py index a28efdd..da0023d 100644 --- a/code/code_gen/regression_verify_synthetic.py +++ b/code/code_gen/regression_verify_synthetic.py @@ -72,7 +72,7 @@ def run_synthetic_regression_test(): # 6. Execute binary inside test run directory # Using 4 ranks for fast execution print("Running compiled MPI binary on synthetic grid...") - run_cmd = ["mpirun", "--oversubscribe", "-np", "4", f"./{binary_name}"] + run_cmd = ["mpirun", "--allow-run-as-root", "--oversubscribe", "-np", "4", f"./{binary_name}"] try: subprocess.run( run_cmd,