diff --git a/.github/actions/call_workflow_and_wait/action.yml b/.github/actions/call_workflow_and_wait/action.yml new file mode 100644 index 0000000000..59baa9de6d --- /dev/null +++ b/.github/actions/call_workflow_and_wait/action.yml @@ -0,0 +1,45 @@ +name: 'Call workflow and wait result' + +inputs: + ref: + description: 'Branch name' + required: true + repository: + description: 'Repository name' + required: true + workflow: + description: 'Workflow to trigger' + required: true + token: + description: 'Wazuh token' + required: true + +outputs: + dispatched_workflow_id: + value: ${{ steps.wait-workflow-compleption.outputs.dispatched_workflow_id }} + +runs: + using: "composite" + steps: + - name: Dispatch an action and get the run ID + env: + TOKEN: ${{ inputs.token }} + uses: Codex-/return-dispatch@v2.0.3 + id: return_dispatch + with: + token: ${{ env.TOKEN }} + ref: ${{ inputs.ref }} + repo: ${{ inputs.repository }} + owner: wazuh + workflow: ${{ inputs.workflow }} + workflow_timeout_seconds: 900 + workflow_inputs: '{ "architecture": "intel64", + "source_reference": ${{ github.ref_name }} }' + + - name: Wait for the workflow to complete + id: wait-workflow-compleption + run: | + gh run watch ${{steps.return_dispatch.outputs.run_id}} --repo wazuh/${{ inputs.repository }} --exit-status > /dev/null + echo 'Workflow ${{steps.return_dispatch.outputs.run_id}} finished.' + echo "dispatched_workflow_id=$${{steps.return_dispatch.outputs.run_id}}" >> $GITHUB_OUTPUT + shell: bash diff --git a/.github/workflows/test_package_build.yml b/.github/workflows/test_package_build.yml new file mode 100644 index 0000000000..7171d96a48 --- /dev/null +++ b/.github/workflows/test_package_build.yml @@ -0,0 +1,33 @@ +run-name: Test package + +on: + workflow_dispatch: + +jobs: + build-binaries-agent-macos-packages: + runs-on: ubuntu-latest + timeout-minutes: 50 + name: Test package + + steps: + - name: Checkout the wazuh-agent repository + uses: actions/checkout@v4 + with: + repository: wazuh/wazuh-agent + ref: enhancement/137-pkg-build-trigger + + - name: Call package build workflow and wait + id: workflow_call + uses: ./.github/actions/call_workflow_and_wait + with: + ref: change/137-setup-pkg-build-workflow-for-macos + repository: wazuh-agent-packages + workflow: packages-build-macos-agent.yml + token: ${{ secrets.CI_WAZUH_AGENT_PACKAGES_CLASSIC }} + + - uses: actions/download-artifact@v4 + with: + repository: wazuh-agent-packages + name: tested-wazuh-agent-package + github-token: ${{ secrets.CI_WAZUH_AGENT_PACKAGES_CLASSIC }} + run-id: ${{ steps.workflow_call.outputs.dispatched_workflow_id }}