Skip to content

Commit

Permalink
ci: make vscode extension update more generic (#471)
Browse files Browse the repository at this point in the history
The input to the update-vscode-extensions action can now be a default devcontainer.json file.
  • Loading branch information
rjaegers authored Jun 26, 2024
1 parent 24d6697 commit 09a6958
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 51 deletions.
58 changes: 28 additions & 30 deletions .devcontainer/cpp/devcontainer-metadata-vscode.json
Original file line number Diff line number Diff line change
@@ -1,34 +1,32 @@
[
{
"remoteEnv": {
"LOCAL_WORKSPACE_FOLDER": "${localWorkspaceFolder}"
},
"customizations": {
"vscode": {
"extensions": [
"[email protected]",
"[email protected]",
"[email protected]",
"[email protected]",
"[email protected]",
"[email protected]",
"[email protected]",
"[email protected]",
"[email protected]"
{
"remoteEnv": {
"LOCAL_WORKSPACE_FOLDER": "${localWorkspaceFolder}"
},
"customizations": {
"vscode": {
"extensions": [
"[email protected]",
"[email protected]",
"[email protected]",
"[email protected]",
"[email protected]",
"[email protected]",
"[email protected]",
"[email protected]",
"[email protected]"
],
"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"
}
}
}
]
}
30 changes: 14 additions & 16 deletions .devcontainer/rust/devcontainer-metadata-vscode.json
Original file line number Diff line number Diff line change
@@ -1,18 +1,16 @@
[
{
"remoteEnv": {
"LOCAL_WORKSPACE_FOLDER": "${localWorkspaceFolder}"
},
"customizations": {
"vscode": {
"extensions": [
"[email protected]",
"[email protected]",
"[email protected]",
"[email protected]",
"[email protected]"
]
}
{
"remoteEnv": {
"LOCAL_WORKSPACE_FOLDER": "${localWorkspaceFolder}"
},
"customizations": {
"vscode": {
"extensions": [
"[email protected]",
"[email protected]",
"[email protected]",
"[email protected]",
"[email protected]"
]
}
}
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -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#*@}"

Expand All @@ -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
2 changes: 1 addition & 1 deletion .github/workflows/build-push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/update-dependencies.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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 }}

0 comments on commit 09a6958

Please sign in to comment.