Skip to content

Commit

Permalink
Improve multi-os testing
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexRuiz7 committed Mar 7, 2024
1 parent ba80f53 commit 92198c5
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 18 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
push:
# Sequence of patterns matched against refs/heads
branches:
- 'ci/*'
- "ci/*"
workflow_dispatch:
inputs:
revision:
Expand Down Expand Up @@ -36,7 +36,7 @@ jobs:
uses: ./.github/workflows/r_commit_sha.yml

build:
needs: [ version, commit_sha ]
needs: [version, commit_sha]
strategy:
matrix:
distribution: [tar, rpm, deb]
Expand Down Expand Up @@ -69,7 +69,7 @@ jobs:
needs: [version, commit_sha, assemble]
strategy:
matrix:
os: [ {suffix: "amd64", ext: "deb"}, {suffix: "x86_64", ext: "rpm"} ]
os: [{ suffix: "amd64", ext: "deb" }, { suffix: "x86_64", ext: "rpm" }]
uses: ./.github/workflows/r_test.yml
with:
package: wazuh-indexer-${{ needs.version.outputs.version }}-${{ github.event_name == 'push' && '1' || inputs.revision }}_${{ matrix.os.suffix }}_${{ needs.commit_sha.outputs.commit_sha }}.${{ matrix.os.ext }}
package: wazuh-indexer-${{ needs.version.outputs.version }}-${{ github.event_name == 'push' && '1' || inputs.revision }}_${{ matrix.os.suffix }}_${{ needs.commit_sha.outputs.commit_sha }}.${{ matrix.os.ext }}
35 changes: 21 additions & 14 deletions .github/workflows/r_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ on:
type: string

jobs:
r_test:
r_test_rpm:
if: endsWith(${{ inputs.package }}, "rpm")
runs-on: ubuntu-latest
# Permissions to upload the package
permissions:
Expand All @@ -24,20 +25,30 @@ jobs:
name: ${{ inputs.package }}
path: artifacts/dist

- name: Install package (RPM)
if: endsWith(${{ inputs.package }}, "rpm")
- name: Install package
run: |
sudo yum localinstall "artifacts/dist/${{ inputs.package }}"
- name: Install package (DEB)
if: endsWith(${{ inputs.package }}, "deb")
r_test_deb:
if: endsWith(${{ inputs.package }}, "deb")
runs-on: ubuntu-latest
# Permissions to upload the package
permissions:
packages: read
contents: read
steps:
- name: Download artifact
uses: actions/download-artifact@v4
with:
name: ${{ inputs.package }}
path: artifacts/dist

- name: Install package
run: |
sudo dpkg -i "artifacts/dist/${{ inputs.package }}"
- uses: actions/checkout@v4
if: endsWith(${{ inputs.package }}, "deb")
- name: Generate and deploy certificates
if: endsWith(${{ inputs.package }}, "deb")
uses: addnab/docker-run-action@v3
with:
image: wazuh/wazuh-certs-generator:0.0.1
Expand All @@ -56,21 +67,17 @@ jobs:
ls /certs
- run: sudo systemctl daemon-reload
if: endsWith(${{ inputs.package }}, "deb")
- if: endsWith(${{ inputs.package }}, "deb")
run: |
- run: |
if ! sudo systemctl enable wazuh-indexer.service; then
sudo journalctl --no-pager -u wazuh-indexer.service
exit 1
fi
- if: endsWith(${{ inputs.package }}, "deb")
run: |
- run: |
if ! sudo systemctl start wazuh-indexer; then
sudo journalctl --no-pager -u wazuh-indexer.service
exit 1
fi
- if: endsWith(${{ inputs.package }}, "deb")
run: |
- run: |
if ! sudo systemctl status --no-pager wazuh-indexer -n 100; then
sudo journalctl --no-pager -u wazuh-indexer.service
exit 1
Expand Down

0 comments on commit 92198c5

Please sign in to comment.