Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add workflow to test package building #448

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 44 additions & 0 deletions .github/actions/call_workflow_and_wait/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
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
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: ${{ github.token }}

- uses: actions/download-artifact@v4
with:
repository: wazuh-agent-packages
name: tested-wazuh-agent-package
github-token: ${{ github.token }}
run-id: ${{ steps.workflow_call.outputs.dispatched_workflow_id }}
Loading