From bc28026c122afb5826c6659e7054b28b44b8667d Mon Sep 17 00:00:00 2001 From: ste1hi <1874076121@qq.com> Date: Wed, 8 May 2024 15:56:21 +0800 Subject: [PATCH] Add auto release --- .github/workflows/release.yml | 43 +++++++++++++++++++++++++++++++++++ .gitignore | 3 ++- tests/test_basic.py | 2 +- 3 files changed, 46 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..2e2c8e0 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,43 @@ +# This workflow will upload a Python Package using Twine when a release is created +# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python#publishing-to-package-registries + +# This workflow uses actions that are not certified by GitHub. +# They are provided by a third-party and are governed by +# separate terms of service, privacy policy, and support +# documentation. + +name: Upload Python Package + +on: + release: + types: [published] + +jobs: + deploy: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + - name: Set up Python + uses: actions/setup-python@v3 + with: + python-version: '3.10' + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install -r requirements.txt + sudo apt-get update + sudo apt-get install gdb + - name: Lint and test + run: | + flake8 OiRunner/ tests/ --count --statistics --max-line-length=127 + mypy OiRunner/ + coverage run --source OiRunner -m unittest + - name: Build package + run: python -m build + - name: Publish package + uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29 + with: + user: __token__ + password: ${{ secrets.PYPI_TOKEN }} diff --git a/.gitignore b/.gitignore index adf6402..d3346c9 100755 --- a/.gitignore +++ b/.gitignore @@ -162,4 +162,5 @@ cython_debug/ # option (not recommended) you can uncomment the following to ignore the entire idea folder. #.idea/ -token \ No newline at end of file +token +*.html \ No newline at end of file diff --git a/tests/test_basic.py b/tests/test_basic.py index 9645cf7..645fd86 100755 --- a/tests/test_basic.py +++ b/tests/test_basic.py @@ -336,7 +336,7 @@ def wait(): with mock.patch("subprocess.Popen", return_value=new_mock): self.runner.run() - def test_nojudge(self): + def test_not_judge(self): sys.argv = ["BetterRunner.py", "test"] self.runner.cmd_parse() self.runner.args.onlyinput = True