Build & Test #33
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build & Test | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| branches: [main] | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| env: | |
| FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true | |
| jobs: | |
| build: | |
| name: Build SDK | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4 | |
| - uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5 | |
| with: | |
| python-version: '3.9' | |
| - uses: actions/setup-java@17f84c3641ba7b8f6deff6309fc4c864478f5d62 # v3 | |
| with: | |
| distribution: 'zulu' | |
| java-version: '11' | |
| - name: Download OpenAPI Generator | |
| run: | | |
| mkdir -p sdk_generator/open_api_tool | |
| wget -q https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/7.12.0/openapi-generator-cli-7.12.0.jar \ | |
| -O sdk_generator/open_api_tool/openapi-generator-cli-7.12.0.jar | |
| echo "33e7dfa7a1f04d58405ee12ae19e2c6fc2a91497cf2e56fa68f1875a95cbf220 sdk_generator/open_api_tool/openapi-generator-cli-7.12.0.jar" | sha256sum -c | |
| - name: Build SDK | |
| run: | | |
| python -m pip install -r ./requirements.txt | |
| export BRANCH_NAME=${GITHUB_REF#refs/heads/} | |
| export BUILD_JOB_ID=$GITHUB_RUN_ID | |
| export BUILD_VERSION=$(python setup.py --version) | |
| python ./sdk_generator/generate_sdk.py | |
| env: | |
| SWAGGERHUB_API_KEY: ${{ secrets.SWAGGERHUB_API_KEY }} | |
| - uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4 | |
| with: | |
| name: chkp_ai_security_sdk | |
| path: chkp_ai_security_sdk | |
| lint: | |
| name: Lint | |
| runs-on: ubuntu-latest | |
| needs: build | |
| steps: | |
| - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4 | |
| - uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5 | |
| with: | |
| python-version: '3.9' | |
| - uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4 | |
| with: | |
| name: chkp_ai_security_sdk | |
| path: chkp_ai_security_sdk | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -r requirements.txt | |
| pip install flake8 | |
| - name: Flake8 | |
| run: flake8 chkp_ai_security_sdk/ tests/ --exclude=chkp_ai_security_sdk/generated,chkp_ai_security_sdk/generated_browse,chkp_ai_security_sdk/generated_async,chkp_ai_security_sdk/generated_browse_async | |
| integration: | |
| name: Integration Tests | |
| runs-on: ubuntu-latest | |
| needs: build | |
| if: | | |
| github.event_name == 'push' || | |
| github.event_name == 'workflow_dispatch' || | |
| (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository) | |
| env: | |
| CP_CI_CLIENT_ID: ${{ secrets.CP_CI_CLIENT_ID }} | |
| CP_CI_ACCESS_KEY: ${{ secrets.CP_CI_ACCESS_KEY }} | |
| CP_CI_GATEWAY: ${{ secrets.CP_CI_GATEWAY }} | |
| steps: | |
| - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4 | |
| - uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5 | |
| with: | |
| python-version: '3.9' | |
| - uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4 | |
| with: | |
| name: chkp_ai_security_sdk | |
| path: chkp_ai_security_sdk | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -r requirements.txt | |
| pip install -e . | |
| pip install pytest pytest-timeout | |
| - name: Check secrets available | |
| id: secrets-check | |
| run: | | |
| if [ -z "$CP_CI_CLIENT_ID" ]; then | |
| echo "available=false" >> "$GITHUB_OUTPUT" | |
| echo "::warning::Skipping integration tests — secrets not configured" | |
| else | |
| echo "available=true" >> "$GITHUB_OUTPUT" | |
| fi | |
| - name: Run integration tests | |
| if: steps.secrets-check.outputs.available == 'true' | |
| run: python -m pytest tests/ -v --timeout=300 | |
| env: | |
| CP_CI_CLIENT_ID: ${{ secrets.CP_CI_CLIENT_ID }} | |
| CP_CI_ACCESS_KEY: ${{ secrets.CP_CI_ACCESS_KEY }} | |
| CP_CI_GATEWAY: ${{ secrets.CP_CI_GATEWAY }} |