-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: use actions instead of reusable WF for Mac OS packages
- Loading branch information
Showing
7 changed files
with
196 additions
and
44 deletions.
There are no files selected for viewing
2 changes: 1 addition & 1 deletion
2
...tions/linux_compile_repositoty/action.yml → ...tions/linux_compile_repository/action.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
name: 'Compile Mac OS Repository' | ||
description: 'Compile Mac OS Repository' | ||
inputs: | ||
architecture: | ||
description: 'Building architecture' | ||
required: true | ||
gh_token: | ||
description: 'Used token to fetch Docker images' | ||
required: true | ||
|
||
runs: | ||
using: 'composite' | ||
steps: | ||
- name: Set up Binary caching | ||
uses: ./.github/actions/vcpkg_related/cover_vcpkg_dependencies | ||
with: | ||
gh_token: ${{ inputs.gh_token }} | ||
|
||
- name: Build repository | ||
shell: bash | ||
run: | | ||
mkdir -p src/build && cd src/build && cmake .. && make -j $(sysctl -n hw.ncpu) | ||
sudo rm -rf _deps vcpkg_installed | ||
zip -r ${{ github.workspace }}/wazuh-agent-binaries-${{ inputs.architecture }}.zip ${{ github.workspace }}/ | ||
- name: Upload wazuh-agent-binaries.zip | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: wazuh-agent-binaries-${{ inputs.architecture }} | ||
path: ${{ github.workspace }}/wazuh-agent-binaries-${{ inputs.architecture }}.zip |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
name: 'Package Mac OS Binaries' | ||
description: 'Package Mac OS Binaries' | ||
inputs: | ||
architecture: | ||
description: 'Building architecture' | ||
required: true | ||
revision: | ||
description: 'Package revision' | ||
required: false | ||
is_stage: | ||
description: 'Stage package' | ||
required: false | ||
checksum: | ||
description: 'Generate package checksum' | ||
required: false | ||
|
||
runs: | ||
steps: | ||
- name: Download wazuh-agent-binaries.zip | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: wazuh-agent-binaries-${{ inputs.architecture }} | ||
|
||
- name: Set vars to build macOS package | ||
shell: bash | ||
run: | | ||
FLAGS="-a ${{ inputs.architecture }} -j $(sysctl -n hw.ncpu) -r ${{ inputs.revision }} -s /tmp --verbose " | ||
if [ "${{ inputs.is_stage }}" == "true" ]; then FLAGS+="--is_stage "; fi | ||
if [ "${{ inputs.checksum }}" == "true" ]; then FLAGS+="--checksum "; fi | ||
echo "FLAGS=$FLAGS" >> $GITHUB_ENV | ||
- name: Build macOS package | ||
shell: bash | ||
run: | | ||
sudo unzip -o wazuh-agent-binaries-${{ inputs.architecture }}.zip -d / | ||
bash packages/macos/generate_wazuh_packages.sh -i | ||
echo 'generate_wazuh_packages.sh ${{ env.FLAGS }}' | ||
sudo bash packages/macos/generate_wazuh_packages.sh ${{ env.FLAGS }} | ||
echo "PACKAGE_NAME=$(find /tmp -maxdepth 1 -type f -name *agent* -exec basename {} 2>/dev/null \;| grep -v -E "^(wazuh-agent-dbg|wazuh-agent-debuginfo)")" | tee -a $GITHUB_ENV | ||
- name: Upload wazuh agent package | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: ${{ env.PACKAGE_NAME }} | ||
path: /tmp/${{ env.PACKAGE_NAME }} | ||
|
||
- name: Upload checksums to artifact | ||
if: ${{ inputs.checksum == 'true'}} | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: ${{ env.PACKAGE_NAME }}.sha512 | ||
path: /tmp/${{ env.PACKAGE_NAME }}.sha512 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
name: 'Test Mac OS Package' | ||
description: 'Test Mac OS Package' | ||
inputs: | ||
checksum: | ||
description: 'Generate package checksum' | ||
required: false | ||
upload_to_s3: | ||
description: 'Upload package to S3' | ||
required: true | ||
|
||
runs: | ||
using: 'composite' | ||
steps: | ||
- name: Download wazuh agent package | ||
uses: actions/download-artifact@v4 | ||
with: | ||
pattern: '*.pkg*' | ||
|
||
- name: Prepare package | ||
shell: bash | ||
run: | | ||
cp wazuh-agent*/wazuh-agent* /tmp | ||
- name: Test macOS package installation | ||
shell: bash | ||
run: | | ||
package_name=$(find /tmp -type f -name "*agent*.pkg" -exec basename {} 2>/dev/null \;) | ||
echo "PACKAGE_NAME=$package_name" >> $GITHUB_ENV | ||
sudo installer -pkg /tmp/*agent*pkg -target / | sudo tee /tmp/installer.log | ||
if grep -q "The install was successful" "/tmp/installer.log"; then | ||
echo "Installation successfully." | ||
else | ||
echo "The installation could not be completed. The package will not be uploaded."; | ||
exit 1; | ||
fi | ||
- name: Set up AWS CLI | ||
if: ${{ inputs.upload_to_s3 == 'true' }} | ||
uses: aws-actions/configure-aws-credentials@v4 | ||
with: | ||
aws-access-key-id: ${{ secrets.CI_INTERNAL_DEVELOPMENT_BUCKET_USER_ACCESS_KEY }} | ||
aws-secret-access-key: ${{ secrets.CI_INTERNAL_DEVELOPMENT_BUCKET_USER_SECRET_KEY }} | ||
aws-region: ${{ secrets.CI_AWS_REGION }} | ||
|
||
- name: Upload package to S3 | ||
if: ${{ inputs.upload_to_s3 == 'true' }} | ||
uses: ./.github/actions/upload_file_to_s3 | ||
with: | ||
s3_uri: "s3://packages-dev.internal.wazuh.com/development/wazuh/5.x/main/packages" | ||
uploaded_file_name: ${{ env.PACKAGE_NAME }} | ||
uploaded_file_location: "/tmp" | ||
|
||
- name: Upload checksums to S3 | ||
if: ${{ inputs.checksum == 'true' && inputs.upload_to_s3 == 'true' }} | ||
uses: ./.github/actions/upload_file_to_s3 | ||
with: | ||
s3_uri: "s3://packages-dev.internal.wazuh.com/development/wazuh/5.x/main/packages" | ||
uploaded_file_name: ${{ env.PACKAGE_NAME }}.sha512 | ||
uploaded_file_location: "/tmp" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters