From 6b581c1c1f1fe597d94543e1784d4df56117520e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=94=A1=E9=B3=B3=E9=A7=BF?= Date: Wed, 7 May 2025 13:56:50 +0800 Subject: [PATCH 1/6] fix: upgrade serveral action version and bump to python 3.10 --- .../continuous-integration-workflow.yml | 74 +++++++++++++------ 1 file changed, 51 insertions(+), 23 deletions(-) diff --git a/.github/workflows/continuous-integration-workflow.yml b/.github/workflows/continuous-integration-workflow.yml index 95c2420..0a03d10 100644 --- a/.github/workflows/continuous-integration-workflow.yml +++ b/.github/workflows/continuous-integration-workflow.yml @@ -3,28 +3,56 @@ name: CI on: [push, pull_request] jobs: - build: - + lint: + name: Code Style Check + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Set up Python 3.10 + uses: actions/setup-python@v5 + with: + python-version: '3.10' + cache: 'pip' + + - name: Install YAPF + run: | + python -m pip install --upgrade pip + pip install yapf + + - name: Check code formatting + run: yapf . -rd + + test: + name: Unit Tests runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v1 - - name: Set up Python 3.7 - uses: actions/setup-python@v1 - with: - python-version: 3.7 - - name: Upgrade pip - run: | - python -m pip install --upgrade pip - - name: Install sandbox requirements - run: | - ./build.sh - pip install -r requirements.txt - - name: YAPF - run: | - pip install yapf - yapf . -rd - - name: Unit test - run: | - pip install -r tests/requirements.txt - pytest + - uses: actions/checkout@v4 + + - name: Set up Python 3.10 + uses: actions/setup-python@v5 + with: + python-version: '3.10' + cache: 'pip' + + - name: Cache build dependencies + uses: actions/cache@v3 + with: + path: ~/.cache/pip + key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt', '**/tests/requirements.txt') }} + restore-keys: | + ${{ runner.os }}-pip- + + - name: Upgrade pip + run: python -m pip install --upgrade pip + + - name: Build sandbox + run: ./build.sh + + - name: Install dependencies + run: | + pip install -r requirements.txt + pip install -r tests/requirements.txt + + - name: Run tests + run: pytest -v From 45a2cfb4f3175c301cde4a5b62404a3ebd1099be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=94=A1=E9=B3=B3=E9=A7=BF?= Date: Wed, 7 May 2025 14:06:21 +0800 Subject: [PATCH 2/6] style: fix yapf style error --- tests/test_submission_runner.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/test_submission_runner.py b/tests/test_submission_runner.py index bf736f2..a8e01a5 100644 --- a/tests/test_submission_runner.py +++ b/tests/test_submission_runner.py @@ -26,8 +26,8 @@ ], ) def test_strip_func(TestSubmissionRunner, stdout, answer, excepted): - assert (TestSubmissionRunner.strip(stdout) - == TestSubmissionRunner.strip(answer)) is excepted + assert (TestSubmissionRunner.strip(stdout) == TestSubmissionRunner.strip( + answer)) is excepted def test_c_tle(submission_generator, TestSubmissionRunner): From 690fe99479c003ddd312269b094c1de45b14d7e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=94=A1=E9=B3=B3=E9=A7=BF?= Date: Wed, 7 May 2025 14:11:17 +0800 Subject: [PATCH 3/6] fix: adjust testdata_root to prevent permission denied --- dispatcher/config.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dispatcher/config.py b/dispatcher/config.py index 5af22ac..7dac6ca 100644 --- a/dispatcher/config.py +++ b/dispatcher/config.py @@ -13,7 +13,7 @@ ) TESTDATA_ROOT = Path(os.getenv( 'TESTDATA_ROOT', - '/sandbox-testdata', + 'sandbox-testdata', )) TESTDATA_ROOT.mkdir(exist_ok=True) SUBMISSION_DIR = Path(os.getenv( From 4d6c9d5728e9502cbe70314fd30fa04ae71551ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=94=A1=E9=B3=B3=E9=A7=BF?= Date: Fri, 9 May 2025 21:48:48 +0800 Subject: [PATCH 4/6] build: bump c_app ubuntu from 20.04 to 22.04 --- c_cpp_dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/c_cpp_dockerfile b/c_cpp_dockerfile index 4cd39e5..b16a879 100644 --- a/c_cpp_dockerfile +++ b/c_cpp_dockerfile @@ -1,6 +1,6 @@ # for c_cpp -FROM ubuntu:20.04 +FROM ubuntu:22.04 LABEL org.opencontainers.image.authors="Normal-OJ Maintainers " From dca8677071f189e2ad6344bd93bdad2daebdcfea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=94=A1=E9=B3=B3=E9=A7=BF?= Date: Fri, 9 May 2025 21:52:48 +0800 Subject: [PATCH 5/6] build: bump python3 ubuntu from 20.04 to 22.04 --- python3_dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python3_dockerfile b/python3_dockerfile index 985da91..0b3a43b 100644 --- a/python3_dockerfile +++ b/python3_dockerfile @@ -1,6 +1,6 @@ # for python3 -FROM ubuntu:18.04 +FROM ubuntu:22.04 LABEL org.opencontainers.image.authors="Normal-OJ Maintainers " From dd2c392c9659b0193ff16c8c10bd2cbb93c2ab30 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=94=A1=E9=B3=B3=E9=A7=BF?= Date: Fri, 11 Jul 2025 23:54:59 +0800 Subject: [PATCH 6/6] ci: use arm runner --- .github/workflows/continuous-integration-workflow.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/continuous-integration-workflow.yml b/.github/workflows/continuous-integration-workflow.yml index 0a03d10..24b3249 100644 --- a/.github/workflows/continuous-integration-workflow.yml +++ b/.github/workflows/continuous-integration-workflow.yml @@ -5,7 +5,7 @@ on: [push, pull_request] jobs: lint: name: Code Style Check - runs-on: ubuntu-latest + runs-on: ubuntu-24.04-arm steps: - uses: actions/checkout@v4 @@ -25,7 +25,7 @@ jobs: test: name: Unit Tests - runs-on: ubuntu-latest + runs-on: ubuntu-24.04-arm steps: - uses: actions/checkout@v4