Skip to content

Commit

Permalink
Add test workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexRuiz7 committed Mar 4, 2024
1 parent da63894 commit a85dc7d
Show file tree
Hide file tree
Showing 2 changed files with 62 additions and 1 deletion.
17 changes: 16 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,24 @@ jobs:
# skip arm64 until we have arm runners
- architecture: arm64
- distribution: tar

uses: ./.github/workflows/r_assemble.yml
with:
architecture: ${{ matrix.architecture }}
distribution: ${{ matrix.distribution }}
min: wazuh-indexer-min_${{ needs.version.outputs.version }}-${{ github.event_name == 'push' && '1' || inputs.revision }}-${{ matrix.architecture }}_${{ needs.commit_sha.outputs.commit_sha }}.${{ matrix.distribution }}

test:
needs: [version, commit_sha, assemble]
strategy:
matrix:
distribution: [tar, rpm, deb]
architecture: [x64, arm64]
exclude:
# skip arm64 until we have arm runners
- architecture: arm64
- distribution: [tar, rpm]
uses: ./.github/workflows/r_assemble.yml
with:
architecture: ${{ matrix.architecture }}
distribution: ${{ matrix.distribution }}
package: wazuh-indexer-${{ needs.version.outputs.version }}-${{ github.event_name == 'push' && '1' || inputs.revision }}-${{ matrix.architecture }}_${{ needs.commit_sha.outputs.commit_sha }}.${{ matrix.distribution }}
46 changes: 46 additions & 0 deletions .github/workflows/r_test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Test (reusable)

# This workflow runs when any of the following occur:
# - Run from another workflow
on:
workflow_call:
inputs:
distribution:
description: "One of [ 'tar', 'rpm', 'deb' ]"
default: "rpm"
required: true
type: string
architecture:
description: "One of [ 'x64', 'arm64' ]"
default: "x64"
required: true
type: string
package:
description: "The name of the package to download."
required: true
type: string

jobs:
r_test:
runs-on: ubuntu-latest
# Permissions to upload the package
permissions:
packages: read
contents: read
steps:
- uses: actions/checkout@v4
- name: Download artifact
uses: actions/download-artifact@v4
with:
name: ${{ inputs.package }}
path: artifacts/dist

- name: Run `test.sh`
if: ${{ inputs.distribution == 'deb' }}
run: |
# bash scripts/test.sh -p artifacts/dist/${{ inputs.package }}
dpkg -i "artifacts/dist/${{ inputs.package }}";
systemctl daemon-reload;
systemctl enable wazuh-indexer.service;
systemctl start wazuh-indexer;
systemctl status wazuh-indexer

0 comments on commit a85dc7d

Please sign in to comment.