1212 description : The LAPI client json to use
1313 required : true
1414 default : ' ["main","crowdsecurity/php-lapi-client"]'
15+ capi_client_json :
16+ type : string
17+ description : The CAPI client json to use
18+ required : true
19+ default : ' ["main","crowdsecurity/php-capi-client"]'
1520 remediation_engine_json :
1621 type : string
1722 description : The Remediation Engine json to use
3742 description : The LAPI client json to use
3843 required : true
3944 default : ' ["main"]'
45+ capi_client_json :
46+ type : string
47+ description : The CAPI client json to use
48+ required : true
49+ default : ' ["main"]'
4050 remediation_engine_json :
4151 type : string
4252 description : The Remediation Engine json to use
@@ -49,9 +59,16 @@ permissions:
4959env :
5060 # Allow ddev get to use a GitHub token to prevent rate limiting by tests
5161 DDEV_GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
62+ STANDALONE_BOUNCER_REPO : crowdsecurity/cs-standalone-php-bouncer
63+ BOUNCER_LIB_REPO : crowdsecurity/php-cs-bouncer
64+ REMEDIATION_ENGINE_REPO : crowdsecurity/php-remediation-engine
65+ CAPI_CLIENT_REPO : crowdsecurity/php-capi-client
66+ LAPI_CLIENT_REPO : crowdsecurity/php-lapi-client
67+ PHP_COMMON_REPO : crowdsecurity/php-common
5268 PHP_COMMON_JSON : ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.php_common_json || inputs.php_common_json }}
5369 LAPI_CLIENT_JSON : ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.lapi_client_json || inputs.lapi_client_json }}
5470 REMEDIATION_ENGINE_JSON : ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.remediation_engine_json || inputs.remediation_engine_json }}
71+ CAPI_CLIENT_JSON : ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.capi_client_json || inputs.capi_client_json }}
5572
5673jobs :
5774 test-suite :
6582 if : ${{ !contains(github.event.head_commit.message, 'chore(') }}
6683 env :
6784 EXTENSION_PATH : " my-code/crowdsec-bouncer-lib"
68- BOUNCER_LIB_REPO : crowdsecurity/php-cs-bouncer
85+ REMEDIATION_ENGINE_PATH : " my-code/php-remediation-engine"
86+ CAPI_CLIENT_PATH : " my-code/php-capi-client"
87+ LAPI_CLIENT_PATH : " my-code/php-lapi-client"
88+ PHP_COMMON_PATH : " my-code/php-common"
6989 DDEV_PROJECT : " crowdsec-bouncer-lib"
7090 JP_TEST_IP : " 210.249.74.42"
7191 IPV6_TEST_IP : " 2001:0db8:0000:85a3:0000:0000:ac1f:8001"
@@ -75,32 +95,39 @@ jobs:
7595 - name : Set PHP common variables
7696 id : set-common-data
7797 run : |
78- echo "major_tag=$(curl -Ls -o /dev/null -w %{url_effective} https://github.com/crowdsecurity/php-common/releases/latest | grep -oP "\/tag\/v\K(.*)$" | cut -d. -f1)" >> $GITHUB_OUTPUT
7998 echo "branch=${{ fromJson(env.PHP_COMMON_JSON)[0] }}" >> $GITHUB_OUTPUT
8099 if [ "${{ inputs.is_call }}" = "true" ]; then
81- echo "repo=crowdsecurity/php-common " >> $GITHUB_OUTPUT
100+ echo "repo=${{env.PHP_COMMON_REPO}} " >> $GITHUB_OUTPUT
82101 else
83102 echo "repo=${{ fromJson(env.PHP_COMMON_JSON)[1] }}" >> $GITHUB_OUTPUT
84103 fi
85104
86105 - name : Set LAPI client variables
87106 id : set-lapi-client-data
88107 run : |
89- echo "major_tag=$(curl -Ls -o /dev/null -w %{url_effective} https://github.com/crowdsecurity/php-lapi-client/releases/latest | grep -oP "\/tag\/v\K(.*)$" | cut -d. -f1)" >> $GITHUB_OUTPUT
90108 echo "branch=${{ fromJson(env.LAPI_CLIENT_JSON)[0] }}" >> $GITHUB_OUTPUT
91109 if [ "${{ inputs.is_call }}" = "true" ]; then
92- echo "repo=crowdsecurity/php-lapi-client " >> $GITHUB_OUTPUT
110+ echo "repo=${{env.LAPI_CLIENT_REPO}} " >> $GITHUB_OUTPUT
93111 else
94112 echo "repo=${{ fromJson(env.LAPI_CLIENT_JSON)[1] }}" >> $GITHUB_OUTPUT
95113 fi
96114
115+ - name : Set CAPI client variables
116+ id : set-capi-client-data
117+ run : |
118+ echo "branch=${{ fromJson(env.CAPI_CLIENT_JSON)[0] }}" >> $GITHUB_OUTPUT
119+ if [ "${{ inputs.is_call }}" = "true" ]; then
120+ echo "repo=${{env.CAPI_CLIENT_REPO}}" >> $GITHUB_OUTPUT
121+ else
122+ echo "repo=${{ fromJson(env.CAPI_CLIENT_JSON)[1] }}" >> $GITHUB_OUTPUT
123+ fi
124+
97125 - name : Set Remediation engine variables
98126 id : set-remediation-engine-data
99127 run : |
100- echo "major_tag=$(curl -Ls -o /dev/null -w %{url_effective} https://github.com/crowdsecurity/php-remediation-engine/releases/latest | grep -oP "\/tag\/v\K(.*)$" | cut -d. -f1)" >> $GITHUB_OUTPUT
101128 echo "branch=${{ fromJson(env.REMEDIATION_ENGINE_JSON)[0] }}" >> $GITHUB_OUTPUT
102129 if [ "${{ inputs.is_call }}" = "true" ]; then
103- echo "repo=crowdsecurity/php-remediation-engine " >> $GITHUB_OUTPUT
130+ echo "repo=${{env.REMEDIATION_ENGINE_REPO}} " >> $GITHUB_OUTPUT
104131 else
105132 echo "repo=${{ fromJson(env.REMEDIATION_ENGINE_JSON)[1] }}" >> $GITHUB_OUTPUT
106133 fi
@@ -165,38 +192,67 @@ jobs:
165192 with :
166193 repository : ${{ steps.set-common-data.outputs.repo}}
167194 ref : ${{ steps.set-common-data.outputs.branch }}
168- path : my-code/php-common
195+ path : ${{env.PHP_COMMON_PATH}}
169196
170- - name : Clone PHP LAPI client
197+ - name : Clone LAPI client
171198 uses : actions/checkout@v4
172199 with :
173200 repository : ${{ steps.set-lapi-client-data.outputs.repo }}
174201 ref : ${{ steps.set-lapi-client-data.outputs.branch }}
175- path : my-code/php-lapi-client
202+ path : ${{env.LAPI_CLIENT_PATH}}
203+
204+ - name : Clone CAPI client
205+ uses : actions/checkout@v4
206+ with :
207+ repository : ${{ steps.set-capi-client-data.outputs.repo }}
208+ ref : ${{ steps.set-capi-client-data.outputs.branch }}
209+ path : ${{env.CAPI_CLIENT_PATH}}
176210
177211 - name : Clone PHP remediation engine
178212 uses : actions/checkout@v4
179213 with :
180214 repository : ${{ steps.set-remediation-engine-data.outputs.repo }}
181215 ref : ${{ steps.set-remediation-engine-data.outputs.branch }}
182- path : my-code/php-remediation-engine
216+ path : ${{env.REMEDIATION_ENGINE_PATH}}
183217
184218 - name : Add local repositories to composer
185219 run : |
220+ # Bouncer lib
186221 ddev exec --raw composer config repositories.0 '{"type": "path", "url": "../php-common", "options": {"symlink": true}}' --working-dir ./${{ env.EXTENSION_PATH }}
187222 ddev exec --raw composer config repositories.1 '{"type": "path", "url": "../php-lapi-client", "options": {"symlink": true}}' --working-dir ./${{ env.EXTENSION_PATH }}
188223 ddev exec --raw composer config repositories.2 '{"type": "path", "url": "../php-remediation-engine", "options": {"symlink": true}}' --working-dir ./${{ env.EXTENSION_PATH }}
224+ ddev exec --raw composer config repositories.3 '{"type": "path", "url": "../php-capi-client", "options": {"symlink": true}}' --working-dir ./${{ env.EXTENSION_PATH }}
189225
190226 - name : Modify dependencies to use development aliases
191227 run : |
192- composer require crowdsec/common:"dev-${{ steps.set-common-data.outputs.branch }} as ${{ steps.set-common-data.outputs.major_tag }}.999.0" --no-update --working-dir ./${{env.EXTENSION_PATH}}
193- composer require crowdsec/lapi-client:"dev-${{ steps.set-lapi-client-data.outputs.branch }} as ${{ steps.set-lapi-client-data.outputs.major_tag }}.999.0" --no-update --working-dir ./${{env.EXTENSION_PATH}}
194- composer require crowdsec/remediation-engine:"dev-${{ steps.set-remediation-engine-data.outputs.branch }} as ${{ steps.set-remediation-engine-data.outputs.major_tag }}.999.0" --no-update --working-dir ./${{env.EXTENSION_PATH}}
195-
196- cat ./${{env.EXTENSION_PATH}}/composer.json
228+ # Bouncer lib
229+ composer require crowdsec/common:"dev-${{ steps.set-common-data.outputs.branch }} as 999.999.0" --no-update --working-dir ./${{env.EXTENSION_PATH}}
230+ composer require crowdsec/lapi-client:"dev-${{ steps.set-lapi-client-data.outputs.branch }} as 999.999.0" --no-update --working-dir ./${{env.EXTENSION_PATH}}
231+ composer require crowdsec/remediation-engine:"dev-${{ steps.set-remediation-engine-data.outputs.branch }} as 999.999.0" --no-update --working-dir ./${{env.EXTENSION_PATH}}
232+ composer require crowdsec/capi-client:"dev-${{ steps.set-capi-client-data.outputs.branch }} as 999.999.0" --no-update --working-dir ./${{env.EXTENSION_PATH}}
233+ # Remediation engine
234+ composer require crowdsec/common:"dev-${{ steps.set-common-data.outputs.branch }} as 999.999.0" --no-update --working-dir ./${{env.REMEDIATION_ENGINE_PATH}}
235+ composer require crowdsec/lapi-client:"dev-${{ steps.set-lapi-client-data.outputs.branch }} as 999.999.0" --no-update --working-dir ./${{env.REMEDIATION_ENGINE_PATH}}
236+ composer require crowdsec/capi-client:"dev-${{ steps.set-capi-client-data.outputs.branch }} as 999.999.0" --no-update --working-dir ./${{env.REMEDIATION_ENGINE_PATH}}
237+ # CAPI client
238+ composer require crowdsec/common:"dev-${{ steps.set-common-data.outputs.branch }} as 999.999.0" --no-update --working-dir ./${{env.CAPI_CLIENT_PATH}}
239+ # LAPI client
240+ composer require crowdsec/common:"dev-${{ steps.set-common-data.outputs.branch }} as 999.999.0" --no-update --working-dir ./${{env.LAPI_CLIENT_PATH}}
197241
198242 - name : Validate composer.json
199- run : ddev composer validate --strict --working-dir ./${{env.EXTENSION_PATH}}
243+ run : |
244+ # Bouncer lib
245+ cat ./${{env.EXTENSION_PATH}}/composer.json
246+ ddev composer validate --strict --working-dir ./${{env.EXTENSION_PATH}}
247+ # Remediation engine
248+ cat ./${{env.REMEDIATION_ENGINE_PATH}}/composer.json
249+ ddev composer validate --strict --working-dir ./${{env.REMEDIATION_ENGINE_PATH}}
250+ # CAPI client
251+ cat ./${{env.CAPI_CLIENT_PATH}}/composer.json
252+ ddev composer validate --strict --working-dir ./${{env.CAPI_CLIENT_PATH}}
253+ # LAPI client
254+ cat ./${{env.LAPI_CLIENT_PATH}}/composer.json
255+ ddev composer validate --strict --working-dir ./${{env.LAPI_CLIENT_PATH}}
200256
201257 - name : Install CrowdSec lib dependencies
202258 run : |
@@ -223,6 +279,15 @@ jobs:
223279 echo $LAPI_CLIENT_VERSION
224280 exit 1
225281 fi
282+ CAPI_CLIENT_VERSION=$(ddev composer show crowdsec/capi-client --working-dir ./${{env.EXTENSION_PATH}} | grep -oP "versions : \* \K(.*)")
283+ if [[ $CAPI_CLIENT_VERSION == "dev-${{ steps.set-capi-client-data.outputs.branch }}" ]]
284+ then
285+ echo "CAPI_CLIENT_VERSION COMPARISON OK"
286+ else
287+ echo "CAPI_CLIENT_VERSION COMPARISON KO"
288+ echo $CAPI_CLIENT_VERSION
289+ exit 1
290+ fi
226291 REMEDIATION_ENGINE_VERSION=$(ddev composer show crowdsec/remediation-engine --working-dir ./${{env.EXTENSION_PATH}} | grep -oP "versions : \* \K(.*)")
227292 if [[ $REMEDIATION_ENGINE_VERSION == "dev-${{ steps.set-remediation-engine-data.outputs.branch }}" ]]
228293 then
0 commit comments