Repository: privacera/paig (language: python)

Issue:
Create base version
Create base version - initial commit of PAIG OSS


Discussion / hints:

Fix patch:
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
new file mode 100644
index 00000000..03d909b4
--- /dev/null
+++ b/.github/workflows/release.yml
@@ -0,0 +1,76 @@
+name: Upload Wheel to PyPI
+
+on:
+  workflow_dispatch: # Allows manual trigger
+
+permissions:
+  contents: read
+
+jobs:
+  test-pypi:
+    runs-on: ubuntu-latest
+    steps:
+    - uses: actions/checkout@v4  # Ensure the repo is checked out
+
+    - name: Set up Python 3.10
+      uses: actions/setup-python@v5
+      with:
+        python-version: "3.10"
+
+    - name: Install dependencies
+      run: |
+        python3 -m pip install virtualenv
+        virtualenv -p python3 venv && . venv/bin/activate
+        pip install twine build pytest pytest-cov
+        pip install -r backend/requirements.txt
+
+    - name: Test with pytest
+      run: |
+        filepath=$PWD
+        . venv/bin/activate && cd backend/paig
+        python3 -m pytest --cov="." --cov-report term --cov-report xml:$filepath/coverage.xml --junitxml=$filepath/junit.xml tests
+        cd $filepath
+
+    - name: Upload coverage report
+      uses: actions/upload-artifact@v4
+      with:
+        name: coverage-report
+        path: coverage.xml
+
+    - name: Upload test results
+      uses: actions/upload-artifact@v4
+      with:
+        name: junit-results
+        path: junit.xml
+
+    - name: Install Node.js
+      uses: actions/setup-node@v4
+      with:
+        node-version: 20
+        registry-url: https://registry.npmjs.org/
+
+    - name: Install Node.js dependencies and build UI
+      run: |
+        cd scripts
+        sh build_ui.sh
+        cd ..
+
+    - name: Build the wheel
+      run: |
+        . venv/bin/activate
+        python3 -m build -w
+
+    - name: Install created package
+      run: |
+        rm -rf venv
+        virtualenv -p python3 venv && . venv/bin/activate
+        pip install dist/*.whl
+
+    - name: Upload to PyPI
+      env:
+        TWINE_USERNAME: ${{ secrets.TWINE_USERNAME }}
+        TWINE_PASSWORD: ${{ secrets.TWINE_PYPI_API_TOKEN }}
+      run: |
+        . venv/bin/activate
+        pip install twine
+        twine upload dist/*
\ No newline at end of file


Test patch:
diff --git a/.github/workflows/test-pypi.yml b/.github/workflows/test-pypi.yml
new file mode 100644
index 00000000..58ef60b9
--- /dev/null
+++ b/.github/workflows/test-pypi.yml
@@ -0,0 +1,76 @@
+name: Upload Wheel to Test PyPI
+
+on:
+  workflow_dispatch: # Allows manual trigger
+
+permissions:
+  contents: read
+
+jobs:
+  test-pypi:
+    runs-on: ubuntu-latest
+    steps:
+    - uses: actions/checkout@v4  # Ensure the repo is checked out
+
+    - name: Set up Python 3.10
+      uses: actions/setup-python@v5
+      with:
+        python-version: "3.10"
+
+    - name: Install dependencies
+      run: |
+        python3 -m pip install virtualenv
+        virtualenv -p python3 venv && . venv/bin/activate
+        pip install twine build pytest pytest-cov
+        pip install -r backend/requirements.txt
+
+    - name: Test with pytest
+      run: |
+        filepath=$PWD
+        . venv/bin/activate && cd backend/paig
+        python3 -m pytest --cov="." --cov-report term --cov-report xml:$filepath/coverage.xml --junitxml=$filepath/junit.xml tests
+        cd $filepath
+
+    - name: Upload coverage report
+      uses: actions/upload-artifact@v4
+      with:
+        name: coverage-report
+        path: coverage.xml
+
+    - name: Upload test results
+      uses: actions/upload-artifact@v4
+      with:
+        name: junit-results
+        path: junit.xml
+
+    - name: Install Node.js
+      uses: actions/setup-node@v4
+      with:
+        node-version: 20
+        registry-url: https://registry.npmjs.org/
+
+    - name: Install Node.js dependencies and build UI
+      run: |
+        cd scripts
+        sh build_ui.sh
+        cd ..
+
+    - name: Build the wheel
+      run: |
+        . venv/bin/activate
+        python3 -m build -w
+
+    - name: Install created package
+      run: |
+        rm -rf venv
+        virtualenv -p python3 venv && . venv/bin/activate
+        pip install dist/*.whl
+
+    - name: Upload to Test PyPI
+      env:
+        TWINE_USERNAME: ${{ secrets.TWINE_TEST_USERNAME }}
+        TWINE_PASSWORD: ${{ secrets.TWINE_TEST_PYPI_API_TOKEN }}
+      run: |
+        . venv/bin/activate
+        pip install twine
+        twine upload --repository-url https://test.pypi.org/legacy/ dist/*
\ No newline at end of file