From d38210c576d0518eb3331056dc5935dea424c2ef Mon Sep 17 00:00:00 2001 From: petruki <31597636+petruki@users.noreply.github.com> Date: Mon, 21 Apr 2025 20:22:05 -0700 Subject: [PATCH 1/3] Bump pytest@8.3.5, added test matrix and devcontainer settings --- .devcontainer/Dockerfile | 8 +++++++ .devcontainer/devcontainer.json | 21 ++++++++++++++++ .devcontainer/docker-compose.yml | 11 +++++++++ .github/workflows/master.yml | 41 +++++++++++++++++++++++++------- pyproject.toml | 3 +-- sonar-project.properties | 2 +- tests/requirements.txt | 6 ++--- 7 files changed, 78 insertions(+), 14 deletions(-) create mode 100644 .devcontainer/Dockerfile create mode 100644 .devcontainer/devcontainer.json create mode 100644 .devcontainer/docker-compose.yml diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile new file mode 100644 index 0000000..999e4d8 --- /dev/null +++ b/.devcontainer/Dockerfile @@ -0,0 +1,8 @@ +FROM python:3.13-alpine + +# Update pip and install dependencies and tools +RUN pip install --upgrade pip \ + && apk update && \ + apk add --no-cache \ + make \ + git \ No newline at end of file diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 0000000..0643b4b --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,21 @@ +{ + "name": "Switcher Python SDK Dev Container", + "dockerComposeFile": [ + "docker-compose.yml" + ], + "service": "switcherpy-sdk", + "workspaceFolder": "/workspace", + "customizations":{ + "vscode": { + "extensions": [ + "ms-python.debugpy", + "ms-python.python", + "ms-python.vscode-pylance" + ], + "settings": { + "terminal.integrated.shell.linux": "/bin/bash" + } + } + }, + "postCreateCommand": "python3 -m venv /workspace/.venv" +} \ No newline at end of file diff --git a/.devcontainer/docker-compose.yml b/.devcontainer/docker-compose.yml new file mode 100644 index 0000000..31f526e --- /dev/null +++ b/.devcontainer/docker-compose.yml @@ -0,0 +1,11 @@ +version: '3.9' + +services: + + switcherpy-sdk: + build: + context: . + dockerfile: Dockerfile + volumes: + - ..:/workspace:cached + command: sleep infinity \ No newline at end of file diff --git a/.github/workflows/master.yml b/.github/workflows/master.yml index a3ed0d6..e8839fb 100644 --- a/.github/workflows/master.yml +++ b/.github/workflows/master.yml @@ -7,11 +7,10 @@ on: branches: [ master ] jobs: - build-test: - name: Build & Test - runs-on: ubuntu-latest + build-scan: + name: SonarCloud Scan if: "! contains(toJSON(github.event.commits.*.message), '[skip ci]')" - concurrency: ci-${{ github.ref }} + runs-on: ubuntu-latest steps: - name: Git checkout @@ -19,10 +18,10 @@ jobs: with: fetch-depth: 0 - - name: Set up Python 3.11 + - name: Set up Python 3.13 uses: actions/setup-python@v5 with: - python-version: "3.11" + python-version: "3.13" - name: Install dependencies run: pip install -r tests/requirements.txt @@ -31,7 +30,33 @@ jobs: run: pytest -v --cov=./switcher_client --cov-report xml - name: SonarCloud Scan - uses: sonarsource/sonarqube-scan-action@v5.0.0 + uses: sonarsource/sonarqube-scan-action@v5.1.0 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} \ No newline at end of file + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + + build-test: + name: Build & Test - Python ${{ matrix.python-version }} on ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"] + os: [ ubuntu-latest, windows-latest ] + runs-on: ${{ matrix.os }} + concurrency: ci-${{ github.ref }} + if: "! contains(toJSON(github.event.commits.*.message), '[skip ci]')" + + steps: + - name: Git checkout + uses: actions/checkout@v4 + + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + + - name: Install dependencies + run: pip install -r tests/requirements.txt + + - name: Test + run: pytest -v \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index fb4a885..539efb8 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -9,13 +9,12 @@ authors = [{name='Roger Floriano (petruki)', email='switcher.project@gmail.com'} description = "Switcher Client SDK for Python" license = { text = "MIT" } classifiers = [ - "Programming Language :: Python :: 3.6", - "Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", + "Programming Language :: Python :: 3.13", "Programming Language :: Python :: Implementation :: CPython", "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", diff --git a/sonar-project.properties b/sonar-project.properties index fc2cd4b..32710bd 100644 --- a/sonar-project.properties +++ b/sonar-project.properties @@ -7,5 +7,5 @@ sonar.links.homepage=https://github.com/switcherapi/switcher-client-py sonar.sources=switcher_client sonar.tests=tests sonar.python.coverage.reportPaths=coverage.xml -sonar.python.version=3.11 +sonar.python.version=3.13 sonar.exclusions=**/tests/**, **/switcher_client/version.py \ No newline at end of file diff --git a/tests/requirements.txt b/tests/requirements.txt index 31e6500..b38fc26 100644 --- a/tests/requirements.txt +++ b/tests/requirements.txt @@ -1,3 +1,3 @@ -pytest==8.3.3 -pytest-cov==5.0.0 -responses==0.25.6 \ No newline at end of file +pytest==8.3.5 +pytest-cov==6.1.1 +responses==0.25.7 \ No newline at end of file From 3cc57bca1f4d88cd04f04af324328e3fd57ef16b Mon Sep 17 00:00:00 2001 From: petruki <31597636+petruki@users.noreply.github.com> Date: Mon, 21 Apr 2025 20:24:46 -0700 Subject: [PATCH 2/3] removed build-test workflow job concurrency settings --- .github/workflows/master.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/master.yml b/.github/workflows/master.yml index e8839fb..efacefe 100644 --- a/.github/workflows/master.yml +++ b/.github/workflows/master.yml @@ -43,7 +43,6 @@ jobs: python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"] os: [ ubuntu-latest, windows-latest ] runs-on: ${{ matrix.os }} - concurrency: ci-${{ github.ref }} if: "! contains(toJSON(github.event.commits.*.message), '[skip ci]')" steps: From 93d7cd447f757854a98deb00b11a901304bde62f Mon Sep 17 00:00:00 2001 From: petruki <31597636+petruki@users.noreply.github.com> Date: Mon, 21 Apr 2025 20:26:25 -0700 Subject: [PATCH 3/3] Dropped support to Python 3.8 --- .github/workflows/master.yml | 2 +- pyproject.toml | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/master.yml b/.github/workflows/master.yml index efacefe..1be0c4e 100644 --- a/.github/workflows/master.yml +++ b/.github/workflows/master.yml @@ -40,7 +40,7 @@ jobs: strategy: fail-fast: false matrix: - python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"] + python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"] os: [ ubuntu-latest, windows-latest ] runs-on: ${{ matrix.os }} if: "! contains(toJSON(github.event.commits.*.message), '[skip ci]')" diff --git a/pyproject.toml b/pyproject.toml index 539efb8..8384762 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -9,7 +9,6 @@ authors = [{name='Roger Floriano (petruki)', email='switcher.project@gmail.com'} description = "Switcher Client SDK for Python" license = { text = "MIT" } classifiers = [ - "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11",