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/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/.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 4f58abe8ad..a05b31a963 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/sources/Dockerfile.All + CONTAINER_REPO: ghcr.io + CONTAINER_NAME: dev-container-all + CONTAINER_SRC_FILE: .devcontainer/All/Dockerfile.All.SRC on: push: @@ -27,7 +28,7 @@ jobs: - 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 @@ -46,8 +47,8 @@ jobs: - name: Build and Push Docker Image 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 a7bbd3256a..a843611501 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/sources/Dockerfile.AzureRTOS + CONTAINER_REPO: ghcr.io + CONTAINER_NAME: dev-container-azure-rtos + CONTAINER_SRC_FILE: .devcontainer/AzureRTOS/Dockerfile.AzureRTOS.SRC on: push: @@ -27,7 +28,7 @@ jobs: - 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 @@ -46,9 +47,9 @@ jobs: - name: Build and Push Docker Image 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 ba220c5562..52f4bf4471 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/sources/Dockerfile.ChibiOS + CONTAINER_REPO: ghcr.io + CONTAINER_NAME: dev-container-chibios + CONTAINER_SRC_FILE: .devcontainer/ChibiOS/Dockerfile.ChibiOS.SRC on: push: @@ -27,7 +28,7 @@ jobs: - 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 @@ -46,8 +47,8 @@ jobs: - name: Build and Push Docker Image 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 c904c8623c..327c3fb794 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/sources/Dockerfile.ESP32 + CONTAINER_REPO: ghcr.io + CONTAINER_NAME: dev-container-esp32 + CONTAINER_SRC_FILE: .devcontainer/ESP32/Dockerfile.ESP32.SRC on: push: @@ -27,7 +28,7 @@ jobs: - 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 @@ -46,8 +47,8 @@ jobs: - name: Build and Push Docker Image 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 34297c39b2..1c7863d17f 100644 --- a/.github/workflows/devcontainer-smoketest.yaml +++ b/.github/workflows/devcontainer-smoketest.yaml @@ -3,11 +3,11 @@ name: Smoketest Dockerfile builds for selected targets on: pull_request: paths: - - '.devcontainer/sources/*' + - '.devcontainer/**/*' - '.github/workflows/*' # push: # paths: - # - '.devcontainer/sources/*' + # - '.devcontainer/**/*' # - '.github/workflows/*' jobs: @@ -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 @@ -72,9 +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: | # Build target: cmake --preset=${{ matrix.target }} -DCMAKE_BUILD_TYPE=${{ matrix.build-type }} cmake --build build - diff --git a/.github/workflows/devcontainer-ti.yaml b/.github/workflows/devcontainer-ti.yaml index 2b483ad17a..4baf392cd2 100644 --- a/.github/workflows/devcontainer-ti.yaml +++ b/.github/workflows/devcontainer-ti.yaml @@ -4,8 +4,9 @@ name: Build Dev Container for TI env: - GCR_IMAGE: ghcr.io/nanoframework/dev-container-ti - GCR_FILE: .devcontainer/sources/Dockerfile.TI + CONTAINER_REPO: ghcr.io + CONTAINER_NAME: dev-container-ti + CONTAINER_SRC_FILE: .devcontainer/TI/Dockerfile.TI.SRC on: push: @@ -27,7 +28,7 @@ jobs: - 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 @@ -46,8 +47,8 @@ jobs: - name: Build and Push Docker Image 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