Skip to content

Commit

Permalink
feat: improve binary caching setting
Browse files Browse the repository at this point in the history
  • Loading branch information
mjcr99 committed Jan 30, 2025
1 parent 91eec26 commit 751fe30
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 27 deletions.
Original file line number Diff line number Diff line change
@@ -1,16 +1,6 @@
#! /usr/bin/env bash
# Copyright (C) 2024, Wazuh Inc.

# Check vcpkg installation and run it if needed
if [[ $(vcpkg --version 2>/dev/null) =~ [0-9] ]]; then
echo "vcpkg already installed."
else
git clone --branch master --single-branch https://github.com/microsoft/vcpkg.git
cd vcpkg && ./bootstrap-vcpkg.sh
export VCPKG_ROOT=$(pwd)
export PATH=$VCPKG_ROOT:$PATH
fi

# Check mono installation and run it if needed
if [[ $(mono --version 2>/dev/null) =~ [0-9] ]]; then
echo "mono already installed."
Expand All @@ -31,12 +21,14 @@ else
fi

# Set nuget as binary caching store
mono `vcpkg fetch nuget | tail -n 1` \
NUGET_PATH="/usr/local/bin/nuget"
curl -o $NUGET_PATH https://dist.nuget.org/win-x86-commandline/v6.10.2/nuget.exe
mono $NUGET_PATH \
sources add \
-source "https://nuget.pkg.github.com/wazuh/index.json" \
-name "GitHub" \
-username "wazuh" \
-password "$GH_TOKEN"
mono `vcpkg fetch nuget | tail -n 1` \
mono $NUGET_PATH \
setapikey "$GH_TOKEN" \
-source "https://nuget.pkg.github.com/wazuh/index.json"
-source "https://nuget.pkg.github.com/wazuh/index.json"
19 changes: 5 additions & 14 deletions packages/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -71,27 +71,18 @@ set_vcpkg_remote_binary_cache(){

if [[ $(mono --version 2>/dev/null) =~ [0-9] ]]; then
echo "mono already installed, proceeding"

git clone --branch master --single-branch https://github.com/microsoft/vcpkg.git
pushd vcpkg

export VCPKG_ROOT="$(pwd)"

git checkout "2024.09.30"

export VCPKG_BINARY_SOURCES="clear;nuget,GitHub,readwrite"
./bootstrap-vcpkg.sh
mono `./vcpkg fetch nuget | tail -n 1` \
NUGET_PATH="/usr/local/bin/nuget"
curl -o $NUGET_PATH https://dist.nuget.org/win-x86-commandline/v6.10.2/nuget.exe
mono $NUGET_PATH \
sources add \
-source "https://nuget.pkg.github.com/wazuh/index.json" \
-name "GitHub" \
-username "wazuh" \
-password "$vcpkg_token"
mono `./vcpkg fetch nuget | tail -n 1` \
mono $NUGET_PATH \
setapikey "$vcpkg_token" \
-source "https://nuget.pkg.github.com/wazuh/index.json"

popd
-source "https://nuget.pkg.github.com/wazuh/index.json"
else
echo "mono in not installed, remote binary caching not being enabled"
fi
Expand Down

0 comments on commit 751fe30

Please sign in to comment.