From d15f3bd624fb0e403ad410f403bd4d497b087dd8 Mon Sep 17 00:00:00 2001 From: Robin Jones Date: Wed, 27 Dec 2023 14:52:28 +0000 Subject: [PATCH 1/9] Move devcontainers into seperate directories Adjust GH workflow. --- .devcontainer/{ => All}/Dockerfile.All | 0 .../Dockerfile.All => All/Dockerfile.All.SRC} | 0 .devcontainer/{ => All}/devcontainer.json | 10 +--- .../{ => All}/scripts/git-pull-repos.sh | 0 .../{ => All}/scripts/non-root-user.sh | 0 .../{ => AzureRTOS}/Dockerfile.AzureRTOS | 0 .../Dockerfile.AzureRTOS.SRC} | 0 .devcontainer/AzureRTOS/devcontainer.json | 48 +++++++++++++++++++ .../{ => ChibiOS}/Dockerfile.ChibiOS | 0 .../Dockerfile.ChibiOS.SRC} | 0 .devcontainer/ChibiOS/devcontainer.json | 48 +++++++++++++++++++ .devcontainer/{ => ESP32}/Dockerfile.ESP32 | 2 +- .../Dockerfile.ESP32.SRC} | 0 .devcontainer/ESP32/devcontainer.json | 48 +++++++++++++++++++ .devcontainer/{ => TI}/Dockerfile.TI | 0 .../Dockerfile.TI => TI/Dockerfile.TI.SRC} | 0 .devcontainer/TI/devcontainer.json | 48 +++++++++++++++++++ .github/workflows/devcontainer-all.yaml | 6 +-- .github/workflows/devcontainer-azurertos.yaml | 6 +-- .github/workflows/devcontainer-chibios.yaml | 6 +-- .github/workflows/devcontainer-esp32.yml | 6 +-- .github/workflows/devcontainer-smoketest.yaml | 8 ++-- .github/workflows/devcontainer-ti.yaml | 8 ++-- 23 files changed, 216 insertions(+), 28 deletions(-) rename .devcontainer/{ => All}/Dockerfile.All (100%) rename .devcontainer/{sources/Dockerfile.All => All/Dockerfile.All.SRC} (100%) rename .devcontainer/{ => All}/devcontainer.json (79%) rename .devcontainer/{ => All}/scripts/git-pull-repos.sh (100%) rename .devcontainer/{ => All}/scripts/non-root-user.sh (100%) rename .devcontainer/{ => AzureRTOS}/Dockerfile.AzureRTOS (100%) rename .devcontainer/{sources/Dockerfile.AzureRTOS => AzureRTOS/Dockerfile.AzureRTOS.SRC} (100%) create mode 100644 .devcontainer/AzureRTOS/devcontainer.json rename .devcontainer/{ => ChibiOS}/Dockerfile.ChibiOS (100%) rename .devcontainer/{sources/Dockerfile.ChibiOS => ChibiOS/Dockerfile.ChibiOS.SRC} (100%) create mode 100644 .devcontainer/ChibiOS/devcontainer.json rename .devcontainer/{ => ESP32}/Dockerfile.ESP32 (98%) rename .devcontainer/{sources/Dockerfile.ESP32 => ESP32/Dockerfile.ESP32.SRC} (100%) create mode 100644 .devcontainer/ESP32/devcontainer.json rename .devcontainer/{ => TI}/Dockerfile.TI (100%) rename .devcontainer/{sources/Dockerfile.TI => TI/Dockerfile.TI.SRC} (100%) create mode 100644 .devcontainer/TI/devcontainer.json diff --git a/.devcontainer/Dockerfile.All b/.devcontainer/All/Dockerfile.All similarity index 100% rename from .devcontainer/Dockerfile.All rename to .devcontainer/All/Dockerfile.All diff --git a/.devcontainer/sources/Dockerfile.All b/.devcontainer/All/Dockerfile.All.SRC similarity index 100% rename from .devcontainer/sources/Dockerfile.All rename to .devcontainer/All/Dockerfile.All.SRC diff --git a/.devcontainer/devcontainer.json b/.devcontainer/All/devcontainer.json similarity index 79% rename from .devcontainer/devcontainer.json rename to .devcontainer/All/devcontainer.json index 8b3b1617e4..2e10fe7514 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/All/devcontainer.json @@ -1,13 +1,7 @@ { - "name": "nanoFramework", - // Adjust this file to choose the platform you want using the prebuild containers: - // - Dockerfile.All = you can build anything but it's a very large container - // - Dockerfile.AzureRTOS = for AzureRTOS targets - // - Dockerfile.ChibiOS = for ChibiOS based targets (ex: STM32, Netduino, Orgpal) - // - Dockerfile.ESP32 = for ESP32 targets - // - Dockerfile.TI = for TI targets + "name": "nanoFramework-All", // If you prefer, you can use the source files and adjust them where they are located, - // To do this, prefix 'sources'. e.g. 'sources/Dockerfile.All'. + // To do this, change the "dockerFile" to use 'Dockerfile.All.SRC'. // This will allow you to customize and build the container source and add anything you may need on top. "dockerFile": "Dockerfile.All", "context": ".", diff --git a/.devcontainer/scripts/git-pull-repos.sh b/.devcontainer/All/scripts/git-pull-repos.sh similarity index 100% rename from .devcontainer/scripts/git-pull-repos.sh rename to .devcontainer/All/scripts/git-pull-repos.sh diff --git a/.devcontainer/scripts/non-root-user.sh b/.devcontainer/All/scripts/non-root-user.sh similarity index 100% rename from .devcontainer/scripts/non-root-user.sh rename to .devcontainer/All/scripts/non-root-user.sh diff --git a/.devcontainer/Dockerfile.AzureRTOS b/.devcontainer/AzureRTOS/Dockerfile.AzureRTOS similarity index 100% rename from .devcontainer/Dockerfile.AzureRTOS rename to .devcontainer/AzureRTOS/Dockerfile.AzureRTOS diff --git a/.devcontainer/sources/Dockerfile.AzureRTOS b/.devcontainer/AzureRTOS/Dockerfile.AzureRTOS.SRC similarity index 100% rename from .devcontainer/sources/Dockerfile.AzureRTOS rename to .devcontainer/AzureRTOS/Dockerfile.AzureRTOS.SRC diff --git a/.devcontainer/AzureRTOS/devcontainer.json b/.devcontainer/AzureRTOS/devcontainer.json new file mode 100644 index 0000000000..3d99e0e14b --- /dev/null +++ b/.devcontainer/AzureRTOS/devcontainer.json @@ -0,0 +1,48 @@ +{ + "name": "nanoFramework-AzureRTOS", + // If you prefer, you can use the source files and adjust them where they are located, + // To do this, change the "dockerFile" to use 'Dockerfile.AzureRTOS.SRC'. + // This will allow you to customize and build the container source and add anything you may need on top. + "dockerFile": "Dockerfile.AzureRTOS", + "context": ".", + "mounts": [ + // Bind the Unix socket the Docker daemon listens on by default + "source=/var/run/docker.sock,target=/var/run/docker.sock,type=bind", + // Keep command history + "source=nano-bashhistory,target=/home/vscode/commandhistory,type=volume", + // OPTIONAL: Mount .azure folder for seamless az cli auth + // "source=${env:HOME}${env:USERPROFILE}/.azure,target=/home/vscode/.azure,type=bind" + ], + // Set the *default* container specific settings.json values on container create. + "customizations": { + "vscode": { + "settings": { + "cmake.preferredGenerators": [ + "Ninja" + ], + "cmake.generator": "Ninja", + "cmake.autoRestartBuild" : true, + "cmake.configureSettings": { + "CMAKE_MAKE_PROGRAM":"/usr/bin/ninja" + }, + "cmake.configureOnOpen": false + }, + // Add the IDs of extensions you want installed when the container is created. + "extensions": [ + "ms-vsliveshare.vsliveshare-pack", + "streetsidesoftware.code-spell-checker", + "twxs.cmake", + "ms-vscode.cmake-tools", + "xaver.clang-format" + ] + } + } + // You can pull all the repos with the latest changes, this is only valid if you are using the ./sources/Dockerfile.All containers + // "postAttachCommand": "/usr/local/git-pull-repos.sh" + // Use 'forwardPorts' to make a list of ports inside the container available locally. + // "forwardPorts": [], + // Use 'postCreateCommand' to run commands after the container is created. + // "postCreateCommand": "terraform --version", + // Uncomment to connect as a non-root user. See https: //aka.ms/vscode-remote/containers/non-root. + // ,"remoteUser": "vscode" +} diff --git a/.devcontainer/Dockerfile.ChibiOS b/.devcontainer/ChibiOS/Dockerfile.ChibiOS similarity index 100% rename from .devcontainer/Dockerfile.ChibiOS rename to .devcontainer/ChibiOS/Dockerfile.ChibiOS diff --git a/.devcontainer/sources/Dockerfile.ChibiOS b/.devcontainer/ChibiOS/Dockerfile.ChibiOS.SRC similarity index 100% rename from .devcontainer/sources/Dockerfile.ChibiOS rename to .devcontainer/ChibiOS/Dockerfile.ChibiOS.SRC diff --git a/.devcontainer/ChibiOS/devcontainer.json b/.devcontainer/ChibiOS/devcontainer.json new file mode 100644 index 0000000000..27f71f2f7f --- /dev/null +++ b/.devcontainer/ChibiOS/devcontainer.json @@ -0,0 +1,48 @@ +{ + "name": "nanoFramework-ChibiOS", + // Adjust this file to choose the platform you want using the prebuild containers: + // To do this, change the "dockerFile" to use 'Dockerfile.ChibiOS.SRC'. + // This will allow you to customize and build the container source and add anything you may need on top. + "dockerFile": "Dockerfile.ChibiOS", + "context": ".", + "mounts": [ + // Bind the Unix socket the Docker daemon listens on by default + "source=/var/run/docker.sock,target=/var/run/docker.sock,type=bind", + // Keep command history + "source=nano-bashhistory,target=/home/vscode/commandhistory,type=volume", + // OPTIONAL: Mount .azure folder for seamless az cli auth + // "source=${env:HOME}${env:USERPROFILE}/.azure,target=/home/vscode/.azure,type=bind" + ], + // Set the *default* container specific settings.json values on container create. + "customizations": { + "vscode": { + "settings": { + "cmake.preferredGenerators": [ + "Ninja" + ], + "cmake.generator": "Ninja", + "cmake.autoRestartBuild" : true, + "cmake.configureSettings": { + "CMAKE_MAKE_PROGRAM":"/usr/bin/ninja" + }, + "cmake.configureOnOpen": false + }, + // Add the IDs of extensions you want installed when the container is created. + "extensions": [ + "ms-vsliveshare.vsliveshare-pack", + "streetsidesoftware.code-spell-checker", + "twxs.cmake", + "ms-vscode.cmake-tools", + "xaver.clang-format" + ] + } + } + // You can pull all the repos with the latest changes, this is only valid if you are using the ./sources/Dockerfile.All containers + // "postAttachCommand": "/usr/local/git-pull-repos.sh" + // Use 'forwardPorts' to make a list of ports inside the container available locally. + // "forwardPorts": [], + // Use 'postCreateCommand' to run commands after the container is created. + // "postCreateCommand": "terraform --version", + // Uncomment to connect as a non-root user. See https: //aka.ms/vscode-remote/containers/non-root. + // ,"remoteUser": "vscode" +} diff --git a/.devcontainer/Dockerfile.ESP32 b/.devcontainer/ESP32/Dockerfile.ESP32 similarity index 98% rename from .devcontainer/Dockerfile.ESP32 rename to .devcontainer/ESP32/Dockerfile.ESP32 index 64c9733403..71bde7bad9 100644 --- a/.devcontainer/Dockerfile.ESP32 +++ b/.devcontainer/ESP32/Dockerfile.ESP32 @@ -1 +1 @@ -FROM ghcr.io/nanoframework/dev-container-esp32:v2.28 +FROM ghcr.io/nanoframework/dev-container-esp32:v2.28 diff --git a/.devcontainer/sources/Dockerfile.ESP32 b/.devcontainer/ESP32/Dockerfile.ESP32.SRC similarity index 100% rename from .devcontainer/sources/Dockerfile.ESP32 rename to .devcontainer/ESP32/Dockerfile.ESP32.SRC diff --git a/.devcontainer/ESP32/devcontainer.json b/.devcontainer/ESP32/devcontainer.json new file mode 100644 index 0000000000..987eac7827 --- /dev/null +++ b/.devcontainer/ESP32/devcontainer.json @@ -0,0 +1,48 @@ +{ + "name": "nanoFramework-ESP32", + // Adjust this file to choose the platform you want using the prebuild containers: + // To do this, change the "dockerFile" to use 'Dockerfile.ESP32.SRC'. + // This will allow you to customize and build the container source and add anything you may need on top. + "dockerFile": "Dockerfile.ESP32", + "context": ".", + "mounts": [ + // Bind the Unix socket the Docker daemon listens on by default + "source=/var/run/docker.sock,target=/var/run/docker.sock,type=bind", + // Keep command history + "source=nano-bashhistory,target=/home/vscode/commandhistory,type=volume", + // OPTIONAL: Mount .azure folder for seamless az cli auth + // "source=${env:HOME}${env:USERPROFILE}/.azure,target=/home/vscode/.azure,type=bind" + ], + // Set the *default* container specific settings.json values on container create. + "customizations": { + "vscode": { + "settings": { + "cmake.preferredGenerators": [ + "Ninja" + ], + "cmake.generator": "Ninja", + "cmake.autoRestartBuild" : true, + "cmake.configureSettings": { + "CMAKE_MAKE_PROGRAM":"/usr/bin/ninja" + }, + "cmake.configureOnOpen": false + }, + // Add the IDs of extensions you want installed when the container is created. + "extensions": [ + "ms-vsliveshare.vsliveshare-pack", + "streetsidesoftware.code-spell-checker", + "twxs.cmake", + "ms-vscode.cmake-tools", + "xaver.clang-format" + ] + } + } + // You can pull all the repos with the latest changes, this is only valid if you are using the ./sources/Dockerfile.All containers + // "postAttachCommand": "/usr/local/git-pull-repos.sh" + // Use 'forwardPorts' to make a list of ports inside the container available locally. + // "forwardPorts": [], + // Use 'postCreateCommand' to run commands after the container is created. + // "postCreateCommand": "terraform --version", + // Uncomment to connect as a non-root user. See https: //aka.ms/vscode-remote/containers/non-root. + // ,"remoteUser": "vscode" +} diff --git a/.devcontainer/Dockerfile.TI b/.devcontainer/TI/Dockerfile.TI similarity index 100% rename from .devcontainer/Dockerfile.TI rename to .devcontainer/TI/Dockerfile.TI diff --git a/.devcontainer/sources/Dockerfile.TI b/.devcontainer/TI/Dockerfile.TI.SRC similarity index 100% rename from .devcontainer/sources/Dockerfile.TI rename to .devcontainer/TI/Dockerfile.TI.SRC diff --git a/.devcontainer/TI/devcontainer.json b/.devcontainer/TI/devcontainer.json new file mode 100644 index 0000000000..7aa3122ef3 --- /dev/null +++ b/.devcontainer/TI/devcontainer.json @@ -0,0 +1,48 @@ +{ + "name": "nanoFramework-TI", + // Adjust this file to choose the platform you want using the prebuild containers: + // To do this, change the "dockerFile" to use 'Dockerfile.TI.SRC'. + // This will allow you to customize and build the container source and add anything you may need on top. + "dockerFile": "Dockerfile.TI", + "context": ".", + "mounts": [ + // Bind the Unix socket the Docker daemon listens on by default + "source=/var/run/docker.sock,target=/var/run/docker.sock,type=bind", + // Keep command history + "source=nano-bashhistory,target=/home/vscode/commandhistory,type=volume", + // OPTIONAL: Mount .azure folder for seamless az cli auth + // "source=${env:HOME}${env:USERPROFILE}/.azure,target=/home/vscode/.azure,type=bind" + ], + // Set the *default* container specific settings.json values on container create. + "customizations": { + "vscode": { + "settings": { + "cmake.preferredGenerators": [ + "Ninja" + ], + "cmake.generator": "Ninja", + "cmake.autoRestartBuild" : true, + "cmake.configureSettings": { + "CMAKE_MAKE_PROGRAM":"/usr/bin/ninja" + }, + "cmake.configureOnOpen": false + }, + // Add the IDs of extensions you want installed when the container is created. + "extensions": [ + "ms-vsliveshare.vsliveshare-pack", + "streetsidesoftware.code-spell-checker", + "twxs.cmake", + "ms-vscode.cmake-tools", + "xaver.clang-format" + ] + } + } + // You can pull all the repos with the latest changes, this is only valid if you are using the ./sources/Dockerfile.All containers + // "postAttachCommand": "/usr/local/git-pull-repos.sh" + // Use 'forwardPorts' to make a list of ports inside the container available locally. + // "forwardPorts": [], + // Use 'postCreateCommand' to run commands after the container is created. + // "postCreateCommand": "terraform --version", + // Uncomment to connect as a non-root user. See https: //aka.ms/vscode-remote/containers/non-root. + // ,"remoteUser": "vscode" +} diff --git a/.github/workflows/devcontainer-all.yaml b/.github/workflows/devcontainer-all.yaml index 18ed7639da..8893615f0a 100644 --- a/.github/workflows/devcontainer-all.yaml +++ b/.github/workflows/devcontainer-all.yaml @@ -5,7 +5,7 @@ name: Build Dev Container for all platforms env: GCR_IMAGE: ghcr.io/nanoframework/dev-container-all - GCR_FILE: .devcontainer/sources/Dockerfile.All + GCR_FILE: .devcontainer/All/Dockerfile.All.SRC on: push: @@ -23,11 +23,11 @@ jobs: steps: - name: Checkout Repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Get container version run: | - $dockerfileContent = Get-Content(".devcontainer/Dockerfile.All") + $dockerfileContent = Get-Content(".devcontainer/All/Dockerfile.All") $dockerfileContent -match '(?<=\:)(?:[v]\d+.\d+)' $containerVersion = $Matches[0].ToString() echo "GCR_VERSION=$containerVersion" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf-8 -Append diff --git a/.github/workflows/devcontainer-azurertos.yaml b/.github/workflows/devcontainer-azurertos.yaml index 98990bd989..56a98d5ee8 100644 --- a/.github/workflows/devcontainer-azurertos.yaml +++ b/.github/workflows/devcontainer-azurertos.yaml @@ -5,7 +5,7 @@ name: Build Dev Container for Azure RTOS env: GCR_IMAGE: ghcr.io/nanoframework/dev-container-azure-rtos - GCR_FILE: .devcontainer/sources/Dockerfile.AzureRTOS + GCR_FILE: .devcontainer/AzureRTOS/Dockerfile.AzureRTOS.SRC on: push: @@ -23,11 +23,11 @@ jobs: steps: - name: Checkout Repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Get container version run: | - $dockerfileContent = Get-Content(".devcontainer/Dockerfile.AzureRTOS") + $dockerfileContent = Get-Content(".devcontainer/AzureRTOS/Dockerfile.AzureRTOS") $dockerfileContent -match '(?<=\:)(?:[v]\d+.\d+)' $containerVersion = $Matches[0].ToString() echo "GCR_VERSION=$containerVersion" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf-8 -Append diff --git a/.github/workflows/devcontainer-chibios.yaml b/.github/workflows/devcontainer-chibios.yaml index ac6058bf74..202a50d69f 100644 --- a/.github/workflows/devcontainer-chibios.yaml +++ b/.github/workflows/devcontainer-chibios.yaml @@ -5,7 +5,7 @@ name: Build Dev Container for ChibiOS env: GCR_IMAGE: ghcr.io/nanoframework/dev-container-chibios - GCR_FILE: .devcontainer/sources/Dockerfile.ChibiOS + GCR_FILE: .devcontainer/ChibiOS/Dockerfile.ChibiOS.SRC on: push: @@ -23,11 +23,11 @@ jobs: steps: - name: Checkout Repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Get container version run: | - $dockerfileContent = Get-Content(".devcontainer/Dockerfile.ChibiOS") + $dockerfileContent = Get-Content(".devcontainer/ChibiOS/Dockerfile.ChibiOS") $dockerfileContent -match '(?<=\:)(?:[v]\d+.\d+)' $containerVersion = $Matches[0].ToString() echo "GCR_VERSION=$containerVersion" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf-8 -Append diff --git a/.github/workflows/devcontainer-esp32.yml b/.github/workflows/devcontainer-esp32.yml index beec2de4dd..7f5bcd8f46 100644 --- a/.github/workflows/devcontainer-esp32.yml +++ b/.github/workflows/devcontainer-esp32.yml @@ -5,7 +5,7 @@ name: Build Dev Container for ESP32 env: GCR_IMAGE: ghcr.io/nanoframework/dev-container-esp32 - GCR_FILE: .devcontainer/sources/Dockerfile.ESP32 + GCR_FILE: .devcontainer/ESP32/Dockerfile.ESP32.SRC on: push: @@ -23,11 +23,11 @@ jobs: steps: - name: Checkout Repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Get container version run: | - $dockerfileContent = Get-Content(".devcontainer/Dockerfile.ESP32") + $dockerfileContent = Get-Content(".devcontainer/ESP32/Dockerfile.ESP32") $dockerfileContent -match '(?<=\:)(?:[v]\d+.\d+)' $containerVersion = $Matches[0].ToString() echo "GCR_VERSION=$containerVersion" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf-8 -Append diff --git a/.github/workflows/devcontainer-smoketest.yaml b/.github/workflows/devcontainer-smoketest.yaml index 34297c39b2..a0f1246533 100644 --- a/.github/workflows/devcontainer-smoketest.yaml +++ b/.github/workflows/devcontainer-smoketest.yaml @@ -3,7 +3,7 @@ name: Smoketest Dockerfile builds for selected targets on: pull_request: paths: - - '.devcontainer/sources/*' + - '.devcontainer/**/*' - '.github/workflows/*' # push: # paths: @@ -61,10 +61,10 @@ jobs: - name: Adjust devcontainer.json for ${{ matrix.container }} source run: | # Move into the .devcontainer directory - pushd .devcontainer + pushd .devcontainer/${{ matrix.container }} # Target the dockerfile source. - sed -i -- 's|"dockerFile": "Dockerfile.All"|"dockerFile": "sources/Dockerfile.${{ matrix.container }}"|g' devcontainer.json + sed -i -- 's|"dockerFile": "Dockerfile.${{ matrix.container }}"|"dockerFile": "Dockerfile.${{ matrix.container }}.SRC"|g' devcontainer.json # Move out of the .devcontainer directory popd @@ -74,7 +74,9 @@ jobs: with: push: never runCmd: | + pushd .devcontainer/${{ matrix.container }} # Build target: cmake --preset=${{ matrix.target }} -DCMAKE_BUILD_TYPE=${{ matrix.build-type }} cmake --build build + popd diff --git a/.github/workflows/devcontainer-ti.yaml b/.github/workflows/devcontainer-ti.yaml index 3c935a1ea7..4c6333f3b2 100644 --- a/.github/workflows/devcontainer-ti.yaml +++ b/.github/workflows/devcontainer-ti.yaml @@ -5,14 +5,14 @@ name: Build Dev Container for TI env: GCR_IMAGE: ghcr.io/nanoframework/dev-container-ti - GCR_FILE: .devcontainer/sources/Dockerfile.TI + GCR_FILE: .devcontainer/TI/Dockerfile.TI.SRC on: push: branches: - main paths: - - '**Dockerfile.TI' + - '**Dockerfile.TI.SRC' workflow_dispatch: @@ -23,11 +23,11 @@ jobs: steps: - name: Checkout Repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Get container version run: | - $dockerfileContent = Get-Content(".devcontainer/Dockerfile.TI") + $dockerfileContent = Get-Content(".devcontainer/TI/Dockerfile.TI") $dockerfileContent -match '(?<=\:)(?:[v]\d+.\d+)' $containerVersion = $Matches[0].ToString() echo "GCR_VERSION=$containerVersion" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf-8 -Append From c6b42cad43b13d908355ec0fa6f77be6363834f8 Mon Sep 17 00:00:00 2001 From: Robin Jones Date: Wed, 27 Dec 2023 15:33:04 +0000 Subject: [PATCH 2/9] Use smoketests before PR. Improve push action --- .github/workflows/devcontainer-all.yaml | 13 +++++++------ .github/workflows/devcontainer-azurertos.yaml | 13 +++++++------ .github/workflows/devcontainer-chibios.yaml | 13 +++++++------ .github/workflows/devcontainer-esp32.yml | 13 +++++++------ .github/workflows/devcontainer-smoketest.yaml | 12 +++++------- .github/workflows/devcontainer-ti.yaml | 15 ++++++++------- 6 files changed, 41 insertions(+), 38 deletions(-) diff --git a/.github/workflows/devcontainer-all.yaml b/.github/workflows/devcontainer-all.yaml index 8893615f0a..3672f3d8e5 100644 --- a/.github/workflows/devcontainer-all.yaml +++ b/.github/workflows/devcontainer-all.yaml @@ -4,8 +4,9 @@ name: Build Dev Container for all platforms env: - GCR_IMAGE: ghcr.io/nanoframework/dev-container-all - GCR_FILE: .devcontainer/All/Dockerfile.All.SRC + CONTAINER_REPO: ghcr.io + CONTAINER_NAME: dev-container-all + CONTAINER_SRC_FILE: .devcontainer/All/Dockerfile.All.SRC on: push: @@ -44,10 +45,10 @@ jobs: password: ${{ secrets.CONTAINER_BUILD_TOKEN }} - name: Build and Push Docker Image - uses: docker/build-push-action@v4 + uses: docker/build-push-action@v5 with: - file: ${{ env.GCR_FILE }} + file: ${{ env.CONTAINER_SRC_FILE }} push: true # Will only build if this is not here tags: | - ${{ env.GCR_IMAGE }}:${{ env.GCR_VERSION }} - ${{ env.GCR_IMAGE }}:latest + ${{ env.CONTAINER_REPO }}/${{ github.repository_owner }}/${{ env.CONTAINER_NAME }}:${{ env.GCR_VERSION }} + ${{ env.CONTAINER_REPO }}/${{ github.repository_owner }}/${{ env.CONTAINER_NAME }}:latest diff --git a/.github/workflows/devcontainer-azurertos.yaml b/.github/workflows/devcontainer-azurertos.yaml index 56a98d5ee8..f15852aefa 100644 --- a/.github/workflows/devcontainer-azurertos.yaml +++ b/.github/workflows/devcontainer-azurertos.yaml @@ -4,8 +4,9 @@ name: Build Dev Container for Azure RTOS env: - GCR_IMAGE: ghcr.io/nanoframework/dev-container-azure-rtos - GCR_FILE: .devcontainer/AzureRTOS/Dockerfile.AzureRTOS.SRC + CONTAINER_REPO: ghcr.io + CONTAINER_NAME: dev-container-azure-rtos + CONTAINER_SRC_FILE: .devcontainer/AzureRTOS/Dockerfile.AzureRTOS.SRC on: push: @@ -44,11 +45,11 @@ jobs: password: ${{ secrets.CONTAINER_BUILD_TOKEN }} - name: Build and Push Docker Image - uses: docker/build-push-action@v4 + uses: docker/build-push-action@v5 with: - file: ${{ env.GCR_FILE }} + file: ${{ env.CONTAINER_SRC_FILE }} push: true # Will only build if this is not here tags: | - ${{ env.GCR_IMAGE }}:${{ env.GCR_VERSION }} - ${{ env.GCR_IMAGE }}:latest + ${{ env.CONTAINER_REPO }}/${{ github.repository_owner }}/${{ env.CONTAINER_NAME }}:${{ env.GCR_VERSION }} + ${{ env.CONTAINER_REPO }}/${{ github.repository_owner }}/${{ env.CONTAINER_NAME }}:latest \ No newline at end of file diff --git a/.github/workflows/devcontainer-chibios.yaml b/.github/workflows/devcontainer-chibios.yaml index 202a50d69f..8b125cb8a4 100644 --- a/.github/workflows/devcontainer-chibios.yaml +++ b/.github/workflows/devcontainer-chibios.yaml @@ -4,8 +4,9 @@ name: Build Dev Container for ChibiOS env: - GCR_IMAGE: ghcr.io/nanoframework/dev-container-chibios - GCR_FILE: .devcontainer/ChibiOS/Dockerfile.ChibiOS.SRC + CONTAINER_REPO: ghcr.io + CONTAINER_NAME: dev-container-chibios + CONTAINER_SRC_FILE: .devcontainer/ChibiOS/Dockerfile.ChibiOS.SRC on: push: @@ -44,10 +45,10 @@ jobs: password: ${{ secrets.CONTAINER_BUILD_TOKEN }} - name: Build and Push Docker Image - uses: docker/build-push-action@v4 + uses: docker/build-push-action@v5 with: - file: ${{ env.GCR_FILE }} + file: ${{ env.CONTAINER_SRC_FILE }} push: true # Will only build if this is not here tags: | - ${{ env.GCR_IMAGE }}:${{ env.GCR_VERSION }} - ${{ env.GCR_IMAGE }}:latest + ${{ env.CONTAINER_REPO }}/${{ github.repository_owner }}/${{ env.CONTAINER_NAME }}:${{ env.GCR_VERSION }} + ${{ env.CONTAINER_REPO }}/${{ github.repository_owner }}/${{ env.CONTAINER_NAME }}:latest diff --git a/.github/workflows/devcontainer-esp32.yml b/.github/workflows/devcontainer-esp32.yml index 7f5bcd8f46..f2dc01f8c6 100644 --- a/.github/workflows/devcontainer-esp32.yml +++ b/.github/workflows/devcontainer-esp32.yml @@ -4,8 +4,9 @@ name: Build Dev Container for ESP32 env: - GCR_IMAGE: ghcr.io/nanoframework/dev-container-esp32 - GCR_FILE: .devcontainer/ESP32/Dockerfile.ESP32.SRC + CONTAINER_REPO: ghcr.io + CONTAINER_NAME: dev-container-esp32 + CONTAINER_SRC_FILE: .devcontainer/ESP32/Dockerfile.ESP32.SRC on: push: @@ -44,10 +45,10 @@ jobs: password: ${{ secrets.CONTAINER_BUILD_TOKEN }} - name: Build and Push Docker Image - uses: docker/build-push-action@v4 + uses: docker/build-push-action@v5 with: - file: ${{ env.GCR_FILE }} + file: ${{ env.CONTAINER_SRC_FILE }} push: true # Will only build if this is not here tags: | - ${{ env.GCR_IMAGE }}:${{ env.GCR_VERSION }} - ${{ env.GCR_IMAGE }}:latest + ${{ env.CONTAINER_REPO }}/${{ github.repository_owner }}/${{ env.CONTAINER_NAME }}:${{ env.GCR_VERSION }} + ${{ env.CONTAINER_REPO }}/${{ github.repository_owner }}/${{ env.CONTAINER_NAME }}:latest diff --git a/.github/workflows/devcontainer-smoketest.yaml b/.github/workflows/devcontainer-smoketest.yaml index a0f1246533..ade0a5947c 100644 --- a/.github/workflows/devcontainer-smoketest.yaml +++ b/.github/workflows/devcontainer-smoketest.yaml @@ -5,10 +5,10 @@ on: paths: - '.devcontainer/**/*' - '.github/workflows/*' - # push: - # paths: - # - '.devcontainer/sources/*' - # - '.github/workflows/*' + push: + paths: + - '.devcontainer/**/*' + - '.github/workflows/*' jobs: build-target: @@ -72,11 +72,9 @@ jobs: - name: Build ${{ matrix.target }} ${{ matrix.build-type }} Firmware uses: devcontainers/ci@v0.3 with: + configFile: ./.devcontainer/${{ matrix.container }}/devcontainer.json push: never runCmd: | - pushd .devcontainer/${{ matrix.container }} # Build target: cmake --preset=${{ matrix.target }} -DCMAKE_BUILD_TYPE=${{ matrix.build-type }} cmake --build build - popd - diff --git a/.github/workflows/devcontainer-ti.yaml b/.github/workflows/devcontainer-ti.yaml index 4c6333f3b2..10c3a7d1af 100644 --- a/.github/workflows/devcontainer-ti.yaml +++ b/.github/workflows/devcontainer-ti.yaml @@ -4,15 +4,16 @@ name: Build Dev Container for TI env: - GCR_IMAGE: ghcr.io/nanoframework/dev-container-ti - GCR_FILE: .devcontainer/TI/Dockerfile.TI.SRC + CONTAINER_REPO: ghcr.io + CONTAINER_NAME: dev-container-ti + CONTAINER_SRC_FILE: .devcontainer/TI/Dockerfile.TI.SRC on: push: branches: - main paths: - - '**Dockerfile.TI.SRC' + - '**Dockerfile.TI' workflow_dispatch: @@ -44,10 +45,10 @@ jobs: password: ${{ secrets.CONTAINER_BUILD_TOKEN }} - name: Build and Push Docker Image - uses: docker/build-push-action@v4 + uses: docker/build-push-action@v5 with: - file: ${{ env.GCR_FILE }} + file: ${{ env.CONTAINER_SRC_FILE }} push: true # Will only build if this is not here tags: | - ${{ env.GCR_IMAGE }}:${{ env.GCR_VERSION }} - ${{ env.GCR_IMAGE }}:latest + ${{ env.CONTAINER_REPO }}/${{ github.repository_owner }}/${{ env.CONTAINER_NAME }}:${{ env.GCR_VERSION }} + ${{ env.CONTAINER_REPO }}/${{ github.repository_owner }}/${{ env.CONTAINER_NAME }}:latest From 6b59f70d96bdb468a14fbb8109f059d4027a634c Mon Sep 17 00:00:00 2001 From: Robin Jones Date: Wed, 27 Dec 2023 15:51:09 +0000 Subject: [PATCH 3/9] Improve the readme. Comment back out smoketests --- .devcontainer/README.md | 29 ++++++++++--------- .github/workflows/devcontainer-smoketest.yaml | 8 ++--- 2 files changed, 20 insertions(+), 17 deletions(-) diff --git a/.devcontainer/README.md b/.devcontainer/README.md index 92a186a354..d380bc9bec 100644 --- a/.devcontainer/README.md +++ b/.devcontainer/README.md @@ -1,4 +1,4 @@ -# This folder contains all the elements used for .NET nanoFramework dev container +# This folder contains all the elements used for .NET nanoFramework dev containers You'll find Docker files for .NET nanoFramework. They are used to facilitate building images. @@ -10,18 +10,21 @@ The available pre build images are: * ghcr.io/nanoframework/dev-container-esp32: contains all elements to build a firmware image for any of the ESP32 targets * ghcr.io/nanoframework/dev-container-azure-rtos: contains all elements to build a firmware image for any of the Azure RTOS targets -To choose the dev container you want to use, adjust `devcontainer.json` and change the `"dockerFile": "Dockerfile"` elements for the image you'd liked to use: - -* `Dockerfile.All` to use the pre build container with all the elements to build a firmware image for any of the targets -* `Dockerfile.AzureRTOS` to use the pre build container with all the elements to build Azure RTOS targets -* `Dockerfile.ChibiOS` to use the pre build container with all the elements to build ChibiOS targets -* `Dockerfile.ESP32` to use the pre build container with all the elements to build ESP32 targets -* `Dockerfile.TI` to use the pre build container with all the elements to build TI SimpleLink targets -* `./sources/Dockerfile.All` to build the container image from the source with all the elements to build all the images -* `./sources/Dockerfile.AzureRTOS` to build the container image from the source with all the elements to build Azure RTOS based devices -* `./sources/Dockerfile.ChibiOS` to build the container image from the source with all the elements to build ChibiOS based devices -* `./sources/Dockerfile.ESP32` to build the container image from the source with all the elements to build ESP32 based devices -* `./sources/Dockerfile.TI` to build the container image from the source with all the elements to build TI SimpleLink based devices +You can choose the dev container needed when opening a remote container in VSCode. The options are: + +* `nanoFramework-All` to use the pre build container with all the elements to build a firmware image for any of the targets +* `nanoFramework-AzureRTOS` to use the pre build container with all the elements to build Azure RTOS targets +* `nanoFramework-ChibiOS` to use the pre build container with all the elements to build ChibiOS targets +* `nanoFramework-ESP32` to use the pre build container with all the elements to build ESP32 targets +* `nanoFramework-TI` to use the pre build container with all the elements to build TI SimpleLink targets + +To use the source dockerfile for the respective platform adjust its `devcontainer.json` file and change the `"dockerFile": "Dockerfile."` element for the image you would like to use: + +* `Dockerfile.All.SRC` to build the container image from the source with all the elements to build all the images +* `Dockerfile.AzureRTOS.SRC` to build the container image from the source with all the elements to build Azure RTOS based devices +* `Dockerfile.ChibiOS.SRC` to build the container image from the source with all the elements to build ChibiOS based devices +* `Dockerfile.ESP32.SRC` to build the container image from the source with all the elements to build ESP32 based devices +* `Dockerfile.TI.SRC` to build the container image from the source with all the elements to build TI SimpleLink based devices ## Building and releasing Docker images in a fork diff --git a/.github/workflows/devcontainer-smoketest.yaml b/.github/workflows/devcontainer-smoketest.yaml index ade0a5947c..1c7863d17f 100644 --- a/.github/workflows/devcontainer-smoketest.yaml +++ b/.github/workflows/devcontainer-smoketest.yaml @@ -5,10 +5,10 @@ on: paths: - '.devcontainer/**/*' - '.github/workflows/*' - push: - paths: - - '.devcontainer/**/*' - - '.github/workflows/*' + # push: + # paths: + # - '.devcontainer/**/*' + # - '.github/workflows/*' jobs: build-target: From ffdc630efee8d86b8d28ad777ef0c0051cda0862 Mon Sep 17 00:00:00 2001 From: Robin Jones Date: Wed, 27 Dec 2023 18:01:34 +0000 Subject: [PATCH 4/9] Add NXP devcontainer --- .../FreeRTOS-NXP/Dockerfile.FreeRTOS-NXP | 1 + .../FreeRTOS-NXP/Dockerfile.FreeRTOS-NXP.SRC | 86 +++++++++++++++++++ .devcontainer/FreeRTOS-NXP/devcontainer.json | 48 +++++++++++ .devcontainer/README.md | 3 + .../workflows/devcontainer-freertos-nxp.yaml | 54 ++++++++++++ .github/workflows/devcontainer-smoketest.yaml | 10 +-- 6 files changed, 197 insertions(+), 5 deletions(-) create mode 100644 .devcontainer/FreeRTOS-NXP/Dockerfile.FreeRTOS-NXP create mode 100644 .devcontainer/FreeRTOS-NXP/Dockerfile.FreeRTOS-NXP.SRC create mode 100644 .devcontainer/FreeRTOS-NXP/devcontainer.json create mode 100644 .github/workflows/devcontainer-freertos-nxp.yaml diff --git a/.devcontainer/FreeRTOS-NXP/Dockerfile.FreeRTOS-NXP b/.devcontainer/FreeRTOS-NXP/Dockerfile.FreeRTOS-NXP new file mode 100644 index 0000000000..6d7262c824 --- /dev/null +++ b/.devcontainer/FreeRTOS-NXP/Dockerfile.FreeRTOS-NXP @@ -0,0 +1 @@ +FROM ghcr.io/nanoframework/dev-container-freertos-nxp:v1.01 diff --git a/.devcontainer/FreeRTOS-NXP/Dockerfile.FreeRTOS-NXP.SRC b/.devcontainer/FreeRTOS-NXP/Dockerfile.FreeRTOS-NXP.SRC new file mode 100644 index 0000000000..a9ea4281fe --- /dev/null +++ b/.devcontainer/FreeRTOS-NXP/Dockerfile.FreeRTOS-NXP.SRC @@ -0,0 +1,86 @@ +FROM ubuntu:latest AS downloader +RUN apt-get update \ + && apt-get -y install --no-install-recommends apt-utils \ + && apt-get install -y \ + curl \ + xz-utils \ + unzip \ + wget + +RUN mkdir -p /tmp/dc-downloads /tmp/dc-extracted + +ARG GCC_VERSION=13.2.rel1 +ARG GCC_URI=https://armkeil.blob.core.windows.net/developer/Files/downloads/gnu/$GCC_VERSION/binrel/arm-gnu-toolchain-$GCC_VERSION-x86_64-arm-none-eabi.tar.xz +RUN mkdir -p /tmp/dc-downloads /tmp/dc-extracted/gcc \ + && curl -o /tmp/dc-downloads/gcc-arm.tar.xz $GCC_URI \ + && xz -d /tmp/dc-downloads/gcc-arm.tar.xz \ + && tar -xvf /tmp/dc-downloads/gcc-arm.tar -C /tmp/dc-extracted/gcc --strip-components 1 \ + && rm -rf /tmp/dc-extracted/gcc/share/doc/ /tmp/dc-extracted/gcc/share/gcc-arm-none-eabi/samples/ + +ARG CMAKE_VERSION=3.27.6 +ARG CMAKE_SCRIPT=https://github.com/Kitware/CMake/releases/download/v$CMAKE_VERSION/cmake-$CMAKE_VERSION-linux-x86_64.sh +RUN wget $CMAKE_SCRIPT \ + -q -O /tmp/dc-downloads/cmake-install.sh \ + && chmod u+x /tmp/dc-downloads/cmake-install.sh \ + && mkdir -p /tmp/dc-extracted/cmake \ + && /tmp/dc-downloads/cmake-install.sh --skip-license --prefix=/tmp/dc-extracted/cmake \ + && rm /tmp/dc-downloads/cmake-install.sh + +FROM python:3.10 AS devcontainer + +# Avoid warnings by switching to noninteractive +ENV DEBIAN_FRONTEND=noninteractive + +# You can set up non-root user +# ARG USERNAME=vscode +# ARG USER_UID=1000 +# ARG USER_GID=$USER_UID + +# Configure apt and install packages +RUN apt-get update \ + && apt-get -y install --no-install-recommends apt-utils dialog icu-devtools 2>&1 \ + && apt-get install -y \ + git \ + git-lfs \ + git-svn \ + subversion \ + clang-format \ + curl \ + ninja-build \ + srecord \ + nodejs \ + libffi-dev + +# Create needed directories +RUN mkdir -p /usr/local/bin/gcc + +# Clone libs mbedtls and fatfs etc. +RUN git clone --branch mbedtls-2.28.5 https://github.com/ARMmbed/mbedtls.git --depth 1 ./sources/mbedtls \ + && git clone --branch R0.15 https://github.com/abbrev/fatfs.git --depth 1 ./sources/fatfs \ + && git clone --branch STABLE-2_1_3_RELEASE https://github.com/lwip-tcpip/lwip.git --depth 1 ./sources/lwip + +# Clone FreeRTOS +RUN git clone --branch V10.4.1-kernel-only https://github.com/FreeRTOS/FreeRTOS-Kernel.git --depth 1 ./sources/FreeRTOS \ + && git clone --branch 5.5.1 https://github.com/ARM-software/CMSIS_5.git --depth 1 ./sources/CMSIS_5 + +# set gcc location +ARG TMP_GCC_PATH=/usr/local/bin/gcc +ENV ARM_GCC_PATH=$TMP_GCC_PATH/bin + +# Copy from our other container +COPY --from=downloader /tmp/dc-extracted/gcc $TMP_GCC_PATH +COPY --from=downloader /tmp/dc-extracted/cmake /usr/bin/cmake + +ENV PATH=/usr/bin/cmake/bin:${PATH} + +# Creating static link python for pyhton3 +RUN ln -fs /usr/bin/python3 /usr/bin/python \ + && pip3 install pyserial + +# Clean up downloaded files +RUN apt-get autoremove -y \ + && apt-get clean -y \ + && rm -rf /var/lib/apt/lists/* + +# Switch back to dialog for any ad-hoc use of apt-get +ENV DEBIAN_FRONTEND=dialog diff --git a/.devcontainer/FreeRTOS-NXP/devcontainer.json b/.devcontainer/FreeRTOS-NXP/devcontainer.json new file mode 100644 index 0000000000..7be0828ab6 --- /dev/null +++ b/.devcontainer/FreeRTOS-NXP/devcontainer.json @@ -0,0 +1,48 @@ +{ + "name": "nanoFramework-FreeRTOS-NXP", + // If you prefer, you can use the source files and adjust them where they are located, + // To do this, change the "dockerFile" to use 'Dockerfile.NXP.SRC'. + // This will allow you to customize and build the container source and add anything you may need on top. + "dockerFile": "Dockerfile.FreeRTOS-NXP", + "context": ".", + "mounts": [ + // Bind the Unix socket the Docker daemon listens on by default + "source=/var/run/docker.sock,target=/var/run/docker.sock,type=bind", + // Keep command history + "source=nano-bashhistory,target=/home/vscode/commandhistory,type=volume", + // OPTIONAL: Mount .azure folder for seamless az cli auth + // "source=${env:HOME}${env:USERPROFILE}/.azure,target=/home/vscode/.azure,type=bind" + ], + // Set the *default* container specific settings.json values on container create. + "customizations": { + "vscode": { + "settings": { + "cmake.preferredGenerators": [ + "Ninja" + ], + "cmake.generator": "Ninja", + "cmake.autoRestartBuild" : true, + "cmake.configureSettings": { + "CMAKE_MAKE_PROGRAM":"/usr/bin/ninja" + }, + "cmake.configureOnOpen": false + }, + // Add the IDs of extensions you want installed when the container is created. + "extensions": [ + "ms-vsliveshare.vsliveshare-pack", + "streetsidesoftware.code-spell-checker", + "twxs.cmake", + "ms-vscode.cmake-tools", + "xaver.clang-format" + ] + } + } + // You can pull all the repos with the latest changes, this is only valid if you are using the ./sources/Dockerfile.All containers + // "postAttachCommand": "/usr/local/git-pull-repos.sh" + // Use 'forwardPorts' to make a list of ports inside the container available locally. + // "forwardPorts": [], + // Use 'postCreateCommand' to run commands after the container is created. + // "postCreateCommand": "terraform --version", + // Uncomment to connect as a non-root user. See https: //aka.ms/vscode-remote/containers/non-root. + // ,"remoteUser": "vscode" +} diff --git a/.devcontainer/README.md b/.devcontainer/README.md index d380bc9bec..ed849679ac 100644 --- a/.devcontainer/README.md +++ b/.devcontainer/README.md @@ -9,6 +9,7 @@ The available pre build images are: * ghcr.io/nanoframework/dev-container-ti: contains all elements to build a firmware image for any of the TI SimpleLink targets * ghcr.io/nanoframework/dev-container-esp32: contains all elements to build a firmware image for any of the ESP32 targets * ghcr.io/nanoframework/dev-container-azure-rtos: contains all elements to build a firmware image for any of the Azure RTOS targets +* ghcr.io/nanoframework/dev-container-freertos-nxp: contains all elements to build a firmware image for any of the NXP targets You can choose the dev container needed when opening a remote container in VSCode. The options are: @@ -17,6 +18,7 @@ You can choose the dev container needed when opening a remote container in VSCod * `nanoFramework-ChibiOS` to use the pre build container with all the elements to build ChibiOS targets * `nanoFramework-ESP32` to use the pre build container with all the elements to build ESP32 targets * `nanoFramework-TI` to use the pre build container with all the elements to build TI SimpleLink targets +* `nanoFramework-FreeRTOS-NXP` to use the pre build container with all the elements to build TI SimpleLink targets To use the source dockerfile for the respective platform adjust its `devcontainer.json` file and change the `"dockerFile": "Dockerfile."` element for the image you would like to use: @@ -25,6 +27,7 @@ To use the source dockerfile for the respective platform adjust its `devcontaine * `Dockerfile.ChibiOS.SRC` to build the container image from the source with all the elements to build ChibiOS based devices * `Dockerfile.ESP32.SRC` to build the container image from the source with all the elements to build ESP32 based devices * `Dockerfile.TI.SRC` to build the container image from the source with all the elements to build TI SimpleLink based devices +* `Dockerfile.FreeRTOS.NXP.SRC` to build the container image from the source with all the elements to build NXP based devices ## Building and releasing Docker images in a fork diff --git a/.github/workflows/devcontainer-freertos-nxp.yaml b/.github/workflows/devcontainer-freertos-nxp.yaml new file mode 100644 index 0000000000..5f06bdc272 --- /dev/null +++ b/.github/workflows/devcontainer-freertos-nxp.yaml @@ -0,0 +1,54 @@ +# Copyright (c) .NET Foundation and Contributors +# See LICENSE file in the project root for full license information. + +name: Push devcontainer Docker image [FreeRTOS-NXP] + +env: + CONTAINER_REPO: ghcr.io + CONTAINER_NAME: dev-container-freertos-nxp + CONTAINER_SRC_FILE: .devcontainer/FreeRTOS-NXP/Dockerfile.FreeRTOS-NXP.SRC + +on: + push: + # branches: + # - main + paths: + - '**Dockerfile.FreeRTOS.NXP-SRC' + + workflow_dispatch: + +jobs: + build: + if: ${{ vars.PUBLISH_DOCKER_IMAGE == 'true' }} + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + + steps: + + - name: Checkout Repository + uses: actions/checkout@v4 + + - name: Extract metadata (tags, labels) for Docker + id: meta + uses: docker/metadata-action@v5 + with: + images: ${{ env.CONTAINER_REPO }}/${{ github.repository_owner }}/${{ env.CONTAINER_NAME }} + + - name: Login to GitHub Container Registry + if: ${{ github.event_name != 'pull_request' }} + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Build and Push Docker Image + uses: docker/build-push-action@v5 + with: + file: ${{ env.CONTAINER_SRC_FILE }} + push: ${{ github.event_name != 'pull_request' }} + tags: | + ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} diff --git a/.github/workflows/devcontainer-smoketest.yaml b/.github/workflows/devcontainer-smoketest.yaml index 1c7863d17f..7e5b346852 100644 --- a/.github/workflows/devcontainer-smoketest.yaml +++ b/.github/workflows/devcontainer-smoketest.yaml @@ -5,10 +5,10 @@ on: paths: - '.devcontainer/**/*' - '.github/workflows/*' - # push: - # paths: - # - '.devcontainer/**/*' - # - '.github/workflows/*' + push: + paths: + - '.devcontainer/**/*' + - '.github/workflows/*' jobs: build-target: @@ -23,7 +23,7 @@ jobs: { target: ST_STM32F769I_DISCOVERY, build-type: Debug, container: All }, { target: M5Core2, build-type: Debug, container: ESP32 }, { target: M5Core2, build-type: Debug, container: All }, - # { target: NXP_MIMXRT1060_EVK, build-type: Debug, container: FreeRTOS }, # No FreeRTOS container yet. + { target: NXP_MIMXRT1060_EVK, build-type: Debug, container: FreeRTOS-NXP }, { target: NXP_MIMXRT1060_EVK, build-type: Debug, container: All }, { target: TI_CC1352R1_LAUNCHXL, build-type: Debug, container: TI, radio-freq: 915 }, { target: TI_CC1352R1_LAUNCHXL, build-type: Debug, container: All, radio-freq: 915 }, From 6091ddf58b2a8fbbbdbba7c6db5bcf1873d97c6d Mon Sep 17 00:00:00 2001 From: Robin Jones Date: Wed, 27 Dec 2023 18:49:18 +0000 Subject: [PATCH 5/9] Improve workflow publish And docker label --- .devcontainer/FreeRTOS-NXP/Dockerfile.FreeRTOS-NXP | 2 ++ .github/workflows/devcontainer-freertos-nxp.yaml | 5 +++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/.devcontainer/FreeRTOS-NXP/Dockerfile.FreeRTOS-NXP b/.devcontainer/FreeRTOS-NXP/Dockerfile.FreeRTOS-NXP index 6d7262c824..44ace8132b 100644 --- a/.devcontainer/FreeRTOS-NXP/Dockerfile.FreeRTOS-NXP +++ b/.devcontainer/FreeRTOS-NXP/Dockerfile.FreeRTOS-NXP @@ -1 +1,3 @@ FROM ghcr.io/nanoframework/dev-container-freertos-nxp:v1.01 +LABEL website="nanoframework.net" +LABEL desc="This is dockerfile image for NXP targets" \ No newline at end of file diff --git a/.github/workflows/devcontainer-freertos-nxp.yaml b/.github/workflows/devcontainer-freertos-nxp.yaml index 5f06bdc272..07c60e5999 100644 --- a/.github/workflows/devcontainer-freertos-nxp.yaml +++ b/.github/workflows/devcontainer-freertos-nxp.yaml @@ -7,13 +7,14 @@ env: CONTAINER_REPO: ghcr.io CONTAINER_NAME: dev-container-freertos-nxp CONTAINER_SRC_FILE: .devcontainer/FreeRTOS-NXP/Dockerfile.FreeRTOS-NXP.SRC + CONTAINER_VERSION_FILE: .devcontainer/FreeRTOS-NXP/Dockerfile.FreeRTOS-NXP on: push: # branches: # - main paths: - - '**Dockerfile.FreeRTOS.NXP-SRC' + - '**Dockerfile.FreeRTOS-NXP' workflow_dispatch: @@ -34,7 +35,7 @@ jobs: id: meta uses: docker/metadata-action@v5 with: - images: ${{ env.CONTAINER_REPO }}/${{ github.repository_owner }}/${{ env.CONTAINER_NAME }} + images: ${{env.CONTAINER_VERSION_FILE}} - name: Login to GitHub Container Registry if: ${{ github.event_name != 'pull_request' }} From e6815247d6e7b24d901b8a3564964bd4048f5a47 Mon Sep 17 00:00:00 2001 From: Robin Jones Date: Wed, 27 Dec 2023 19:10:52 +0000 Subject: [PATCH 6/9] Improve workflow Comment out push --- .github/workflows/devcontainer-freertos-nxp.yaml | 16 ++++++---------- .github/workflows/devcontainer-smoketest.yaml | 8 ++++---- 2 files changed, 10 insertions(+), 14 deletions(-) diff --git a/.github/workflows/devcontainer-freertos-nxp.yaml b/.github/workflows/devcontainer-freertos-nxp.yaml index 07c60e5999..ae16af367c 100644 --- a/.github/workflows/devcontainer-freertos-nxp.yaml +++ b/.github/workflows/devcontainer-freertos-nxp.yaml @@ -4,17 +4,15 @@ name: Push devcontainer Docker image [FreeRTOS-NXP] env: - CONTAINER_REPO: ghcr.io - CONTAINER_NAME: dev-container-freertos-nxp - CONTAINER_SRC_FILE: .devcontainer/FreeRTOS-NXP/Dockerfile.FreeRTOS-NXP.SRC + CONTAINER_SOURCE_FILE: .devcontainer/FreeRTOS-NXP/Dockerfile.FreeRTOS-NXP.SRC CONTAINER_VERSION_FILE: .devcontainer/FreeRTOS-NXP/Dockerfile.FreeRTOS-NXP on: push: - # branches: - # - main + branches: + - main paths: - - '**Dockerfile.FreeRTOS-NXP' + - '**Dockerfile.FreeRTOS-NXP' # We only care if the version has changed! workflow_dispatch: @@ -27,7 +25,6 @@ jobs: packages: write steps: - - name: Checkout Repository uses: actions/checkout@v4 @@ -48,8 +45,7 @@ jobs: - name: Build and Push Docker Image uses: docker/build-push-action@v5 with: - file: ${{ env.CONTAINER_SRC_FILE }} + file: ${{ env.CONTAINER_SOURCE_FILE }} push: ${{ github.event_name != 'pull_request' }} - tags: | - ${{ steps.meta.outputs.tags }} + tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} diff --git a/.github/workflows/devcontainer-smoketest.yaml b/.github/workflows/devcontainer-smoketest.yaml index 7e5b346852..aaa8a03eb8 100644 --- a/.github/workflows/devcontainer-smoketest.yaml +++ b/.github/workflows/devcontainer-smoketest.yaml @@ -5,10 +5,10 @@ on: paths: - '.devcontainer/**/*' - '.github/workflows/*' - push: - paths: - - '.devcontainer/**/*' - - '.github/workflows/*' + # push: + # paths: + # - '.devcontainer/**/*' + # - '.github/workflows/*' jobs: build-target: From 6cbd79a90870c1f94428d75798f52be01eb7666e Mon Sep 17 00:00:00 2001 From: Robin Jones Date: Wed, 27 Dec 2023 20:30:08 +0000 Subject: [PATCH 7/9] Improve GH workflow --- .../FreeRTOS-NXP/Dockerfile.FreeRTOS-NXP | 4 +-- .../workflows/devcontainer-freertos-nxp.yaml | 26 ++++++++++++------- 2 files changed, 19 insertions(+), 11 deletions(-) diff --git a/.devcontainer/FreeRTOS-NXP/Dockerfile.FreeRTOS-NXP b/.devcontainer/FreeRTOS-NXP/Dockerfile.FreeRTOS-NXP index 44ace8132b..7d6b9c33ef 100644 --- a/.devcontainer/FreeRTOS-NXP/Dockerfile.FreeRTOS-NXP +++ b/.devcontainer/FreeRTOS-NXP/Dockerfile.FreeRTOS-NXP @@ -1,3 +1,3 @@ FROM ghcr.io/nanoframework/dev-container-freertos-nxp:v1.01 -LABEL website="nanoframework.net" -LABEL desc="This is dockerfile image for NXP targets" \ No newline at end of file +LABEL org.website="https://nanoframework.net/" +LABEL description="This is dockerfile image for NXP targets" diff --git a/.github/workflows/devcontainer-freertos-nxp.yaml b/.github/workflows/devcontainer-freertos-nxp.yaml index ae16af367c..20baaf3216 100644 --- a/.github/workflows/devcontainer-freertos-nxp.yaml +++ b/.github/workflows/devcontainer-freertos-nxp.yaml @@ -1,9 +1,11 @@ # Copyright (c) .NET Foundation and Contributors # See LICENSE file in the project root for full license information. -name: Push devcontainer Docker image [FreeRTOS-NXP] +name: Push Docker image [FreeRTOS-NXP] env: + CONTAINER_REPO: ghcr.io + CONTAINER_NAME: dev-container-freertos-nxp CONTAINER_SOURCE_FILE: .devcontainer/FreeRTOS-NXP/Dockerfile.FreeRTOS-NXP.SRC CONTAINER_VERSION_FILE: .devcontainer/FreeRTOS-NXP/Dockerfile.FreeRTOS-NXP @@ -28,17 +30,22 @@ jobs: - name: Checkout Repository uses: actions/checkout@v4 - - name: Extract metadata (tags, labels) for Docker - id: meta - uses: docker/metadata-action@v5 - with: - images: ${{env.CONTAINER_VERSION_FILE}} + - name: Get container version + shell: pwsh + run: | + $dockerfileContent = Get-Content("${{ env.CONTAINER_VERSION_FILE }}") + $dockerfileContent -match '(?<=\:)(?:[v]\d+.\d+)' + $containerVersion = $Matches[0].ToString() + echo "GCR_VERSION=$containerVersion" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf-8 -Append + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 - name: Login to GitHub Container Registry if: ${{ github.event_name != 'pull_request' }} uses: docker/login-action@v3 with: - registry: ghcr.io + registry: ${{ env.CONTAINER_REPO }} username: ${{ github.repository_owner }} password: ${{ secrets.GITHUB_TOKEN }} @@ -47,5 +54,6 @@ jobs: with: file: ${{ env.CONTAINER_SOURCE_FILE }} push: ${{ github.event_name != 'pull_request' }} - tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} + tags: | + ${{ env.CONTAINER_REPO }}/${{ github.repository_owner }}/${{ env.CONTAINER_NAME }}:${{ env.GCR_VERSION }} + ${{ env.CONTAINER_REPO }}/${{ github.repository_owner }}/${{ env.CONTAINER_NAME }}:latest From 55820ac42a720df198578585d09d0c3d5dbf910c Mon Sep 17 00:00:00 2001 From: Robin Jones Date: Wed, 27 Dec 2023 20:51:38 +0000 Subject: [PATCH 8/9] Align container builds For maintainability --- .github/workflows/devcontainer-all.yaml | 25 +++++++++++-------- .github/workflows/devcontainer-azurertos.yaml | 25 +++++++++++-------- .github/workflows/devcontainer-chibios.yaml | 25 +++++++++++-------- .github/workflows/devcontainer-esp32.yml | 20 ++++++++------- .github/workflows/devcontainer-ti.yaml | 25 +++++++++++-------- 5 files changed, 71 insertions(+), 49 deletions(-) diff --git a/.github/workflows/devcontainer-all.yaml b/.github/workflows/devcontainer-all.yaml index 3672f3d8e5..f03ac74213 100644 --- a/.github/workflows/devcontainer-all.yaml +++ b/.github/workflows/devcontainer-all.yaml @@ -6,7 +6,8 @@ name: Build Dev Container for all platforms env: CONTAINER_REPO: ghcr.io CONTAINER_NAME: dev-container-all - CONTAINER_SRC_FILE: .devcontainer/All/Dockerfile.All.SRC + CONTAINER_SOURCE_FILE: .devcontainer/All/Dockerfile.All.SRC + CONTAINER_VERSION_FILE: .devcontainer/All/Dockerfile.All on: push: @@ -21,34 +22,38 @@ jobs: build: if: ${{ vars.PUBLISH_DOCKER_IMAGE == 'true' }} runs-on: ubuntu-latest - steps: + permissions: + contents: read + packages: write + steps: - name: Checkout Repository uses: actions/checkout@v4 - name: Get container version + shell: pwsh run: | - $dockerfileContent = Get-Content(".devcontainer/All/Dockerfile.All") + $dockerfileContent = Get-Content("${{ env.CONTAINER_VERSION_FILE }}") $dockerfileContent -match '(?<=\:)(?:[v]\d+.\d+)' $containerVersion = $Matches[0].ToString() echo "GCR_VERSION=$containerVersion" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf-8 -Append - shell: pwsh - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v2 + uses: docker/setup-buildx-action@v3 - name: Login to GitHub Container Registry - uses: docker/login-action@v2 + if: ${{ github.event_name != 'pull_request' }} + uses: docker/login-action@v3 with: - registry: ghcr.io + registry: ${{ env.CONTAINER_REPO }} username: ${{ github.repository_owner }} - password: ${{ secrets.CONTAINER_BUILD_TOKEN }} + password: ${{ secrets.GITHUB_TOKEN }} - name: Build and Push Docker Image uses: docker/build-push-action@v5 with: - file: ${{ env.CONTAINER_SRC_FILE }} - push: true # Will only build if this is not here + file: ${{ env.CONTAINER_SOURCE_FILE }} + push: ${{ github.event_name != 'pull_request' }} tags: | ${{ env.CONTAINER_REPO }}/${{ github.repository_owner }}/${{ env.CONTAINER_NAME }}:${{ env.GCR_VERSION }} ${{ env.CONTAINER_REPO }}/${{ github.repository_owner }}/${{ env.CONTAINER_NAME }}:latest diff --git a/.github/workflows/devcontainer-azurertos.yaml b/.github/workflows/devcontainer-azurertos.yaml index f15852aefa..b63e0bbcf3 100644 --- a/.github/workflows/devcontainer-azurertos.yaml +++ b/.github/workflows/devcontainer-azurertos.yaml @@ -6,7 +6,8 @@ name: Build Dev Container for Azure RTOS env: CONTAINER_REPO: ghcr.io CONTAINER_NAME: dev-container-azure-rtos - CONTAINER_SRC_FILE: .devcontainer/AzureRTOS/Dockerfile.AzureRTOS.SRC + CONTAINER_SOURCE_FILE: .devcontainer/AzureRTOS/Dockerfile.AzureRTOS.SRC + CONTAINER_VERSION_FILE: .devcontainer/AzureRTOS/Dockerfile.AzureRTOS on: push: @@ -21,34 +22,38 @@ jobs: build: if: ${{ vars.PUBLISH_DOCKER_IMAGE == 'true' }} runs-on: ubuntu-latest - steps: + permissions: + contents: read + packages: write + steps: - name: Checkout Repository uses: actions/checkout@v4 - name: Get container version + shell: pwsh run: | - $dockerfileContent = Get-Content(".devcontainer/AzureRTOS/Dockerfile.AzureRTOS") + $dockerfileContent = Get-Content("${{ env.CONTAINER_VERSION_FILE }}") $dockerfileContent -match '(?<=\:)(?:[v]\d+.\d+)' $containerVersion = $Matches[0].ToString() echo "GCR_VERSION=$containerVersion" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf-8 -Append - shell: pwsh - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v2 + uses: docker/setup-buildx-action@v3 - name: Login to GitHub Container Registry - uses: docker/login-action@v2 + if: ${{ github.event_name != 'pull_request' }} + uses: docker/login-action@v3 with: - registry: ghcr.io + registry: ${{ env.CONTAINER_REPO }} username: ${{ github.repository_owner }} - password: ${{ secrets.CONTAINER_BUILD_TOKEN }} + password: ${{ secrets.GITHUB_TOKEN }} - name: Build and Push Docker Image uses: docker/build-push-action@v5 with: - file: ${{ env.CONTAINER_SRC_FILE }} - push: true # Will only build if this is not here + file: ${{ env.CONTAINER_SOURCE_FILE }} + push: ${{ github.event_name != 'pull_request' }} tags: | ${{ env.CONTAINER_REPO }}/${{ github.repository_owner }}/${{ env.CONTAINER_NAME }}:${{ env.GCR_VERSION }} ${{ env.CONTAINER_REPO }}/${{ github.repository_owner }}/${{ env.CONTAINER_NAME }}:latest diff --git a/.github/workflows/devcontainer-chibios.yaml b/.github/workflows/devcontainer-chibios.yaml index 8b125cb8a4..5377fe8c72 100644 --- a/.github/workflows/devcontainer-chibios.yaml +++ b/.github/workflows/devcontainer-chibios.yaml @@ -6,7 +6,8 @@ name: Build Dev Container for ChibiOS env: CONTAINER_REPO: ghcr.io CONTAINER_NAME: dev-container-chibios - CONTAINER_SRC_FILE: .devcontainer/ChibiOS/Dockerfile.ChibiOS.SRC + CONTAINER_SOURCE_FILE: .devcontainer/ChibiOS/Dockerfile.ChibiOS.SRC + CONTAINER_VERSION_FILE: .devcontainer/ChibiOS/Dockerfile.ChibiOS on: push: @@ -21,34 +22,38 @@ jobs: build: if: ${{ vars.PUBLISH_DOCKER_IMAGE == 'true' }} runs-on: ubuntu-latest - steps: + permissions: + contents: read + packages: write + steps: - name: Checkout Repository uses: actions/checkout@v4 - name: Get container version + shell: pwsh run: | - $dockerfileContent = Get-Content(".devcontainer/ChibiOS/Dockerfile.ChibiOS") + $dockerfileContent = Get-Content("${{ env.CONTAINER_VERSION_FILE }}") $dockerfileContent -match '(?<=\:)(?:[v]\d+.\d+)' $containerVersion = $Matches[0].ToString() echo "GCR_VERSION=$containerVersion" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf-8 -Append - shell: pwsh - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v2 + uses: docker/setup-buildx-action@v3 - name: Login to GitHub Container Registry - uses: docker/login-action@v2 + if: ${{ github.event_name != 'pull_request' }} + uses: docker/login-action@v3 with: - registry: ghcr.io + registry: ${{ env.CONTAINER_REPO }} username: ${{ github.repository_owner }} - password: ${{ secrets.CONTAINER_BUILD_TOKEN }} + password: ${{ secrets.GITHUB_TOKEN }} - name: Build and Push Docker Image uses: docker/build-push-action@v5 with: - file: ${{ env.CONTAINER_SRC_FILE }} - push: true # Will only build if this is not here + file: ${{ env.CONTAINER_SOURCE_FILE }} + push: ${{ github.event_name != 'pull_request' }} tags: | ${{ env.CONTAINER_REPO }}/${{ github.repository_owner }}/${{ env.CONTAINER_NAME }}:${{ env.GCR_VERSION }} ${{ env.CONTAINER_REPO }}/${{ github.repository_owner }}/${{ env.CONTAINER_NAME }}:latest diff --git a/.github/workflows/devcontainer-esp32.yml b/.github/workflows/devcontainer-esp32.yml index f2dc01f8c6..69ea23d615 100644 --- a/.github/workflows/devcontainer-esp32.yml +++ b/.github/workflows/devcontainer-esp32.yml @@ -6,7 +6,8 @@ name: Build Dev Container for ESP32 env: CONTAINER_REPO: ghcr.io CONTAINER_NAME: dev-container-esp32 - CONTAINER_SRC_FILE: .devcontainer/ESP32/Dockerfile.ESP32.SRC + CONTAINER_SOURCE_FILE: .devcontainer/ESP32/Dockerfile.ESP32.SRC + CONTAINER_VERSION_FILE: .devcontainer/ESP32/Dockerfile.ESP32 on: push: @@ -27,28 +28,29 @@ jobs: uses: actions/checkout@v4 - name: Get container version + shell: pwsh run: | - $dockerfileContent = Get-Content(".devcontainer/ESP32/Dockerfile.ESP32") + $dockerfileContent = Get-Content("${{ env.CONTAINER_VERSION_FILE }}") $dockerfileContent -match '(?<=\:)(?:[v]\d+.\d+)' $containerVersion = $Matches[0].ToString() echo "GCR_VERSION=$containerVersion" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf-8 -Append - shell: pwsh - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v2 + uses: docker/setup-buildx-action@v3 - name: Login to GitHub Container Registry - uses: docker/login-action@v2 + if: ${{ github.event_name != 'pull_request' }} + uses: docker/login-action@v3 with: - registry: ghcr.io + registry: ${{ env.CONTAINER_REPO }} username: ${{ github.repository_owner }} - password: ${{ secrets.CONTAINER_BUILD_TOKEN }} + password: ${{ secrets.GITHUB_TOKEN }} - name: Build and Push Docker Image uses: docker/build-push-action@v5 with: - file: ${{ env.CONTAINER_SRC_FILE }} - push: true # Will only build if this is not here + file: ${{ env.CONTAINER_SOURCE_FILE }} + push: ${{ github.event_name != 'pull_request' }} tags: | ${{ env.CONTAINER_REPO }}/${{ github.repository_owner }}/${{ env.CONTAINER_NAME }}:${{ env.GCR_VERSION }} ${{ env.CONTAINER_REPO }}/${{ github.repository_owner }}/${{ env.CONTAINER_NAME }}:latest diff --git a/.github/workflows/devcontainer-ti.yaml b/.github/workflows/devcontainer-ti.yaml index 10c3a7d1af..8d2a164851 100644 --- a/.github/workflows/devcontainer-ti.yaml +++ b/.github/workflows/devcontainer-ti.yaml @@ -6,7 +6,8 @@ name: Build Dev Container for TI env: CONTAINER_REPO: ghcr.io CONTAINER_NAME: dev-container-ti - CONTAINER_SRC_FILE: .devcontainer/TI/Dockerfile.TI.SRC + CONTAINER_SOURCE_FILE: .devcontainer/TI/Dockerfile.TI.SRC + CONTAINER_VERSION_FILE: .devcontainer/TI/Dockerfile.TI on: push: @@ -21,34 +22,38 @@ jobs: build: if: ${{ vars.PUBLISH_DOCKER_IMAGE == 'true' }} runs-on: ubuntu-latest - steps: + permissions: + contents: read + packages: write + steps: - name: Checkout Repository uses: actions/checkout@v4 - name: Get container version + shell: pwsh run: | - $dockerfileContent = Get-Content(".devcontainer/TI/Dockerfile.TI") + $dockerfileContent = Get-Content("${{ env.CONTAINER_VERSION_FILE }}") $dockerfileContent -match '(?<=\:)(?:[v]\d+.\d+)' $containerVersion = $Matches[0].ToString() echo "GCR_VERSION=$containerVersion" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf-8 -Append - shell: pwsh - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v2 + uses: docker/setup-buildx-action@v3 - name: Login to GitHub Container Registry - uses: docker/login-action@v2 + if: ${{ github.event_name != 'pull_request' }} + uses: docker/login-action@v3 with: - registry: ghcr.io + registry: ${{ env.CONTAINER_REPO }} username: ${{ github.repository_owner }} - password: ${{ secrets.CONTAINER_BUILD_TOKEN }} + password: ${{ secrets.GITHUB_TOKEN }} - name: Build and Push Docker Image uses: docker/build-push-action@v5 with: - file: ${{ env.CONTAINER_SRC_FILE }} - push: true # Will only build if this is not here + file: ${{ env.CONTAINER_SOURCE_FILE }} + push: ${{ github.event_name != 'pull_request' }} tags: | ${{ env.CONTAINER_REPO }}/${{ github.repository_owner }}/${{ env.CONTAINER_NAME }}:${{ env.GCR_VERSION }} ${{ env.CONTAINER_REPO }}/${{ github.repository_owner }}/${{ env.CONTAINER_NAME }}:latest From 379840f3ab134b489c745e5ee57981125404d49e Mon Sep 17 00:00:00 2001 From: Robin Jones Date: Wed, 17 Jan 2024 19:40:43 +0000 Subject: [PATCH 9/9] Update devcontainer-freertos-nxp.yaml Only get the version from the first line. Allows ability for the docker to have labels. --- .github/workflows/devcontainer-freertos-nxp.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/devcontainer-freertos-nxp.yaml b/.github/workflows/devcontainer-freertos-nxp.yaml index 20baaf3216..50a3a5c35f 100644 --- a/.github/workflows/devcontainer-freertos-nxp.yaml +++ b/.github/workflows/devcontainer-freertos-nxp.yaml @@ -33,7 +33,7 @@ jobs: - name: Get container version shell: pwsh run: | - $dockerfileContent = Get-Content("${{ env.CONTAINER_VERSION_FILE }}") + $dockerfileContent = Get-Content("${{ env.CONTAINER_VERSION_FILE }}") -First 1 $dockerfileContent -match '(?<=\:)(?:[v]\d+.\d+)' $containerVersion = $Matches[0].ToString() echo "GCR_VERSION=$containerVersion" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf-8 -Append