Skip to content

Commit 76d642d

Browse files
test
1 parent e23b7cc commit 76d642d

File tree

2 files changed

+41
-21
lines changed

2 files changed

+41
-21
lines changed

.github/workflows/reusable-build-test-release.yml

+31-20
Original file line numberDiff line numberDiff line change
@@ -360,20 +360,23 @@ jobs:
360360
runs-on: ubuntu-latest
361361
needs:
362362
- setup-workflow
363+
- get-called-ref
363364
if: ${{ needs.setup-workflow.outputs.skip-workflow != 'Yes' }}
365+
# outputs from `dynamic-uses` action are passed as a JSON string
364366
outputs:
365-
unit: ${{ steps.test-inventory.outputs.unit }}
366-
ucc_modinput_functional: ${{ steps.test-inventory.outputs.ucc_modinput_functional}}
367-
modinput_functional: ${{ steps.test-inventory.outputs.modinput_functional}}
368-
requirement_test: ${{ steps.test-inventory.outputs.requirement_test }}
369-
knowledge: ${{ steps.test-inventory.outputs.knowledge }}
370-
ui: ${{ steps.test-inventory.outputs.ui }}
371-
scripted_inputs: ${{ steps.test-inventory.outputs.scripted_inputs }}
372-
escu: ${{ steps.test-inventory.outputs.escu }}
367+
unit: ${{ fromJSON(steps.test-inventory.outputs.outputs).unit }}
368+
ucc_modinput_functional: ${{ fromJSON(steps.test-inventory.outputs.outputs).ucc_modinput_functional }}
369+
modinput_functional: ${{ fromJSON(steps.test-inventory.outputs.outputs).modinput_functional }}
370+
requirement_test: ${{ fromJSON(steps.test-inventory.outputs.outputs).requirement_test }}
371+
knowledge: ${{ fromJSON(steps.test-inventory.outputs).knowledge }}
372+
ui: ${{ fromJSON(steps.test-inventory.outputs).ui }}
373+
scripted_inputs: ${{ fromJSON(steps.test-inventory.outputs).scripted_inputs }}
374+
escu: ${{ fromJSON(steps.test-inventory.outputs).escu }}
373375
steps:
374-
- name: Run test inventory check
376+
- uses: jenseng/dynamic-uses@v1
375377
id: test-inventory
376-
uses: ./.github/actions/test-inventory
378+
with:
379+
uses: splunk/addonfactory-workflow-addon-release/.github/actions/test-inventory@${{ needs.get-called-ref.outputs.ref }}
377380

378381
# Two separate unit test jobs needed as jobs that depend on unit-test success can't proceed
379382
# if any matrix job fails. Currently python 3.9 may fail as it's not supported in all TAs.
@@ -383,8 +386,13 @@ jobs:
383386
name: Unit tests python 3.7
384387
if: ${{ needs.test-inventory.outputs.unit == 'true' }}
385388
runs-on: ubuntu-latest
389+
# inputs to `dynamic-uses` step
390+
env:
391+
python_version: 3.7
392+
GH_TOKEN_ADMIN: ${{ secrets.GH_TOKEN_ADMIN }}
386393
needs:
387394
- test-inventory
395+
- get-called-ref
388396
permissions:
389397
actions: read
390398
deployments: read
@@ -393,20 +401,24 @@ jobs:
393401
statuses: read
394402
checks: write
395403
steps:
396-
- name: Run unit tests for python 3.7
397-
id: unit-tests-3_7
398-
uses: ./.github/actions/unit-tests
404+
- uses: jenseng/dynamic-uses@v1
399405
with:
400-
python_version: '3.7'
401-
GH_TOKEN_ADMIN: ${{ secrets.GH_TOKEN_ADMIN }}
406+
uses: splunk/addonfactory-workflow-addon-release/.github/actions/unit-tests@${{ needs.get-called-ref.outputs.ref }}
407+
# inputs need to provided as a valid JSON string
408+
with: ${{ toJSON(env) }}
402409

403410
run-unit-tests-3_9:
404411
name: Unit tests python 3.9
405412
if: ${{ needs.test-inventory.outputs.unit == 'true' }}
406413
runs-on: ubuntu-latest
407414
continue-on-error: true
415+
# inputs to `dynamic-uses` step
416+
env:
417+
python_version: 3.7
418+
GH_TOKEN_ADMIN: ${{ secrets.GH_TOKEN_ADMIN }}
408419
needs:
409420
- test-inventory
421+
- get-called-ref
410422
permissions:
411423
actions: read
412424
deployments: read
@@ -415,12 +427,11 @@ jobs:
415427
statuses: read
416428
checks: write
417429
steps:
418-
- name: Run unit tests for python 3.9
419-
id: unit-tests-3_9
420-
uses: ./.github/actions/unit-tests
430+
- uses: jenseng/dynamic-uses@v1
421431
with:
422-
python_version: '3.9'
423-
GH_TOKEN_ADMIN: ${{ secrets.GH_TOKEN_ADMIN }}
432+
uses: splunk/addonfactory-workflow-addon-release/.github/actions/unit-tests@${{ needs.get-called-ref.outputs.ref }}
433+
# inputs need to provided as a valid JSON string
434+
with: ${{ toJSON(env) }}
424435

425436
build:
426437
name: Build python 3.7

.github/workflows/reusable-lightweight.yml

+10-1
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,7 @@ jobs:
263263
- review-secrets
264264
- semgrep
265265
- run-unit-tests-3_7
266+
- get-called-ref
266267
strategy:
267268
fail-fast: false
268269
matrix:
@@ -274,8 +275,16 @@ jobs:
274275
contents: write
275276
packages: read
276277
steps:
278+
- name: Checkout repository
279+
uses: jenseng/dynamic-uses@v1
280+
env:
281+
repository: splunk/addonfactory-workflow-addon-release
282+
ref: ${{ needs.get-called-ref.outputs.ref }}
283+
with:
284+
uses: actions/checkout@v3
285+
with: ${{ toJSON(env) }}
277286
- name: Run build
278-
uses: splunk/addonfactory-workflow-addon-release/.github/actions/build@fix/lightweight-workflow-ADDON-66448
287+
uses: ./.github/actions/build
279288
with:
280289
python_version: ${{ matrix.python-version }}
281290
SA_GH_USER_NAME: ${{ secrets.SA_GH_USER_NAME }}

0 commit comments

Comments
 (0)