From 55c52b1956a23ab47d0452b3df77f23258937f19 Mon Sep 17 00:00:00 2001 From: Pun Butrach Date: Thu, 21 Dec 2023 19:57:30 +0700 Subject: [PATCH 1/6] Make test less flakey --- .github/workflows/python.yml | 41 +++++++++++------------------------- 1 file changed, 12 insertions(+), 29 deletions(-) diff --git a/.github/workflows/python.yml b/.github/workflows/python.yml index 14ace75..f3cabf6 100644 --- a/.github/workflows/python.yml +++ b/.github/workflows/python.yml @@ -23,18 +23,18 @@ jobs: strategy: fail-fast: false matrix: - os: [ ubuntu-latest ] - supported-python-version: [ "3.10", "3.11", "3.12" ] - best_effort-python-version: [ "3.9" ] + os: [ ubuntu-22.04 ] + supported-python-version: [ "3.10.13", "3.11.7", "3.12.1" ] + best_effort-python-version: [ "3.9.18" ] runs-on: ${{ matrix.os }} steps: - name: Checkout the repository - uses: actions/checkout@v4 + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # 4.1.1 - name: Set up Python ${{ matrix.supported-python-version }} - uses: actions/setup-python@v4 + uses: actions/setup-python@0a5c61591373683505ea898e09a3ea4f39ef2b9c # 5.0.0 with: python-version: ${{ matrix.supported-python-version }} allow-prereleases: true @@ -47,28 +47,11 @@ jobs: - name: Lint check with Ruff run: | - if [ ${{ matrix.supported-python-version }} == 3.7 ]; then - ruff check $(git ls-files '*.py') --target-version=py37 - fi - if [ ${{ matrix.supported-python-version }} == 3.8 ]; then - ruff check $(git ls-files '*.py') --target-version=py38 - fi - if [ ${{ matrix.supported-python-version }} == 3.9 ]; then - ruff check $(git ls-files '*.py') --target-version=py39 - fi - if [ ${{ matrix.supported-python-version }} == 3.10 ]; then - ruff check $(git ls-files '*.py') --target-version=py310 - fi - if [ ${{ matrix.supported-python-version }} == 3.11 ]; then - ruff check $(git ls-files '*.py') --target-version=py311 - fi - if [ ${{ matrix.supported-python-version }} == 3.12 ]; then - ruff check $(git ls-files '*.py') --target-version=py312 - fi + ruff check $(git ls-files '*.py') - name: Static analysis with MyPy run: | - mypy $(git ls-files '*.py') --python-version ${{ matrix.supported-python-version }} + mypy $(git ls-files '*.py') - name: Testing with Pytest run: | @@ -81,18 +64,18 @@ jobs: strategy: fail-fast: false matrix: - os: [ ubuntu-latest ] - base-python-version: [ "3.11" ] - best_effort-python-version: [ "3.9" ] + os: [ ubuntu-22.04 ] + base-python-version: [ "3.11.7" ] + best_effort-python-version: [ "3.9.18" ] runs-on: ${{ matrix.os }} steps: - name: Checkout the repository - uses: actions/checkout@v4 + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # 4.1.1 - name: Set up Python ${{ matrix.base-python-version }} - uses: actions/setup-python@v4 + uses: actions/setup-python@0a5c61591373683505ea898e09a3ea4f39ef2b9c # 5.0.0 with: python-version: ${{ matrix.base-python-version }} allow-prereleases: true From 104a3f3ab655a9954dfac28a00054dc02f6d9353 Mon Sep 17 00:00:00 2001 From: Pun Butrach Date: Thu, 21 Dec 2023 20:00:36 +0700 Subject: [PATCH 2/6] Update python.yml --- .github/workflows/python.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/python.yml b/.github/workflows/python.yml index f3cabf6..ce73cd7 100644 --- a/.github/workflows/python.yml +++ b/.github/workflows/python.yml @@ -88,4 +88,4 @@ jobs: - name: Static analysis with MyPy run: | - mypy $(git ls-files '*.py') --python-version ${{ matrix.best_effort-python-version }} + mypy $(git ls-files '*.py') --python-version 3.9 # TODO: dynamically use value from matrix From 930cf9c8338287174a2e9f6f2fda560f322b9338 Mon Sep 17 00:00:00 2001 From: Pun Butrach Date: Thu, 21 Dec 2023 20:15:11 +0700 Subject: [PATCH 3/6] Correct python testing --- .github/workflows/python.yml | 42 +++++++++++++++++++++--------------- 1 file changed, 25 insertions(+), 17 deletions(-) diff --git a/.github/workflows/python.yml b/.github/workflows/python.yml index ce73cd7..9007737 100644 --- a/.github/workflows/python.yml +++ b/.github/workflows/python.yml @@ -23,18 +23,18 @@ jobs: strategy: fail-fast: false matrix: - os: [ ubuntu-22.04 ] - supported-python-version: [ "3.10.13", "3.11.7", "3.12.1" ] - best_effort-python-version: [ "3.9.18" ] + os: [ "ubuntu-22.04", "macos-12", "windows-2022" ] + supported-python-version: [ "3.10.13", "3.11.7", "3.12.1", "3.9.18" ] + best_effort-python-version: [ "3.8.18" ] runs-on: ${{ matrix.os }} steps: - name: Checkout the repository - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # 4.1.1 + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 - name: Set up Python ${{ matrix.supported-python-version }} - uses: actions/setup-python@0a5c61591373683505ea898e09a3ea4f39ef2b9c # 5.0.0 + uses: actions/setup-python@0a5c61591373683505ea898e09a3ea4f39ef2b9c # v5.0.0 with: python-version: ${{ matrix.supported-python-version }} allow-prereleases: true @@ -58,34 +58,42 @@ jobs: cd scripts pytest - analyse-best_effort: - name: static analysis on best effort + analyse-best-effort: + name: testing on legacy/best-effort status continue-on-error: true strategy: fail-fast: false matrix: - os: [ ubuntu-22.04 ] - base-python-version: [ "3.11.7" ] - best_effort-python-version: [ "3.9.18" ] + os: [ "ubuntu-22.04", "macos-12", "windows-2022" ] + legacy-python-version: [ "3.8.18" ] runs-on: ${{ matrix.os }} steps: - name: Checkout the repository - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # 4.1.1 + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 - - name: Set up Python ${{ matrix.base-python-version }} - uses: actions/setup-python@0a5c61591373683505ea898e09a3ea4f39ef2b9c # 5.0.0 + - name: Set up Python ${{ matrix.legacy-python-version }} + uses: actions/setup-python@0a5c61591373683505ea898e09a3ea4f39ef2b9c v# 5.0.0 with: - python-version: ${{ matrix.base-python-version }} + python-version: ${{ matrix.legacy-python-version }} allow-prereleases: true - + - name: Install dependencies - run: | + run: | # $(git ls-files '*dev-requirements.txt') # $(git ls-files '*requirements.txt') python -m pip install --upgrade pip pip install -r scripts/requirements.txt pip install -r scripts/dev-requirements.txt + + - name: Lint check with Ruff + run: | + ruff check $(git ls-files '*.py') - name: Static analysis with MyPy run: | - mypy $(git ls-files '*.py') --python-version 3.9 # TODO: dynamically use value from matrix + mypy $(git ls-files '*.py') + + - name: Testing with Pytest + run: | + cd scripts + pytest From ed45bea2f2a8423d3494086ced964eaaebc57f00 Mon Sep 17 00:00:00 2001 From: Pun Butrach Date: Thu, 21 Dec 2023 20:22:28 +0700 Subject: [PATCH 4/6] 3.13 --- scripts/README.md | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/scripts/README.md b/scripts/README.md index 5f6b36e..97619ba 100644 --- a/scripts/README.md +++ b/scripts/README.md @@ -1,20 +1,21 @@ # `> Image_manipulation` Python script that's mostly used for image manipulation -| Python version | Support status | -| -------------- | ----------------- | -| 3.12 | ✅ Supported | -| 3.11 | ✅ Supported | -| 3.10 | ✅ Supported | -| 3.9 | ✅ Supported | -| 3.8 | ⚙️ Best effort | -| =<3.7 | ❌ Not Supported | +| Python version | Support status | +| -------------- | -------------------------------------------- | +| 3.13 | ❌ Best effort if the dependency is ready | +| 3.12 | ✅ Supported | +| 3.11 | ✅ Supported | +| 3.10 | ✅ Supported | +| 3.9 | ✅ Supported | +| 3.8 | ⚙️ Best effort | +| =<3.7 | ❌ Not Supported | ## `> Image // Contributing` Thanks for consider contributing. > [!IMPORTANT] -> This guide assume that you already installed Python 3.10 or higher and pytest. +> This guide assume that you already installed Python 3.9 or higher and pytest. Running the script: 1. Clone the repository: `git@github.com:validcube/validcube.git && cd scripts` From 022e851ecdd03b195e1f98ed7cf54eba1f0c0f9d Mon Sep 17 00:00:00 2001 From: Pun Butrach Date: Thu, 21 Dec 2023 20:22:54 +0700 Subject: [PATCH 5/6] Update README.md --- scripts/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/README.md b/scripts/README.md index 97619ba..3c3a91a 100644 --- a/scripts/README.md +++ b/scripts/README.md @@ -34,5 +34,5 @@ Developing the script: Here are some tip when contributing: * All commits must follows the [Conventional Commits 1.0.0](https://www.conventionalcommits.org/en/v1.0.0/) guidelines. -* [Signing commits](https://docs.github.com/en/authentication/managing-commit-signature-verification/signing-commits) are highly recommended. +* [Signing commits](https://docs.github.com/en/authentication/managing-commit-signature-verification/signing-commits) are **required**. * This repository follows slight variation of [Google's Python style](https://google.github.io/styleguide/pyguide.html) guide **but not strictly enforced**. From 413e1c4d90d5e996c872b87342a90734c8528661 Mon Sep 17 00:00:00 2001 From: Pun Butrach Date: Thu, 21 Dec 2023 20:24:15 +0700 Subject: [PATCH 6/6] Update python.yml --- .github/workflows/python.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/python.yml b/.github/workflows/python.yml index 9007737..a8f2c15 100644 --- a/.github/workflows/python.yml +++ b/.github/workflows/python.yml @@ -18,7 +18,7 @@ permissions: jobs: analyse-supported: - name: testing on supported versions + name: testing on versions (supported) continue-on-error: true strategy: fail-fast: false @@ -59,7 +59,7 @@ jobs: pytest analyse-best-effort: - name: testing on legacy/best-effort status + name: testing on versions (best-effort) continue-on-error: true strategy: fail-fast: false @@ -74,7 +74,7 @@ jobs: uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 - name: Set up Python ${{ matrix.legacy-python-version }} - uses: actions/setup-python@0a5c61591373683505ea898e09a3ea4f39ef2b9c v# 5.0.0 + uses: actions/setup-python@0a5c61591373683505ea898e09a3ea4f39ef2b9c # v5.0.0 with: python-version: ${{ matrix.legacy-python-version }} allow-prereleases: true