Skip to content

Commit

Permalink
feat: add workflow to test package building
Browse files Browse the repository at this point in the history
  • Loading branch information
mjcr99 committed Dec 19, 2024
1 parent 1eb2738 commit d60d825
Show file tree
Hide file tree
Showing 2 changed files with 78 additions and 0 deletions.
45 changes: 45 additions & 0 deletions .github/actions/call_workflow_and_wait/action.yml
Original file line number Diff line number Diff line change
@@ -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-/[email protected]
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
33 changes: 33 additions & 0 deletions .github/workflows/test_package_build.yml
Original file line number Diff line number Diff line change
@@ -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 }}

0 comments on commit d60d825

Please sign in to comment.