From 09a6958ff7728165a47ad9d805746648d7649ce2 Mon Sep 17 00:00:00 2001 From: Ron <45816308+rjaegers@users.noreply.github.com> Date: Wed, 26 Jun 2024 08:54:41 +0200 Subject: [PATCH] ci: make vscode extension update more generic (#471) The input to the update-vscode-extensions action can now be a default devcontainer.json file. --- .../cpp/devcontainer-metadata-vscode.json | 58 +++++++++---------- .../rust/devcontainer-metadata-vscode.json | 30 +++++----- .../update-vscode-extensions.sh | 4 +- .github/workflows/build-push.yml | 2 +- .github/workflows/update-dependencies.yml | 4 +- 5 files changed, 47 insertions(+), 51 deletions(-) diff --git a/.devcontainer/cpp/devcontainer-metadata-vscode.json b/.devcontainer/cpp/devcontainer-metadata-vscode.json index 093fcdd8..011378ad 100644 --- a/.devcontainer/cpp/devcontainer-metadata-vscode.json +++ b/.devcontainer/cpp/devcontainer-metadata-vscode.json @@ -1,34 +1,32 @@ -[ - { - "remoteEnv": { - "LOCAL_WORKSPACE_FOLDER": "${localWorkspaceFolder}" - }, - "customizations": { - "vscode": { - "extensions": [ - "llvm-vs-code-extensions.vscode-clangd@0.1.28", - "marus25.cortex-debug@1.12.1", - "matepek.vscode-catch2-test-adapter@4.12.0", - "mhutchie.git-graph@1.30.0", - "ms-vscode.cmake-tools@1.18.42", - "ms-vscode.cpptools@1.20.5", - "ms-vsliveshare.vsliveshare@1.0.5932", - "SonarSource.sonarlint-vscode@4.6.0", - "xaver.clang-format@1.9.0" +{ + "remoteEnv": { + "LOCAL_WORKSPACE_FOLDER": "${localWorkspaceFolder}" + }, + "customizations": { + "vscode": { + "extensions": [ + "llvm-vs-code-extensions.vscode-clangd@0.1.28", + "marus25.cortex-debug@1.12.1", + "matepek.vscode-catch2-test-adapter@4.12.0", + "mhutchie.git-graph@1.30.0", + "ms-vscode.cmake-tools@1.18.42", + "ms-vscode.cpptools@1.20.5", + "ms-vsliveshare.vsliveshare@1.0.5932", + "SonarSource.sonarlint-vscode@4.6.0", + "xaver.clang-format@1.9.0" + ], + "settings": { + "C_Cpp.intelliSenseEngine": "disabled", + "C_Cpp.formatting": "clangFormat", + "clangd.arguments": [ + "--query-driver=/opt/**/arm-none-eabi-*", + "--compile-commands-dir=${userHome}/.amp" ], - "settings": { - "C_Cpp.intelliSenseEngine": "disabled", - "C_Cpp.formatting": "clangFormat", - "clangd.arguments": [ - "--query-driver=/opt/**/arm-none-eabi-*", - "--compile-commands-dir=${userHome}/.amp" - ], - "cmake.copyCompileCommands": "${userHome}/.amp/compile_commands.json", - "cortex-debug.gdbPath": "gdb-multiarch", - "cortex-debug.objdumpPath": "arm-none-eabi-objdump", - "sonarlint.pathToCompileCommands": "/root/.amp/compile_commands.json" - } + "cmake.copyCompileCommands": "${userHome}/.amp/compile_commands.json", + "cortex-debug.gdbPath": "gdb-multiarch", + "cortex-debug.objdumpPath": "arm-none-eabi-objdump", + "sonarlint.pathToCompileCommands": "/root/.amp/compile_commands.json" } } } -] +} diff --git a/.devcontainer/rust/devcontainer-metadata-vscode.json b/.devcontainer/rust/devcontainer-metadata-vscode.json index 48a08a8d..0df7d64e 100644 --- a/.devcontainer/rust/devcontainer-metadata-vscode.json +++ b/.devcontainer/rust/devcontainer-metadata-vscode.json @@ -1,18 +1,16 @@ -[ - { - "remoteEnv": { - "LOCAL_WORKSPACE_FOLDER": "${localWorkspaceFolder}" - }, - "customizations": { - "vscode": { - "extensions": [ - "mhutchie.git-graph@1.30.0", - "ms-vsliveshare.vsliveshare@1.0.5932", - "rust-lang.rust-analyzer@0.3.2011", - "tamasfe.even-better-toml@0.19.2", - "usernamehw.errorlens@3.20.0" - ] - } +{ + "remoteEnv": { + "LOCAL_WORKSPACE_FOLDER": "${localWorkspaceFolder}" + }, + "customizations": { + "vscode": { + "extensions": [ + "mhutchie.git-graph@1.30.0", + "ms-vsliveshare.vsliveshare@1.0.5932", + "rust-lang.rust-analyzer@0.3.2011", + "tamasfe.even-better-toml@0.19.2", + "usernamehw.errorlens@3.20.0" + ] } } -] +} diff --git a/.github/actions/update-vscode-extensions/update-vscode-extensions.sh b/.github/actions/update-vscode-extensions/update-vscode-extensions.sh index c00930c7..6ce28091 100755 --- a/.github/actions/update-vscode-extensions/update-vscode-extensions.sh +++ b/.github/actions/update-vscode-extensions/update-vscode-extensions.sh @@ -26,7 +26,7 @@ get_github_releasenotes() { done } -for EXTENSION in $(echo $JSON | jq -r '.[].customizations.vscode.extensions | flatten[]'); do +for EXTENSION in $(echo $JSON | jq -r '.customizations.vscode.extensions | flatten[]'); do NAME="${EXTENSION%%@*}" CURRENT_VERSION="${EXTENSION#*@}" @@ -46,7 +46,7 @@ for EXTENSION in $(echo $JSON | jq -r '.[].customizations.vscode.extensions | fl done EXTENSIONS=$(echo "[${EXTENSIONS::-1}]" | jq 'sort_by(. | ascii_downcase)') -echo $JSON | jq '.[].customizations.vscode.extensions = $extensions' --argjson extensions "$EXTENSIONS" > $FILE +echo $JSON | jq '.customizations.vscode.extensions = $extensions' --argjson extensions "$EXTENSIONS" > $FILE echo "$UPDATE_DETAILS_MARKDOWN" echo "$UPDATED_EXTENSIONS_JSON" > updated-extensions.json diff --git a/.github/workflows/build-push.yml b/.github/workflows/build-push.yml index fd84d6e1..00927b2e 100644 --- a/.github/workflows/build-push.yml +++ b/.github/workflows/build-push.yml @@ -61,7 +61,7 @@ jobs: type=semver,pattern={{major}} # Generate image LABEL for devcontainer.metadata # the sed expression is a workaround for quotes being eaten in arrays (e.g. ["x", "y", "z"] -> ["x",y,"z"]) - - run: echo "metadata=$(jq -cj '.' .devcontainer/${{ matrix.flavor }}/devcontainer-metadata-vscode.json | sed 's/,"/, "/g')" >> "$GITHUB_OUTPUT" + - run: echo "metadata=$(jq -cj '[.]' .devcontainer/${{ matrix.flavor }}/devcontainer-metadata-vscode.json | sed 's/,"/, "/g')" >> "$GITHUB_OUTPUT" id: devcontainer-metadata - uses: docker/build-push-action@31159d49c0d4756269a0940a750801a1ea5d7003 # v6.1.0 id: build-and-push diff --git a/.github/workflows/update-dependencies.yml b/.github/workflows/update-dependencies.yml index b436c707..c8229e7a 100644 --- a/.github/workflows/update-dependencies.yml +++ b/.github/workflows/update-dependencies.yml @@ -39,7 +39,7 @@ jobs: with: commit-message: "Update ${{ join(fromJson(steps.update-packages.outputs.updated-dependencies), ', ') }}" branch: feature/amp-devcontainer-${{ matrix.flavor }}/update-apt-packages - title: "chore(deps,${{ matrix.flavor }}): update ${{ join(fromJson(steps.update-packages.outputs.updated-dependencies), ', ') }}" + title: "chore(deps, ${{ matrix.flavor }}): update ${{ join(fromJson(steps.update-packages.outputs.updated-dependencies), ', ') }}" labels: dependencies,apt token: ${{ steps.token.outputs.token }} update-vscode-extensions: @@ -73,6 +73,6 @@ jobs: > Before merging this PR, please conduct a manual test checking basic functionality of the updated plug-ins. There are no automated tests for the VS Code Extension updates. ${{ steps.update-extensions.outputs.markdown-summary }} - title: "chore(deps,${{ matrix.flavor }}): update ${{ join(fromJson(steps.update-extensions.outputs.updated-dependencies), ', ') }}" + title: "chore(deps, ${{ matrix.flavor }}): update ${{ join(fromJson(steps.update-extensions.outputs.updated-dependencies), ', ') }}" labels: dependencies,vscode-extensions token: ${{ steps.token.outputs.token }}