From 490cdd5d02ca09eb9acdb2f1f49a0156fa0fc94e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=B5=E5=B0=8F=E5=87=A1?= <2672931+whyb@users.noreply.github.com> Date: Mon, 8 Sep 2025 17:04:15 +0800 Subject: [PATCH 1/9] Add run-test.yml --- .github/workflows/run-test.yml | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 .github/workflows/run-test.yml diff --git a/.github/workflows/run-test.yml b/.github/workflows/run-test.yml new file mode 100644 index 0000000..1940356 --- /dev/null +++ b/.github/workflows/run-test.yml @@ -0,0 +1,33 @@ +name: Windows CI for HwCodecDetect + +on: + push: + branches: [ main, testci ] + pull_request: + branches: [ main, testci ] + +jobs: + test-on-windows: + runs-on: windows-latest + + defaults: + run: + shell: bash + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Setup Python 3.10 + uses: actions/setup-python@v5 + with: + python-version: '3.10' + + - name: Upgrade pip + run: python -m pip install --upgrade pip + + - name: Install dependencies + run: python -m pip install -r requirements.txt + + - name: Run tests + run: python -m src.HwCodecDetect.run_tests From 18704050d87185fb108af4ea36f1c707c5a0ea52 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=B5=E5=B0=8F=E5=87=A1?= <2672931+whyb@users.noreply.github.com> Date: Mon, 8 Sep 2025 17:11:48 +0800 Subject: [PATCH 2/9] Change to git clone --- .github/workflows/run-test.yml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/run-test.yml b/.github/workflows/run-test.yml index 1940356..d8cb5b9 100644 --- a/.github/workflows/run-test.yml +++ b/.github/workflows/run-test.yml @@ -23,11 +23,11 @@ jobs: with: python-version: '3.10' - - name: Upgrade pip - run: python -m pip install --upgrade pip - - - name: Install dependencies - run: python -m pip install -r requirements.txt - - - name: Run tests - run: python -m src.HwCodecDetect.run_tests + - name: Clone HwCodecDetect manually + run: | + git clone https://github.com/whyb/HwCodecDetect.git + cd HwCodecDetect + + python -m pip install --upgrade pip + python -m pip install -r requirements.txt + python -m src.HwCodecDetect.run_tests From b865c2abf8523790ec363f6ca88e8fc5e8d7a3c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=B5=E5=B0=8F=E5=87=A1?= <2672931+whyb@users.noreply.github.com> Date: Mon, 8 Sep 2025 17:15:37 +0800 Subject: [PATCH 3/9] Update test ci --- .github/workflows/run-test.yml | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/.github/workflows/run-test.yml b/.github/workflows/run-test.yml index d8cb5b9..93c7936 100644 --- a/.github/workflows/run-test.yml +++ b/.github/workflows/run-test.yml @@ -15,19 +15,17 @@ jobs: shell: bash steps: - - name: Checkout repository - uses: actions/checkout@v4 + - name: Clone HwCodecDetect + run: git clone https://github.com/whyb/HwCodecDetect.git - - name: Setup Python 3.10 - uses: actions/setup-python@v5 - with: - python-version: '3.10' + - name: Upgrade pip + run: python -m pip install --upgrade pip + working-directory: HwCodecDetect - - name: Clone HwCodecDetect manually - run: | - git clone https://github.com/whyb/HwCodecDetect.git - cd HwCodecDetect + - name: Install dependencies + run: python -m pip install -r requirements.txt + working-directory: HwCodecDetect - python -m pip install --upgrade pip - python -m pip install -r requirements.txt - python -m src.HwCodecDetect.run_tests + - name: Run tests + run: python -m src.HwCodecDetect.run_tests + working-directory: HwCodecDetect From 73fdff3a7dd74944004b22d2b9fc572d62cf85fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=B5=E5=B0=8F=E5=87=A1?= <2672931+whyb@users.noreply.github.com> Date: Mon, 8 Sep 2025 17:21:01 +0800 Subject: [PATCH 4/9] Update __init__.py (__version__) --- src/HwCodecDetect/__init__.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/HwCodecDetect/__init__.py b/src/HwCodecDetect/__init__.py index 5f5b17d..8675c8b 100644 --- a/src/HwCodecDetect/__init__.py +++ b/src/HwCodecDetect/__init__.py @@ -1,8 +1,16 @@ # HwCodecDetect/__init__.py - +import os from .install_ffmpeg_if_needed import install_ffmpeg_if_needed -from .version import __version__ +def _read_version(): + try: + version_path = os.path.join(os.path.dirname(__file__), '..', '..', 'VERSION') + with open(version_path, encoding='utf-8') as f: + return f.read().strip() + except Exception: + return "0.0.0" + +__version__ = _read_version() __author__ = "whyb" __email__ = "whyber@outlook.com" __license__ = "BSD-3-Clause" From 287bdce78636178217ab476d57d7decb8ec9f421 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=B5=E5=B0=8F=E5=87=A1?= <2672931+whyb@users.noreply.github.com> Date: Mon, 8 Sep 2025 17:23:58 +0800 Subject: [PATCH 5/9] git clone -b testci --- .github/workflows/run-test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/run-test.yml b/.github/workflows/run-test.yml index 93c7936..002fc52 100644 --- a/.github/workflows/run-test.yml +++ b/.github/workflows/run-test.yml @@ -16,7 +16,7 @@ jobs: steps: - name: Clone HwCodecDetect - run: git clone https://github.com/whyb/HwCodecDetect.git + run: git clone -b testci --single-branch https://github.com/whyb/HwCodecDetect.git - name: Upgrade pip run: python -m pip install --upgrade pip From f878c0d2537ee8bce33b349eca8e499983d3c0b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=B5=E5=B0=8F=E5=87=A1?= <2672931+whyb@users.noreply.github.com> Date: Mon, 8 Sep 2025 17:27:27 +0800 Subject: [PATCH 6/9] chcp 65001 --- .github/workflows/run-test.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/run-test.yml b/.github/workflows/run-test.yml index 002fc52..aad396c 100644 --- a/.github/workflows/run-test.yml +++ b/.github/workflows/run-test.yml @@ -27,5 +27,7 @@ jobs: working-directory: HwCodecDetect - name: Run tests - run: python -m src.HwCodecDetect.run_tests + run: | + chcp 65001 + python -m src.HwCodecDetect.run_tests working-directory: HwCodecDetect From b9de7cf33ce48f917c09f724de92e6c9e2068870 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=B5=E5=B0=8F=E5=87=A1?= <2672931+whyb@users.noreply.github.com> Date: Mon, 8 Sep 2025 17:29:13 +0800 Subject: [PATCH 7/9] bash to cmd --- .github/workflows/run-test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/run-test.yml b/.github/workflows/run-test.yml index aad396c..da5a098 100644 --- a/.github/workflows/run-test.yml +++ b/.github/workflows/run-test.yml @@ -12,7 +12,7 @@ jobs: defaults: run: - shell: bash + shell: cmd steps: - name: Clone HwCodecDetect From b97f543e9646c027e57d5e8e7ca2f9e650ed09a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=B5=E5=B0=8F=E5=87=A1?= <2672931+whyb@users.noreply.github.com> Date: Mon, 8 Sep 2025 17:33:06 +0800 Subject: [PATCH 8/9] PYTHONIOENCODING: utf-8 --- .github/workflows/run-test.yml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/workflows/run-test.yml b/.github/workflows/run-test.yml index da5a098..75ec985 100644 --- a/.github/workflows/run-test.yml +++ b/.github/workflows/run-test.yml @@ -12,7 +12,10 @@ jobs: defaults: run: - shell: cmd + shell: pwsh + + env: + PYTHONIOENCODING: utf-8 steps: - name: Clone HwCodecDetect @@ -27,7 +30,5 @@ jobs: working-directory: HwCodecDetect - name: Run tests - run: | - chcp 65001 - python -m src.HwCodecDetect.run_tests + run: python -m src.HwCodecDetect.run_tests working-directory: HwCodecDetect From 7cf4d0945920bea32ca148d560ad7b13fa4a81da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=B5=E5=B0=8F=E5=87=A1?= <2672931+whyb@users.noreply.github.com> Date: Mon, 8 Sep 2025 17:35:32 +0800 Subject: [PATCH 9/9] change to main --- .github/workflows/run-test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/run-test.yml b/.github/workflows/run-test.yml index 75ec985..f5bb814 100644 --- a/.github/workflows/run-test.yml +++ b/.github/workflows/run-test.yml @@ -19,7 +19,7 @@ jobs: steps: - name: Clone HwCodecDetect - run: git clone -b testci --single-branch https://github.com/whyb/HwCodecDetect.git + run: git clone -b main --single-branch https://github.com/whyb/HwCodecDetect.git - name: Upgrade pip run: python -m pip install --upgrade pip