diff --git a/.github/workflows/build-ccpp.yaml b/.github/workflows/build-ccpp.yaml index 641b89bb3..fcff5cc8d 100644 --- a/.github/workflows/build-ccpp.yaml +++ b/.github/workflows/build-ccpp.yaml @@ -15,12 +15,11 @@ jobs: project: - folder: cppQML container: cpp-qml - arch: arm64 + vendor: "{ arch: 'arm64', torizon_arch: 'aarch64' }" - folder: cppSlint container: cpp-slint - arch: arm64 - + vendor: "{ arch: 'arm64', torizon_arch: 'aarch64' }" steps: - uses: actions/checkout@v3 @@ -30,10 +29,14 @@ jobs: env: PROJECT_FOLDER: ${{ matrix.project.folder }} PROJECT_CONTAINER: ${{ matrix.project.container }} - PROJECT_ARCH: ${{ matrix.project.arch }} + VENDOR: ${{ matrix.project.vendor }} DOCKER_LOGIN: localhost:5002 run: | + $_vendor = ($env:VENDOR | ConvertFrom-Json) + $env:TORIZON_ARCH = $_vendor.torizon_arch + $env:PROJECT_ARCH = $_vendor.arch + docker run --rm --privileged torizon/binfmt scripts/createFromTemplate.ps1 ` @@ -46,4 +49,9 @@ jobs: false cd "${env:GITHUB_WORKSPACE}/${env:PROJECT_FOLDER}CITest" + + $_settingsJson = Get-Content -Path ".vscode/settings.json" | ConvertFrom-Json + $_settingsJson.torizon_arch = $env:TORIZON_ARCH + Set-Content -Path ".vscode/settings.json" -Value ($_settingsJson | ConvertTo-Json) -Encoding UTF8 + ./.vscode/tasks.ps1 run build-container-torizon-release-${env:PROJECT_ARCH} diff --git a/.github/workflows/build-debug-ccpp.yaml b/.github/workflows/build-debug-ccpp.yaml index b3780cad8..c9b37d73a 100644 --- a/.github/workflows/build-debug-ccpp.yaml +++ b/.github/workflows/build-debug-ccpp.yaml @@ -15,24 +15,28 @@ jobs: project: - folder: cppQML container: cpp-qml - arch: arm64 + vendor: "{ arch: 'arm64', torizon_arch: 'aarch64' }" - folder: cppSlint container: cpp-slint - arch: arm64 - + vendor: "{ arch: 'arm64', torizon_arch: 'aarch64' }" steps: - uses: actions/checkout@v3 - - name: Build ${{ matrix.project.folder }} Dockerfile.debug + - name: Build ${{ matrix.project.folder }} Dockerfile shell: pwsh env: PROJECT_FOLDER: ${{ matrix.project.folder }} PROJECT_CONTAINER: ${{ matrix.project.container }} - PROJECT_ARCH: ${{ matrix.project.arch }} + VENDOR: ${{ matrix.project.vendor }} + DOCKER_LOGIN: localhost:5002 run: | + $_vendor = ($env:VENDOR | ConvertFrom-Json) + $env:TORIZON_ARCH = $_vendor.torizon_arch + $env:PROJECT_ARCH = $_vendor.arch + docker run --rm --privileged torizon/binfmt scripts/createFromTemplate.ps1 ` @@ -45,6 +49,11 @@ jobs: false cd "${env:GITHUB_WORKSPACE}/${env:PROJECT_FOLDER}CITest" + + $_settingsJson = Get-Content -Path ".vscode/settings.json" | ConvertFrom-Json + $_settingsJson.torizon_arch = $env:TORIZON_ARCH + Set-Content -Path ".vscode/settings.json" -Value ($_settingsJson | ConvertTo-Json) -Encoding UTF8 + # TODO: this is bad, but it's the only way to make it work for now chmod 777 . -R diff --git a/.github/workflows/build-debug-python.yaml b/.github/workflows/build-debug-python.yaml index 4339cf5d2..954569f1d 100644 --- a/.github/workflows/build-debug-python.yaml +++ b/.github/workflows/build-debug-python.yaml @@ -15,20 +15,24 @@ jobs: project: - folder: python3Console container: python3-console - arch: arm64 - + vendor: "{ arch: 'arm64', torizon_arch: 'aarch64' }" steps: - uses: actions/checkout@v3 - - name: Build ${{ matrix.project.folder }} Dockerfile.debug + - name: Build ${{ matrix.project.folder }} Dockerfile shell: pwsh env: PROJECT_FOLDER: ${{ matrix.project.folder }} PROJECT_CONTAINER: ${{ matrix.project.container }} - PROJECT_ARCH: ${{ matrix.project.arch }} + VENDOR: ${{ matrix.project.vendor }} + DOCKER_LOGIN: localhost:5002 run: | + $_vendor = ($env:VENDOR | ConvertFrom-Json) + $env:TORIZON_ARCH = $_vendor.torizon_arch + $env:PROJECT_ARCH = $_vendor.arch + docker run --rm --privileged torizon/binfmt scripts/createFromTemplate.ps1 ` @@ -41,4 +45,9 @@ jobs: false cd "${env:GITHUB_WORKSPACE}/${env:PROJECT_FOLDER}CITest" + + $_settingsJson = Get-Content -Path ".vscode/settings.json" | ConvertFrom-Json + $_settingsJson.torizon_arch = $env:TORIZON_ARCH + Set-Content -Path ".vscode/settings.json" -Value ($_settingsJson | ConvertTo-Json) -Encoding UTF8 + ./.vscode/tasks.ps1 run build-container-torizon-debug-${env:PROJECT_ARCH} diff --git a/.github/workflows/build-debug-rust.yaml b/.github/workflows/build-debug-rust.yaml index 8b8b8273e..78ea5cc00 100644 --- a/.github/workflows/build-debug-rust.yaml +++ b/.github/workflows/build-debug-rust.yaml @@ -15,20 +15,24 @@ jobs: project: - folder: rustSlint container: rust-slint - arch: arm64 - + vendor: "{ arch: 'arm64', torizon_arch: 'aarch64' }" steps: - uses: actions/checkout@v3 - - name: Build ${{ matrix.project.folder }} Dockerfile.debug + - name: Build ${{ matrix.project.folder }} Dockerfile shell: pwsh env: PROJECT_FOLDER: ${{ matrix.project.folder }} PROJECT_CONTAINER: ${{ matrix.project.container }} - PROJECT_ARCH: ${{ matrix.project.arch }} + VENDOR: ${{ matrix.project.vendor }} + DOCKER_LOGIN: localhost:5002 run: | + $_vendor = ($env:VENDOR | ConvertFrom-Json) + $env:TORIZON_ARCH = $_vendor.torizon_arch + $env:PROJECT_ARCH = $_vendor.arch + docker run --rm --privileged torizon/binfmt scripts/createFromTemplate.ps1 ` @@ -41,6 +45,11 @@ jobs: false cd "${env:GITHUB_WORKSPACE}/${env:PROJECT_FOLDER}CITest" + + $_settingsJson = Get-Content -Path ".vscode/settings.json" | ConvertFrom-Json + $_settingsJson.torizon_arch = $env:TORIZON_ARCH + Set-Content -Path ".vscode/settings.json" -Value ($_settingsJson | ConvertTo-Json) -Encoding UTF8 + # TODO: this is bad, but it's the only way to make it work for now chmod 777 . -R diff --git a/.github/workflows/build-python.yaml b/.github/workflows/build-python.yaml index 63bf3796e..c3991017c 100644 --- a/.github/workflows/build-python.yaml +++ b/.github/workflows/build-python.yaml @@ -15,8 +15,7 @@ jobs: project: - folder: python3Console container: python3-console - arch: arm64 - + vendor: "{ arch: 'arm64', torizon_arch: 'aarch64' }" steps: - uses: actions/checkout@v3 @@ -26,10 +25,14 @@ jobs: env: PROJECT_FOLDER: ${{ matrix.project.folder }} PROJECT_CONTAINER: ${{ matrix.project.container }} - PROJECT_ARCH: ${{ matrix.project.arch }} + VENDOR: ${{ matrix.project.vendor }} DOCKER_LOGIN: localhost:5002 run: | + $_vendor = ($env:VENDOR | ConvertFrom-Json) + $env:TORIZON_ARCH = $_vendor.torizon_arch + $env:PROJECT_ARCH = $_vendor.arch + docker run --rm --privileged torizon/binfmt scripts/createFromTemplate.ps1 ` @@ -42,4 +45,9 @@ jobs: false cd "${env:GITHUB_WORKSPACE}/${env:PROJECT_FOLDER}CITest" + + $_settingsJson = Get-Content -Path ".vscode/settings.json" | ConvertFrom-Json + $_settingsJson.torizon_arch = $env:TORIZON_ARCH + Set-Content -Path ".vscode/settings.json" -Value ($_settingsJson | ConvertTo-Json) -Encoding UTF8 + ./.vscode/tasks.ps1 run build-container-torizon-release-${env:PROJECT_ARCH} diff --git a/.github/workflows/build-rust.yaml b/.github/workflows/build-rust.yaml index f8e72b02d..1ebea9292 100644 --- a/.github/workflows/build-rust.yaml +++ b/.github/workflows/build-rust.yaml @@ -15,8 +15,7 @@ jobs: project: - folder: rustSlint container: rust-slint - arch: arm64 - + vendor: "{ arch: 'arm64', torizon_arch: 'aarch64' }" steps: - uses: actions/checkout@v3 @@ -26,10 +25,14 @@ jobs: env: PROJECT_FOLDER: ${{ matrix.project.folder }} PROJECT_CONTAINER: ${{ matrix.project.container }} - PROJECT_ARCH: ${{ matrix.project.arch }} + VENDOR: ${{ matrix.project.vendor }} DOCKER_LOGIN: localhost:5002 run: | + $_vendor = ($env:VENDOR | ConvertFrom-Json) + $env:TORIZON_ARCH = $_vendor.torizon_arch + $env:PROJECT_ARCH = $_vendor.arch + docker run --rm --privileged torizon/binfmt scripts/createFromTemplate.ps1 ` @@ -42,4 +45,9 @@ jobs: false cd "${env:GITHUB_WORKSPACE}/${env:PROJECT_FOLDER}CITest" + + $_settingsJson = Get-Content -Path ".vscode/settings.json" | ConvertFrom-Json + $_settingsJson.torizon_arch = $env:TORIZON_ARCH + Set-Content -Path ".vscode/settings.json" -Value ($_settingsJson | ConvertTo-Json) -Encoding UTF8 + ./.vscode/tasks.ps1 run build-container-torizon-release-${env:PROJECT_ARCH} diff --git a/scripts/createDockerComposeProduction.ps1 b/scripts/createDockerComposeProduction.ps1 index 74fbd1ecb..3d2790916 100644 --- a/scripts/createDockerComposeProduction.ps1 +++ b/scripts/createDockerComposeProduction.ps1 @@ -119,7 +119,14 @@ if ([string]::IsNullOrEmpty($tag)) { } } -$objSettings = Get-Content ("$compoFilePath/.vscode/settings.json") | ` +if ($null -eq $env:TASKS_CUSTOM_SETTINGS_JSON) { + $env:TASKS_CUSTOM_SETTINGS_JSON = "settings.json" +} else { + Write-Host "ℹ️ :: CUSTOM SETTINGS :: ℹ️" + Write-Host "Using custom settings file: $env:TASKS_CUSTOM_SETTINGS_JSON" +} + +$objSettings = Get-Content ("$compoFilePath/.vscode/$env:TASKS_CUSTOM_SETTINGS_JSON") | ` Out-String | ConvertFrom-Json $localRegistry = $objSettings.host_ip diff --git a/scripts/tasks.ps1 b/scripts/tasks.ps1 index 213cd8893..4c03d4d4f 100644 --- a/scripts/tasks.ps1 +++ b/scripts/tasks.ps1 @@ -68,9 +68,16 @@ if ($env:TASKS_USE_PWSH_INSTEAD_BASH -eq $true) { $_usePwshInsteadBash = $false; } +if ($null -eq $env:TASKS_CUSTOM_SETTINGS_JSON) { + $env:TASKS_CUSTOM_SETTINGS_JSON = "settings.json" +} else { + Write-Host "ℹ️ :: CUSTOM SETTINGS :: ℹ️" + Write-Host "Using custom settings file: $env:TASKS_CUSTOM_SETTINGS_JSON" +} + try { $tasksFileContent = Get-Content $PSScriptRoot/tasks.json - $settingsFileContent = Get-Content $PSScriptRoot/settings.json + $settingsFileContent = Get-Content $PSScriptRoot/$env:TASKS_CUSTOM_SETTINGS_JSON $json = $tasksFileContent | ConvertFrom-Json $settings = $settingsFileContent | ConvertFrom-Json $inputs = $json.inputs @@ -215,7 +222,7 @@ function checkTorizonInputs ([System.Collections.ArrayList] $list) { foreach ($matchValue in $maches) { $matchValue = $matchValue.Value $item = $item.Replace( - "`${command:torizon_${matchValue}}", + "`${command:torizon_${matchValue}}", "`${config:torizon_${matchValue}}" ) } @@ -242,7 +249,7 @@ function checkDockerInputs ([System.Collections.ArrayList] $list) { foreach ($matchValue in $maches) { $matchValue = $matchValue.Value $item = $item.Replace( - "`${command:docker_${matchValue}}", + "`${command:docker_${matchValue}}", "`${config:docker_${matchValue}}" ) } @@ -273,7 +280,7 @@ function checkTCBInputs ([System.Collections.ArrayList] $list) { } $item = $item.Replace( - "`${command:tcb.getNextPackageVersion}", + "`${command:tcb.getNextPackageVersion}", "$_next" ) } @@ -287,7 +294,7 @@ function checkTCBInputs ([System.Collections.ArrayList] $list) { foreach ($matchValue in $maches) { $matchValue = $matchValue.Value $item = $item.Replace( - "`${command:tcb.${matchValue}}", + "`${command:tcb.${matchValue}}", "`${config:tcb.${matchValue}}" ) } @@ -379,7 +386,7 @@ function bashVariables ([System.Collections.ArrayList] $list) { # then we continue because these are meant to be expanded if ( $item.Contains("`$global:") -or - $item.Contains("`$env:") -or + $item.Contains("`$env:") -or $item.Contains("`${") ) { [void]$ret.Add($item) @@ -544,7 +551,7 @@ function runTask () { ) } else { if ( - $null -eq + $null -eq [System.Environment]::GetEnvironmentVariable($env) ) { $_env = _parseEnvs $env $task @@ -648,7 +655,7 @@ function getCliInputs () { # main() # set the relative workspaceFolder (following the pattern that VS Code expects) if ( - ($null -eq $env:APOLLOX_WORKSPACE) -and + ($null -eq $env:APOLLOX_WORKSPACE) -and ($env:APOLLOX_CONTAINER -ne 1) ) { $Global:workspaceFolder = Join-Path $PSScriptRoot ..