Skip to content

Commit b445eb4

Browse files
ci(tests): Add sdk tests
1 parent 9c14e6f commit b445eb4

File tree

1 file changed

+106
-0
lines changed

1 file changed

+106
-0
lines changed

.github/workflows/sdk-chain-tests.yml

Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
name: SDK chain tests
2+
# To test all the SDK chain, we run Standalone Bouncer tests, as it depends on:
3+
# - PHP Bouncer Lib
4+
# - Remediation Engine Lib
5+
# - LAPI client lib
6+
# - PHP common lib
7+
8+
on:
9+
push:
10+
branches:
11+
- main
12+
paths-ignore:
13+
- '**.md'
14+
pull_request:
15+
workflow_dispatch:
16+
inputs:
17+
php_common_branch:
18+
type: string
19+
description: The PHP common branch to use
20+
required: true
21+
default: "main"
22+
lapi_client_branch:
23+
type: string
24+
description: The LAPI client branch to use
25+
required: true
26+
default: "main"
27+
remediation_engine_branch:
28+
type: string
29+
description: The Remediation Engine branch to use
30+
required: true
31+
default: "main"
32+
bouncer_lib_branch:
33+
type: string
34+
description: The PHP bouncer library branch to use
35+
required: true
36+
default: "main"
37+
38+
permissions:
39+
contents: read
40+
41+
env:
42+
# Allow ddev get to use a GitHub token to prevent rate limiting by tests
43+
DDEV_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
44+
PHP_COMMON_BRANCH: ${{ github.event.inputs.php_common_branch }}
45+
LAPI_CLIENT_BRANCH: ${{ github.event.inputs.lapi_client_branch }}
46+
REMEDIATION_ENGINE_BRANCH: ${{ github.event.inputs.remediation_engine_branch }}
47+
BOUNCER_LIB_BRANCH: ${{ github.event.inputs.bouncer_lib_branch }}
48+
49+
jobs:
50+
prepare-data:
51+
name: Prepare data
52+
outputs:
53+
php_common_branch: ${{ steps.prepare-php-common.outputs.branch }}
54+
lapi_client_branch: ${{ steps.prepare-lapi-client.outputs.branch }}
55+
remediation_engine_branch: ${{ steps.prepare-remediation-engine.outputs.branch }}
56+
bouncer_lib_branch: ${{ steps.prepare-bouncer-lib.outputs.branch }}
57+
runs-on: ubuntu-latest
58+
steps:
59+
- name: Prepare PHP common data
60+
id: prepare-php-common
61+
run: |
62+
if [ "${{ github.event_name }}" == "push" ] || [ "${{ github.event_name }}" == "pull_request" ]; then
63+
echo "branch=main" >> $GITHUB_OUTPUT
64+
else
65+
echo "branch=${{ env.PHP_COMMON_BRANCH }}" >> $GITHUB_OUTPUT
66+
fi
67+
68+
- name: Prepare LAPI client data
69+
id: prepare-lapi-client
70+
run: |
71+
if [ "${{ github.event_name }}" == "push" ] || [ "${{ github.event_name }}" == "pull_request" ]; then
72+
echo 'branch=main' >> $GITHUB_OUTPUT
73+
else
74+
echo "branch=${{ env.LAPI_CLIENT_BRANCH }}" >> $GITHUB_OUTPUT
75+
fi
76+
77+
- name: Prepare Remediation Engine data
78+
id: prepare-remediation-engine
79+
run: |
80+
if [ "${{ github.event_name }}" == "push" ] || [ "${{ github.event_name }}" == "pull_request" ]; then
81+
echo 'branch=main' >> $GITHUB_OUTPUT
82+
else
83+
echo "branch=${{ env.REMEDIATION_ENGINE_BRANCH }}" >> $GITHUB_OUTPUT
84+
fi
85+
86+
- name: Prepare Bouncer lib data
87+
id: prepare-bouncer-lib
88+
run: |
89+
if [ "${{ github.event_name }}" == "push" ] || [ "${{ github.event_name }}" == "pull_request" ]; then
90+
echo 'branch=${{ github.ref_name }}' >> $GITHUB_OUTPUT
91+
else
92+
echo "branch=${{ env.BOUNCER_LIB_BRANCH }}" >> $GITHUB_OUTPUT
93+
fi
94+
95+
test-standalone-bouncer:
96+
needs: prepare-data
97+
name: Run Standalone Bouncer tests
98+
if: ${{ !contains(github.event.head_commit.message, 'chore(') }}
99+
uses: crowdsecurity/cs-standalone-php-bouncer/.github/workflows/php-sdk-development-tests.yml@main
100+
with:
101+
php_common_branch: ${{ needs.prepare-data.outputs.php_common_branch }}
102+
lapi_client_branch: ${{ needs.prepare-data.outputs.lapi_client_branch }}
103+
remediation_engine_branch: ${{ needs.prepare-data.outputs.remediation_engine_branch }}
104+
bouncer_lib_branch: ${{ needs.prepare-data.outputs.bouncer_lib_branch }}
105+
106+

0 commit comments

Comments
 (0)