From 65184e3c02792c6bbaf6c7341972775285c54115 Mon Sep 17 00:00:00 2001 From: Mehdi Hadeli Date: Wed, 27 Nov 2024 00:25:52 +0330 Subject: [PATCH] ci: update github action --- .github/workflows/publish.yml | 7 +++++-- scripts/install_tree_sitter.sh | 17 +++++++++-------- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 82b49db..7a44ddb 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -45,8 +45,11 @@ jobs: - name: Build Tree-Sitter binaries on ${{ matrix.os }} run: | - chmod +x ./scripts/install_tree_sitter.sh - ./scripts/install_tree_sitter.sh + if [[ "$(uname)" == "Linux" ]]; then + chmod +x ./scripts/install_tree_sitter.sh + fi + ./scripts/install_tree_sitter.sh Release net8.0 + shell: bash - name: Upload compiled binaries uses: actions/upload-artifact@v4 diff --git a/scripts/install_tree_sitter.sh b/scripts/install_tree_sitter.sh index a94fee9..483793e 100644 --- a/scripts/install_tree_sitter.sh +++ b/scripts/install_tree_sitter.sh @@ -27,15 +27,16 @@ treesitter_bin_output="tree-sitter/bins" test_bin_path="tests/UnitTests/TreeSitter.Bindings.UnitTests/bin/${mode}/$dotnet_version" ai_assist_integration_test_bin_path="tests/IntegrationTests/AIAssistant.IntegrationTests/bin/${mode}/$dotnet_version" app_bin_path="src/AIAssist/bin/${mode}/$dotnet_version" - + # Create the directory if it doesn't exist mkdir -p "${test_bin_path}" +mkdir -p "${ai_assist_integration_test_bin_path}" mkdir -p "${app_bin_path}" - + # Check for Linux if [[ "$OS" == "Linux" ]]; then echo "Detected Linux OS. Compiling for Linux..." - + # Array of output files linux_tree_sitter_output_files=("${treesitter_bin_output}/tree-sitter.so" "${app_bin_path}/tree-sitter.so" "${test_bin_path}/tree-sitter.so" "${ai_assist_integration_test_bin_path}/tree-sitter.so") @@ -53,7 +54,7 @@ if [[ "$OS" == "Linux" ]]; then # Check for Windows (MINGW or MSYS environments) elif [[ "$OS" == "MINGW"* || "$OS" == "MSYS"* ]]; then echo "Detected Windows OS. Compiling for Windows..." - + # Array of output files windows_tree_sitter_output_files=("${treesitter_bin_output}/tree-sitter.dll" "${app_bin_path}/tree-sitter.dll" "${test_bin_path}/tree-sitter.dll" "${ai_assist_integration_test_bin_path}/tree-sitter.dll") @@ -88,12 +89,12 @@ repos=() while IFS= read -r line; do # Trim leading/trailing whitespace and check if the line is empty trimmed_line=$(echo "$line" | xargs) - + if [ -z "$trimmed_line" ]; then # Stop parsing when an empty line is encountered break fi - + # Add the non-empty line to the repos array repos+=("$trimmed_line") done < "$grammar_file" @@ -105,7 +106,7 @@ for repo in "${repos[@]}"; do # Get the repository name from the URL by extracting everything after the last / repo_name=$(basename "$repo") - + # Trim any trailing or leading whitespace (including newlines) from repo_name repo_name=$(echo "$repo_name" | tr -d '[:space:]') @@ -180,4 +181,4 @@ for repo in "${repos[@]}"; do fi echo "Compilation complete for: $repo_name" -done \ No newline at end of file +done