Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
62 changes: 0 additions & 62 deletions .github/workflows/dockerhub_push.yml

This file was deleted.

31 changes: 0 additions & 31 deletions .github/workflows/pdp_tests.yml

This file was deleted.

74 changes: 3 additions & 71 deletions .github/workflows/pdp_cicd.yml → .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,77 +10,9 @@ permissions:

jobs:
pdp-tests:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- uses: actions/checkout@v3
with:
repository: permitio/permit-opa
ref: main
path: './permit-opa'
token: ${{ secrets.CLONE_REPO_TOKEN }}

- name: Pre build PDP tests
run: |
echo "${{ github.event.release.tag_name }}" | cut -d '-' -f 1 > permit_pdp_version
rm -rf custom
mkdir custom
build_root="$PWD"
cd ./permit-opa
find * \( -name '*go*' -o -name 'LICENSE.md' \) -print0 | xargs -0 tar -czf "$build_root"/custom/custom_opa.tar.gz --exclude '.*'

- uses: robinraju/release-downloader@v1
with:
repository: permitio/datasync
latest: true
fileName: factstore_server*
token: ${{ secrets.CLONE_REPO_TOKEN }}
out-file-path: "factdb"

- name: Build and load image for PDP E2E tests
uses: docker/build-push-action@v5
with:
push: false
load: true
context: .
build-args: |
ALLOW_MISSING_FACTSTORE=false
platforms: linux/amd64
tags: permitio/pdp-v2:test
cache-from: type=gha
cache-to: type=gha,mode=max

- uses: actions/checkout@v3
with:
repository: permitio/permit-backend
ref: main
path: './permit-backend'
token: ${{ secrets.CLONE_REPO_TOKEN }}

- name: Python setup
uses: actions/setup-python@v5
with:
python-version: '3.11.8'

- name: Run Pytests
run: |
python -m pip install --upgrade pip
pip install ".[dev]"
pytest -s --cache-clear horizon/tests/

- name: Run E2E tests
working-directory: ./permit-backend/proactive_tests/sidecar
run: |
pip install requests pydantic==1.8.2 docker
python sidecar_tester.py -k ${{ secrets.PERMIT_TESTS_TOKEN }} -u https://api.permit.io -2 permitio/pdp-v2:test --no-pull
# Call the reusable tests workflow.
uses: ./.github/workflows/tests.yml@v2
secrets: inherit

build-and-push-pdp-vanilla:
needs: pdp-tests
Expand Down
133 changes: 133 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
name: PDP CI Tests

on:
pull_request:
push:
branches: [master, main, v*]
workflow_call:
secrets:
PDP_TESTER_API_KEY:
required: true
CLONE_REPO_TOKEN:
required: true

jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v3
- uses: pre-commit/[email protected]

pytests:
runs-on: ubuntu-latest
steps:
- name: Python setup
uses: actions/setup-python@v5
with:
python-version: '3.11.8'

- name: Checkout code
uses: actions/checkout@v4

- name: Run Pytests
run: |
python -m pip install --upgrade pip
pip install ".[dev]"
pytest -s --cache-clear horizon/tests/

pdp-tester:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

- uses: actions/checkout@v4
with:
repository: permitio/permit-opa
ref: main
path: './permit-opa'
token: ${{ secrets.CLONE_REPO_TOKEN }}

- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Pre build PDP tests
run: |
echo "next" > permit_pdp_version
rm -rf custom
mkdir custom
build_root="$PWD"
cd ./permit-opa
find * \( -name '*go*' -o -name 'LICENSE.md' \) -print0 | xargs -0 tar -czf "$build_root"/custom/custom_opa.tar.gz --exclude '.*'

- uses: robinraju/release-downloader@v1
with:
repository: permitio/datasync
latest: true
fileName: factstore_server*
token: ${{ secrets.CLONE_REPO_TOKEN }}
out-file-path: "factdb"

- name: Build and load PDP Docker image
uses: docker/build-push-action@v5
with:
push: false
load: true
context: .
build-args: |
ALLOW_MISSING_FACTSTORE=false
platforms: linux/amd64
tags: permitio/pdp-v2:next
cache-from: type=gha
cache-to: type=gha,mode=max

# Checkout the pdp-tester repository
- name: Checkout pdp-tester repository
uses: actions/checkout@v3
with:
repository: "permitio/pdp-tester"
token: ${{ secrets.CLONE_REPO_TOKEN }}
path: './pdp-tester'

# Setup Python environment
- name: Setup Python
uses: actions/setup-python@v3
with:
python-version: "3.12"

# Install dependencies for pdp-tester
- name: Install pdp-tester dependencies
working-directory: ./pdp-tester
run: |
pip install -r requirements.txt

# Run pdp-tester
- name: Run pdp-tester
working-directory: ./pdp-tester
env:
TOKEN: ${{ secrets.PDP_TESTER_API_KEY }}
LOCAL_TAGS: '["next"]'
INCLUDE_TAGS: '[]'
AUTO_REMOVE: "False"
SKIP_GENERATE: "True"
ENVIRONMENT: '{"PDP_ENABLE_FACTDB": true}'
ENABLE_APM: "False"
run: |
python -m pdp_tester.main

- name: Print Docker container logs
if: always()
run: |
echo "Fetching logs for all Docker containers..."
for container in $(docker ps -aq); do
echo "========================================"
echo "Logs for container: $container"
echo "----------------------------------------"
docker logs "$container" || true
echo "========================================"
echo ""
done