Skip to content

Commit

Permalink
ci(tests): Add sdk tests
Browse files Browse the repository at this point in the history
  • Loading branch information
julienloizelet committed Nov 1, 2024
1 parent 9c14e6f commit b445eb4
Showing 1 changed file with 106 additions and 0 deletions.
106 changes: 106 additions & 0 deletions .github/workflows/sdk-chain-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
name: SDK chain tests
# To test all the SDK chain, we run Standalone Bouncer tests, as it depends on:
# - PHP Bouncer Lib
# - Remediation Engine Lib
# - LAPI client lib
# - PHP common lib

on:
push:
branches:
- main
paths-ignore:
- '**.md'
pull_request:
workflow_dispatch:
inputs:
php_common_branch:
type: string
description: The PHP common branch to use
required: true
default: "main"
lapi_client_branch:
type: string
description: The LAPI client branch to use
required: true
default: "main"
remediation_engine_branch:
type: string
description: The Remediation Engine branch to use
required: true
default: "main"
bouncer_lib_branch:
type: string
description: The PHP bouncer library branch to use
required: true
default: "main"

permissions:
contents: read

env:
# Allow ddev get to use a GitHub token to prevent rate limiting by tests
DDEV_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PHP_COMMON_BRANCH: ${{ github.event.inputs.php_common_branch }}
LAPI_CLIENT_BRANCH: ${{ github.event.inputs.lapi_client_branch }}
REMEDIATION_ENGINE_BRANCH: ${{ github.event.inputs.remediation_engine_branch }}
BOUNCER_LIB_BRANCH: ${{ github.event.inputs.bouncer_lib_branch }}

jobs:
prepare-data:
name: Prepare data
outputs:
php_common_branch: ${{ steps.prepare-php-common.outputs.branch }}
lapi_client_branch: ${{ steps.prepare-lapi-client.outputs.branch }}
remediation_engine_branch: ${{ steps.prepare-remediation-engine.outputs.branch }}
bouncer_lib_branch: ${{ steps.prepare-bouncer-lib.outputs.branch }}
runs-on: ubuntu-latest
steps:
- name: Prepare PHP common data
id: prepare-php-common
run: |
if [ "${{ github.event_name }}" == "push" ] || [ "${{ github.event_name }}" == "pull_request" ]; then
echo "branch=main" >> $GITHUB_OUTPUT
else
echo "branch=${{ env.PHP_COMMON_BRANCH }}" >> $GITHUB_OUTPUT
fi
- name: Prepare LAPI client data
id: prepare-lapi-client
run: |
if [ "${{ github.event_name }}" == "push" ] || [ "${{ github.event_name }}" == "pull_request" ]; then
echo 'branch=main' >> $GITHUB_OUTPUT
else
echo "branch=${{ env.LAPI_CLIENT_BRANCH }}" >> $GITHUB_OUTPUT
fi
- name: Prepare Remediation Engine data
id: prepare-remediation-engine
run: |
if [ "${{ github.event_name }}" == "push" ] || [ "${{ github.event_name }}" == "pull_request" ]; then
echo 'branch=main' >> $GITHUB_OUTPUT
else
echo "branch=${{ env.REMEDIATION_ENGINE_BRANCH }}" >> $GITHUB_OUTPUT
fi
- name: Prepare Bouncer lib data
id: prepare-bouncer-lib
run: |
if [ "${{ github.event_name }}" == "push" ] || [ "${{ github.event_name }}" == "pull_request" ]; then
echo 'branch=${{ github.ref_name }}' >> $GITHUB_OUTPUT
else
echo "branch=${{ env.BOUNCER_LIB_BRANCH }}" >> $GITHUB_OUTPUT
fi
test-standalone-bouncer:
needs: prepare-data
name: Run Standalone Bouncer tests
if: ${{ !contains(github.event.head_commit.message, 'chore(') }}
uses: crowdsecurity/cs-standalone-php-bouncer/.github/workflows/php-sdk-development-tests.yml@main
with:
php_common_branch: ${{ needs.prepare-data.outputs.php_common_branch }}
lapi_client_branch: ${{ needs.prepare-data.outputs.lapi_client_branch }}
remediation_engine_branch: ${{ needs.prepare-data.outputs.remediation_engine_branch }}
bouncer_lib_branch: ${{ needs.prepare-data.outputs.bouncer_lib_branch }}


0 comments on commit b445eb4

Please sign in to comment.