From 92198c52ab05f98cad05100480c8c4ff58b8d4a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lex=20Ruiz?= Date: Thu, 7 Mar 2024 17:13:20 +0100 Subject: [PATCH] Improve multi-os testing --- .github/workflows/build.yml | 8 ++++---- .github/workflows/r_test.yml | 35 +++++++++++++++++++++-------------- 2 files changed, 25 insertions(+), 18 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 5ecabc5404f70..2dde1ec664ed1 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -6,7 +6,7 @@ on: push: # Sequence of patterns matched against refs/heads branches: - - 'ci/*' + - "ci/*" workflow_dispatch: inputs: revision: @@ -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] @@ -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 }} \ No newline at end of file + 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 }} diff --git a/.github/workflows/r_test.yml b/.github/workflows/r_test.yml index 5dc38ea8972fa..56277c2ae903f 100644 --- a/.github/workflows/r_test.yml +++ b/.github/workflows/r_test.yml @@ -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: @@ -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 @@ -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