Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
6e2d31e
Prepared file structure
susek555 Dec 11, 2025
1142c88
feat: started clearing code for main json parser
susek555 Dec 11, 2025
d9f5206
feat: wrapped real client to an interface
susek555 Dec 11, 2025
6c64f31
refactor: moved requests to TeamsJSONClient
susek555 Dec 11, 2025
654ae95
feat: implemented mocking fake client
susek555 Dec 11, 2025
f172ed8
feat: implemented creating fake-client through stdin
susek555 Dec 11, 2025
6707904
feat: implemented python client structure
susek555 Dec 11, 2025
b6c3be8
feat: implemented creating fake go client via stdout
susek555 Dec 11, 2025
491cf98
feat: further improvements
susek555 Dec 11, 2025
70c9437
feat: improved script to compile go binaries
susek555 Dec 11, 2025
851ddca
refactor: detached fake client init function to tests folder
susek555 Dec 11, 2025
9fd184a
fix: compiling script
susek555 Dec 11, 2025
d464739
fix: improved test
susek555 Dec 13, 2025
5e89037
ci: added basic verstion of integration tests ci
susek555 Dec 13, 2025
e202ed8
ci: improved integration tests to use uv
susek555 Dec 13, 2025
0905f79
ci: improved passing fake binary lib through stages
susek555 Dec 13, 2025
64d4010
fix: Fixed first integration test
susek555 Dec 13, 2025
d04b59c
refactor: Adjusted creating client to manage cache
susek555 Dec 13, 2025
3579ae9
refactor: improved setting up fake
susek555 Dec 13, 2025
72bb7a6
docs: improved comment
susek555 Dec 13, 2025
e939163
ci: added build release stage in ci
susek555 Dec 13, 2025
a1580aa
ci: added pipeline to aumatically release to pip
susek555 Dec 13, 2025
f2ed6c6
ci: added another stage to automatically bump version
susek555 Dec 13, 2025
e5263a0
ci: corrected publishing and enabled main pushes
susek555 Dec 13, 2025
f4e35d1
fix: adjusted git ignore
susek555 Dec 13, 2025
ff3e86b
chore: removed commented dead code
susek555 Dec 14, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
198 changes: 198 additions & 0 deletions .github/workflows/integration-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,198 @@
name: Python Integration Tests

on:
push:
branches:
- main
pull_request:
branches:
- main
repository_dispatch:
types: [verify-new-go-lib-version]

permissions:
contents: write

jobs:
# ====================================================
# 1. BUILD FAKE
# ====================================================
build-fake:
name: Build fake client
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Setup go
uses: actions/setup-go@v5
with:
go-version-file: "./go/go.mod"
check-latest: true
- run: go version

- name: Update Go Dependency (If triggered by Go Repo)
if: github.event_name == 'repository_dispatch'
run: |
echo "Triggered by Go Core commit: ${{ github.event.client_payload.go_ref }}"
cd go
go get github.com/pzsp-teams/lib@${{ github.event.client_payload.go_ref }}
go mod tidy

- name: Compile Fake Binary
run: |
chmod +x ./go/bridge/compileBridges.sh
./go/bridge/compileBridges.sh fake

- name: Upload Fake Binary
uses: actions/upload-artifact@v4
with:
name: fake-binary
path: python/teams_lib_pzsp2_z1/bin/
retention-days: 1

# ====================================================
# 2. RUN TESTS
# ====================================================
test-integration:
name: Run Integration Tests
runs-on: ubuntu-latest
needs: build-fake
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Download Fake Binary
uses: actions/download-artifact@v4
with:
name: fake-binary
path: python/teams_lib_pzsp2_z1/bin/

- name: Install uv
uses: astral-sh/setup-uv@v5
with:
enable-cache: true
cache-dependency-glob: "python/uv.lock"

- name: Setup Python
run: uv python install 3.12

- name: Install dependencies
run: |
cd python
uv sync --dev

- name: Run Integration Tests
run: |
chmod +x python/teams_lib_pzsp2_z1/bin/*
cd python
uv pip install -e .
uv run pytest -v tests/

# ====================================================
# 3. BUMP VERSION (COMMIT TO MAIN)
# ====================================================
bump-version:
name: Bump Version on Main
runs-on: ubuntu-latest
needs: test-integration
if: github.ref == 'refs/heads/main'
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
token: ${{ secrets.ADMIN_PAT }}
fetch-depth: 0

- name: Bump Patch Version
run: |
cd python
python3 -c "
import re
file_path = 'pyproject.toml'
with open(file_path, 'r') as f:
content = f.read()
match = re.search(r'version = \"(\d+\.\d+)\.(\d+)\"', content)
if match:
prefix = match.group(1)
patch = int(match.group(2))
new_version = f'{prefix}.{patch + 1}'
new_content = re.sub(r'version = \"\d+\.\d+\.\d+\"', f'version = \"{new_version}\"', content)
with open(file_path, 'w') as f:
f.write(new_content)
print(f'Bumped version to {new_version}')
else:
print('Version not found or invalid format')
exit(1)
"

- name: Commit and Push to Main
run: |
git config --global user.name "GitHub Actions Bot"
git config --global user.email "actions@github.com"

git add python/pyproject.toml
git commit -m "Bump version [skip ci]"
git push origin main

# ====================================================
# 4. PREPARE RELEASE BRANCH
# ====================================================
update-release-branch:
name: Update Release Branch
runs-on: ubuntu-latest
needs: bump-version
if: github.ref == 'refs/heads/main'
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Pull latest version from main
run: git pull origin main

- name: Setup Go
uses: actions/setup-go@v5
with:
go-version-file: "./go/go.mod"
check-latest: true

- name: Re-apply Go Dependency Update
if: github.event_name == 'repository_dispatch'
run: |
cd go
go get github.com/pzsp-teams/lib@${{ github.event.client_payload.go_ref }}
go mod tidy

- name: Compile Real Binaries
run: |
chmod +x ./go/bridge/compileBridges.sh
./go/bridge/compileBridges.sh real

- name: Prepare Client Directory
run: |
mkdir python_release
cp -r python/* python_release/

grep "version =" python_release/pyproject.toml

rm -rf python_release/tests
find python_release -type d -name "__pycache__" -exec rm -rf {} +
rm -rf python_release/.venv

ls -R python_release/teams_lib_pzsp2_z1/bin

- name: Commit and Push to Release Branch
run: |
git config --global user.name "GitHub Actions Bot"
git config --global user.email "actions@github.com"
git checkout --orphan python-release

git rm -rf .
cp -r python_release/* .
rm -rf python_release
git add .

git commit -m "Release build: ${{ github.sha }}"
git push -f origin python-release
38 changes: 38 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Publish to PyPI

on:
push:
branches:
- python-release

jobs:
pypi-publish:
name: Upload release to PyPI
runs-on: ubuntu-latest

permissions:
contents: read
id-token: write

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Install uv
uses: astral-sh/setup-uv@v5
with:
enable-cache: true
cache-dependency-glob: "uv.lock"

- name: Setup Python
run: uv python install 3.12

- name: Install build tools
run: |
uv pip install --system build

- name: Build the package
run: uv run python -m build

- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
*.pyc
.egg-info
python/teams_lib_pzsp2_z1.egg-info
python/teams_lib_pzsp2_z1/bin/*
.env
example.py
43 changes: 43 additions & 0 deletions go/.golangci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
version: "2"
run:
tests: true
linters:
enable:
- gocritic
- gocyclo
- misspell
- revive
- unconvert
- unparam
- whitespace
settings:
gocritic:
enabled-tags:
- diagnostic
- performance
- style
gocyclo:
min-complexity: 15
revive:
rules:
- name: exported
disabled: true
exclusions:
generated: lax
paths:
- third_party$
- builtin$
- examples$
issues:
max-issues-per-linter: 0
max-same-issues: 0
formatters:
enable:
- gofmt
- goimports
exclusions:
generated: lax
paths:
- third_party$
- builtin$
- examples$
42 changes: 42 additions & 0 deletions go/bridge/compileBridges.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#!/bin/bash
set -e

# 1. Zapamiętajmy gdzie jesteśmy (katalog główny projektu)
PROJECT_ROOT=$(pwd)

# 2. Definiujemy ścieżkę wyjściową (absolutną, żeby działała po zmianie katalogu)
BIN_DIR="$PROJECT_ROOT/python/teams_lib_pzsp2_z1/bin"
mkdir -p "$BIN_DIR"

# 3. Wchodzimy do katalogu 'go', gdzie leży plik go.mod
cd go

# Ścieżka do pakietu mostka (teraz relatywna względem katalogu 'go')
BRIDGE_PKG="./bridge"

# Read the mode from the first argument
MODE=$1

if [[ "$MODE" == "real" ]]; then
echo "=== Building REAL mode (Production) ==="

echo "Building Linux (real)..."
GOOS=linux GOARCH=amd64 go build -tags real -o "$BIN_DIR/teamsClientLib_linux" "$BRIDGE_PKG"

echo "Building Windows (real)..."
GOOS=windows GOARCH=amd64 go build -tags real -o "$BIN_DIR/teamsClientLib_windows.exe" "$BRIDGE_PKG"

elif [[ "$MODE" == "fake" ]]; then
echo "=== Building FAKE mode (Integration Tests) ==="

echo "Building Linux (fake)..."
GOOS=linux GOARCH=amd64 go build -tags fake -o "$BIN_DIR/teamsClientLib_linux" "$BRIDGE_PKG"

else
echo "Error: Invalid argument. Usage: $0 [real|fake]"
echo " real - builds for Linux and Windows with production code"
echo " fake - builds for Linux only with mock capability"
exit 1
fi

echo "Done! Binaries saved in $BIN_DIR"
Loading
Loading