From ae2ef0a66d0d247fcda5043de4ee0b39c7f3abbf Mon Sep 17 00:00:00 2001 From: Matheus Castello Date: Mon, 13 Jan 2025 13:53:17 -0300 Subject: [PATCH] =?UTF-8?q?github:=20workflow:=20build=20workflows=20use?= =?UTF-8?q?=20xonsh=20instead=20of=20pwsh=20=F0=9F=98=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Matheus Castello --- .github/workflows/build-ccpp.yaml | 70 +++++++++++++++-------- .github/workflows/build-debug-ccpp.yaml | 65 +++++++++++++-------- .github/workflows/build-debug-python.yaml | 68 ++++++++++++++-------- .github/workflows/build-debug-rust.yaml | 64 +++++++++++++-------- .github/workflows/build-python.yaml | 68 ++++++++++++++-------- .github/workflows/build-rust.yaml | 68 ++++++++++++++-------- scripts/run-container-if-not-exists.xsh | 1 + 7 files changed, 259 insertions(+), 145 deletions(-) diff --git a/.github/workflows/build-ccpp.yaml b/.github/workflows/build-ccpp.yaml index 510149c58..4cad53406 100644 --- a/.github/workflows/build-ccpp.yaml +++ b/.github/workflows/build-ccpp.yaml @@ -15,11 +15,11 @@ jobs: project: - folder: cppQML container: cpp-qml - vendor: "{ arch: 'arm64', torizon_arch: 'aarch64' }" + vendor: '{ "arch": "arm64", "torizon_arch": "aarch64" }' - folder: cppSlint container: cpp-slint - vendor: "{ arch: 'arm64', torizon_arch: 'aarch64' }" + vendor: '{ "arch": "arm64", "torizon_arch": "aarch64" }' steps: - uses: actions/checkout@v3 @@ -29,8 +29,19 @@ jobs: echo "${{ github.workspace }}" >> abs-path cat abs-path + - name: Setup Xonsh + run: | + sudo apt-get update + sudo apt-get install -y python3 python3-pip pipx + sudo bash ./scripts/bash/setup-xonsh.sh + sudo ln -s /root/.local/bin/xonsh /usr/bin/xonsh + + - name: Update torizon-utils module + run: | + pipx inject xonsh -f ./scripts/utils/pip/ + - name: Build ${{ matrix.project.folder }} Dockerfile - shell: pwsh + shell: xonsh {0} env: PROJECT_FOLDER: ${{ matrix.project.folder }} PROJECT_CONTAINER: ${{ matrix.project.container }} @@ -38,25 +49,34 @@ jobs: DOCKER_LOGIN: localhost:5002 run: | - $_vendor = ($env:VENDOR | ConvertFrom-Json) - $env:TORIZON_ARCH = $_vendor.torizon_arch - $env:PROJECT_ARCH = $_vendor.arch - - scripts/createFromTemplate.ps1 ` - $env:GITHUB_WORKSPACE/$env:PROJECT_FOLDER ` - "${env:PROJECT_FOLDER}CITest" ` - "${env:PROJECT_CONTAINER}-ci-test" ` - $env:GITHUB_WORKSPACE ` - $env:PROJECT_FOLDER ` - false ` - false - - cp abs-path "${env:GITHUB_WORKSPACE}/${env:PROJECT_FOLDER}CITest" - 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 run-torizon-binfmt - ./.vscode/tasks.ps1 run build-container-torizon-release-${env:PROJECT_ARCH} + import os + import json + + $RAISE_SUBPROC_ERROR = True + $XONSH_SHOW_TRACEBACK = True + $UPDATE_OS_ENVIRON = True + + vendor = json.loads(os.environ['VENDOR']) + $TORIZON_ARCH = vendor["torizon_arch"] + $PROJECT_ARCH = vendor["arch"] + + xonsh ./scripts/create-from-template.xsh \ + @(f"{os.environ['GITHUB_WORKSPACE']}/{os.environ['PROJECT_FOLDER']}") \ + @(f"{os.environ['PROJECT_FOLDER']}CITest") \ + @(f"{os.environ['PROJECT_CONTAINER']}-ci-test") \ + @(os.environ['GITHUB_WORKSPACE']) \ + @(os.environ['PROJECT_FOLDER']) \ + "false" \ + "false" + + cp "abs-path" @(f"{os.environ['GITHUB_WORKSPACE']}/{os.environ['PROJECT_FOLDER']}CITest") + os.chdir(f"{os.environ['GITHUB_WORKSPACE']}/{os.environ['PROJECT_FOLDER']}CITest") + + with open(".vscode/settings.json", "r") as file: + settings_json = json.load(file) + settings_json["torizon_arch"] = os.environ['TORIZON_ARCH'] + with open(".vscode/settings.json", "w") as file: + json.dump(settings_json, file, indent=4) + + xonsh ./.vscode/tasks.xsh run run-torizon-binfmt + xonsh ./.vscode/tasks.xsh run @(f"build-container-torizon-release-{os.environ['PROJECT_ARCH']}") diff --git a/.github/workflows/build-debug-ccpp.yaml b/.github/workflows/build-debug-ccpp.yaml index 38f9ef0ec..d03beac51 100644 --- a/.github/workflows/build-debug-ccpp.yaml +++ b/.github/workflows/build-debug-ccpp.yaml @@ -15,11 +15,11 @@ jobs: project: - folder: cppQML container: cpp-qml - vendor: "{ arch: 'arm64', torizon_arch: 'aarch64' }" + vendor: '{ "arch": "arm64", "torizon_arch": "aarch64" }' - folder: cppSlint container: cpp-slint - vendor: "{ arch: 'arm64', torizon_arch: 'aarch64' }" + vendor: '{ "arch": "arm64", "torizon_arch": "aarch64" }' steps: - uses: actions/checkout@v3 @@ -29,8 +29,19 @@ jobs: echo "${{ github.workspace }}" >> abs-path cat abs-path + - name: Setup Xonsh + run: | + sudo apt-get update + sudo apt-get install -y python3 python3-pip pipx + sudo bash ./scripts/bash/setup-xonsh.sh + sudo ln -s /root/.local/bin/xonsh /usr/bin/xonsh + + - name: Update torizon-utils module + run: | + pipx inject xonsh -f ./scripts/utils/pip/ + - name: Build ${{ matrix.project.folder }} Dockerfile - shell: pwsh + shell: xonsh {0} env: PROJECT_FOLDER: ${{ matrix.project.folder }} PROJECT_CONTAINER: ${{ matrix.project.container }} @@ -38,29 +49,35 @@ jobs: DOCKER_LOGIN: localhost:5002 run: | - $_vendor = ($env:VENDOR | ConvertFrom-Json) - $env:TORIZON_ARCH = $_vendor.torizon_arch - $env:PROJECT_ARCH = $_vendor.arch + import os + import json + + $RAISE_SUBPROC_ERROR = True + $XONSH_SHOW_TRACEBACK = True + $UPDATE_OS_ENVIRON = True - scripts/createFromTemplate.ps1 ` - $env:GITHUB_WORKSPACE/$env:PROJECT_FOLDER ` - "${env:PROJECT_FOLDER}CITest" ` - "${env:PROJECT_CONTAINER}-ci-test" ` - $env:GITHUB_WORKSPACE ` - $env:PROJECT_FOLDER ` - false ` - false + vendor = json.loads(os.environ['VENDOR']) + $TORIZON_ARCH = vendor["torizon_arch"] + $PROJECT_ARCH = vendor["arch"] - cp abs-path "${env:GITHUB_WORKSPACE}/${env:PROJECT_FOLDER}CITest" - cd "${env:GITHUB_WORKSPACE}/${env:PROJECT_FOLDER}CITest" + xonsh ./scripts/create-from-template.xsh \ + @(f"{os.environ['GITHUB_WORKSPACE']}/{os.environ['PROJECT_FOLDER']}") \ + @(f"{os.environ['PROJECT_FOLDER']}CITest") \ + @(f"{os.environ['PROJECT_CONTAINER']}-ci-test") \ + @(os.environ['GITHUB_WORKSPACE']) \ + @(os.environ['PROJECT_FOLDER']) \ + "false" \ + "false" - $_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 + cp "abs-path" @(f"{os.environ['GITHUB_WORKSPACE']}/{os.environ['PROJECT_FOLDER']}CITest") + os.chdir(f"{os.environ['GITHUB_WORKSPACE']}/{os.environ['PROJECT_FOLDER']}CITest") - # TODO: this is bad, but it's the only way to make it work for now - chmod 777 . -R + with open(".vscode/settings.json", "r") as file: + settings_json = json.load(file) + settings_json["torizon_arch"] = os.environ['TORIZON_ARCH'] + with open(".vscode/settings.json", "w") as file: + json.dump(settings_json, file, indent=4) - ./.vscode/tasks.ps1 run run-torizon-binfmt - ./.vscode/tasks.ps1 run build-debug-${env:PROJECT_ARCH} - ./.vscode/tasks.ps1 run build-container-torizon-debug-${env:PROJECT_ARCH} + xonsh ./.vscode/tasks.xsh run run-torizon-binfmt + xonsh ./.vscode/tasks.xsh run @(f"build-debug-{os.environ['PROJECT_ARCH']}") + xonsh ./.vscode/tasks.xsh run @(f"build-container-torizon-debug-{os.environ['PROJECT_ARCH']}") diff --git a/.github/workflows/build-debug-python.yaml b/.github/workflows/build-debug-python.yaml index db9db6188..708010639 100644 --- a/.github/workflows/build-debug-python.yaml +++ b/.github/workflows/build-debug-python.yaml @@ -15,7 +15,7 @@ jobs: project: - folder: python3Console container: python3-console - vendor: "{ arch: 'arm64', torizon_arch: 'aarch64' }" + vendor: '{ "arch": "arm64", "torizon_arch": "aarch64" }' steps: - uses: actions/checkout@v3 @@ -25,8 +25,19 @@ jobs: echo "${{ github.workspace }}" >> abs-path cat abs-path + - name: Setup Xonsh + run: | + sudo apt-get update + sudo apt-get install -y python3 python3-pip pipx + sudo bash ./scripts/bash/setup-xonsh.sh + sudo ln -s /root/.local/bin/xonsh /usr/bin/xonsh + + - name: Update torizon-utils module + run: | + pipx inject xonsh -f ./scripts/utils/pip/ + - name: Build ${{ matrix.project.folder }} Dockerfile - shell: pwsh + shell: xonsh {0} env: PROJECT_FOLDER: ${{ matrix.project.folder }} PROJECT_CONTAINER: ${{ matrix.project.container }} @@ -34,25 +45,34 @@ jobs: DOCKER_LOGIN: localhost:5002 run: | - $_vendor = ($env:VENDOR | ConvertFrom-Json) - $env:TORIZON_ARCH = $_vendor.torizon_arch - $env:PROJECT_ARCH = $_vendor.arch - - scripts/createFromTemplate.ps1 ` - $env:GITHUB_WORKSPACE/$env:PROJECT_FOLDER ` - "${env:PROJECT_FOLDER}CITest" ` - "${env:PROJECT_CONTAINER}-ci-test" ` - $env:GITHUB_WORKSPACE ` - $env:PROJECT_FOLDER ` - false ` - false - - cp abs-path "${env:GITHUB_WORKSPACE}/${env:PROJECT_FOLDER}CITest" - 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 run-torizon-binfmt - ./.vscode/tasks.ps1 run build-container-torizon-debug-${env:PROJECT_ARCH} + import os + import json + + $RAISE_SUBPROC_ERROR = True + $XONSH_SHOW_TRACEBACK = True + $UPDATE_OS_ENVIRON = True + + vendor = json.loads(os.environ['VENDOR']) + $TORIZON_ARCH = vendor["torizon_arch"] + $PROJECT_ARCH = vendor["arch"] + + xonsh ./scripts/create-from-template.xsh \ + @(f"{os.environ['GITHUB_WORKSPACE']}/{os.environ['PROJECT_FOLDER']}") \ + @(f"{os.environ['PROJECT_FOLDER']}CITest") \ + @(f"{os.environ['PROJECT_CONTAINER']}-ci-test") \ + @(os.environ['GITHUB_WORKSPACE']) \ + @(os.environ['PROJECT_FOLDER']) \ + "false" \ + "false" + + cp "abs-path" @(f"{os.environ['GITHUB_WORKSPACE']}/{os.environ['PROJECT_FOLDER']}CITest") + os.chdir(f"{os.environ['GITHUB_WORKSPACE']}/{os.environ['PROJECT_FOLDER']}CITest") + + with open(".vscode/settings.json", "r") as file: + settings_json = json.load(file) + settings_json["torizon_arch"] = os.environ['TORIZON_ARCH'] + with open(".vscode/settings.json", "w") as file: + json.dump(settings_json, file, indent=4) + + xonsh ./.vscode/tasks.xsh run run-torizon-binfmt + xonsh ./.vscode/tasks.xsh run @(f"build-container-torizon-debug-{os.environ['PROJECT_ARCH']}") diff --git a/.github/workflows/build-debug-rust.yaml b/.github/workflows/build-debug-rust.yaml index 1342c9377..fc16eff46 100644 --- a/.github/workflows/build-debug-rust.yaml +++ b/.github/workflows/build-debug-rust.yaml @@ -15,7 +15,7 @@ jobs: project: - folder: rustSlint container: rust-slint - vendor: "{ arch: 'arm64', torizon_arch: 'aarch64' }" + vendor: '{ "arch": "arm64", "torizon_arch": "aarch64" }' steps: - uses: actions/checkout@v3 @@ -25,8 +25,19 @@ jobs: echo "${{ github.workspace }}" >> abs-path cat abs-path + - name: Setup Xonsh + run: | + sudo apt-get update + sudo apt-get install -y python3 python3-pip pipx + sudo bash ./scripts/bash/setup-xonsh.sh + sudo ln -s /root/.local/bin/xonsh /usr/bin/xonsh + + - name: Update torizon-utils module + run: | + pipx inject xonsh -f ./scripts/utils/pip/ + - name: Build ${{ matrix.project.folder }} Dockerfile - shell: pwsh + shell: xonsh {0} env: PROJECT_FOLDER: ${{ matrix.project.folder }} PROJECT_CONTAINER: ${{ matrix.project.container }} @@ -34,31 +45,36 @@ jobs: DOCKER_LOGIN: localhost:5002 run: | - $_vendor = ($env:VENDOR | ConvertFrom-Json) - $env:TORIZON_ARCH = $_vendor.torizon_arch - $env:PROJECT_ARCH = $_vendor.arch + import os + import json - scripts/createFromTemplate.ps1 ` - $env:GITHUB_WORKSPACE/$env:PROJECT_FOLDER ` - "${env:PROJECT_FOLDER}CITest" ` - "${env:PROJECT_CONTAINER}-ci-test" ` - $env:GITHUB_WORKSPACE ` - $env:PROJECT_FOLDER ` - false ` - false + $RAISE_SUBPROC_ERROR = True + $XONSH_SHOW_TRACEBACK = True + $UPDATE_OS_ENVIRON = True - cp abs-path "${env:GITHUB_WORKSPACE}/${env:PROJECT_FOLDER}CITest" - cd "${env:GITHUB_WORKSPACE}/${env:PROJECT_FOLDER}CITest" + vendor = json.loads(os.environ['VENDOR']) + $TORIZON_ARCH = vendor["torizon_arch"] + $PROJECT_ARCH = vendor["arch"] + xonsh ./scripts/create-from-template.xsh \ + @(f"{os.environ['GITHUB_WORKSPACE']}/{os.environ['PROJECT_FOLDER']}") \ + @(f"{os.environ['PROJECT_FOLDER']}CITest") \ + @(f"{os.environ['PROJECT_CONTAINER']}-ci-test") \ + @(os.environ['GITHUB_WORKSPACE']) \ + @(os.environ['PROJECT_FOLDER']) \ + "false" \ + "false" - $_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 + cp "abs-path" @(f"{os.environ['GITHUB_WORKSPACE']}/{os.environ['PROJECT_FOLDER']}CITest") + os.chdir(f"{os.environ['GITHUB_WORKSPACE']}/{os.environ['PROJECT_FOLDER']}CITest") - # TODO: this is bad, but it's the only way to make it work for now - chmod 777 . -R + with open(".vscode/settings.json", "r") as file: + settings_json = json.load(file) + settings_json["torizon_arch"] = os.environ['TORIZON_ARCH'] + with open(".vscode/settings.json", "w") as file: + json.dump(settings_json, file, indent=4) - ./.vscode/tasks.ps1 run run-torizon-binfmt - ./.vscode/tasks.ps1 run build-debug-${env:PROJECT_ARCH} - ./.vscode/tasks.ps1 run copy-debug-executable-${env:PROJECT_ARCH} - ./.vscode/tasks.ps1 run build-container-torizon-debug-${env:PROJECT_ARCH} + xonsh ./.vscode/tasks.xsh run run-torizon-binfmt + xonsh ./.vscode/tasks.xsh run @(f"build-debug-{os.environ['PROJECT_ARCH']}") + xonsh ./.vscode/tasks.xsh run @(f"copy-debug-executable-{os.environ['PROJECT_ARCH']}") + xonsh ./.vscode/tasks.xsh run @(f"build-container-torizon-debug-{os.environ['PROJECT_ARCH']}") diff --git a/.github/workflows/build-python.yaml b/.github/workflows/build-python.yaml index 91b3bbe30..679a7ebe7 100644 --- a/.github/workflows/build-python.yaml +++ b/.github/workflows/build-python.yaml @@ -15,7 +15,7 @@ jobs: project: - folder: python3Console container: python3-console - vendor: "{ arch: 'arm64', torizon_arch: 'aarch64' }" + vendor: '{ "arch": "arm64", "torizon_arch": "aarch64" }' steps: - uses: actions/checkout@v3 @@ -25,8 +25,19 @@ jobs: echo "${{ github.workspace }}" >> abs-path cat abs-path + - name: Setup Xonsh + run: | + sudo apt-get update + sudo apt-get install -y python3 python3-pip pipx + sudo bash ./scripts/bash/setup-xonsh.sh + sudo ln -s /root/.local/bin/xonsh /usr/bin/xonsh + + - name: Update torizon-utils module + run: | + pipx inject xonsh -f ./scripts/utils/pip/ + - name: Build ${{ matrix.project.folder }} Dockerfile - shell: pwsh + shell: xonsh {0} env: PROJECT_FOLDER: ${{ matrix.project.folder }} PROJECT_CONTAINER: ${{ matrix.project.container }} @@ -34,25 +45,34 @@ jobs: DOCKER_LOGIN: localhost:5002 run: | - $_vendor = ($env:VENDOR | ConvertFrom-Json) - $env:TORIZON_ARCH = $_vendor.torizon_arch - $env:PROJECT_ARCH = $_vendor.arch - - scripts/createFromTemplate.ps1 ` - $env:GITHUB_WORKSPACE/$env:PROJECT_FOLDER ` - "${env:PROJECT_FOLDER}CITest" ` - "${env:PROJECT_CONTAINER}-ci-test" ` - $env:GITHUB_WORKSPACE ` - $env:PROJECT_FOLDER ` - false ` - false - - cp abs-path "${env:GITHUB_WORKSPACE}/${env:PROJECT_FOLDER}CITest" - 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 run-torizon-binfmt - ./.vscode/tasks.ps1 run build-container-torizon-release-${env:PROJECT_ARCH} + import os + import json + + $RAISE_SUBPROC_ERROR = True + $XONSH_SHOW_TRACEBACK = True + $UPDATE_OS_ENVIRON = True + + vendor = json.loads(os.environ['VENDOR']) + $TORIZON_ARCH = vendor["torizon_arch"] + $PROJECT_ARCH = vendor["arch"] + + xonsh ./scripts/create-from-template.xsh \ + @(f"{os.environ['GITHUB_WORKSPACE']}/{os.environ['PROJECT_FOLDER']}") \ + @(f"{os.environ['PROJECT_FOLDER']}CITest") \ + @(f"{os.environ['PROJECT_CONTAINER']}-ci-test") \ + @(os.environ['GITHUB_WORKSPACE']) \ + @(os.environ['PROJECT_FOLDER']) \ + "false" \ + "false" + + cp "abs-path" @(f"{os.environ['GITHUB_WORKSPACE']}/{os.environ['PROJECT_FOLDER']}CITest") + os.chdir(f"{os.environ['GITHUB_WORKSPACE']}/{os.environ['PROJECT_FOLDER']}CITest") + + with open(".vscode/settings.json", "r") as file: + settings_json = json.load(file) + settings_json["torizon_arch"] = os.environ['TORIZON_ARCH'] + with open(".vscode/settings.json", "w") as file: + json.dump(settings_json, file, indent=4) + + xonsh ./.vscode/tasks.xsh run run-torizon-binfmt + xonsh ./.vscode/tasks.xsh run @(f"build-container-torizon-release-{os.environ['PROJECT_ARCH']}") diff --git a/.github/workflows/build-rust.yaml b/.github/workflows/build-rust.yaml index 0b027ec5d..b8be1de42 100644 --- a/.github/workflows/build-rust.yaml +++ b/.github/workflows/build-rust.yaml @@ -15,7 +15,7 @@ jobs: project: - folder: rustSlint container: rust-slint - vendor: "{ arch: 'arm64', torizon_arch: 'aarch64' }" + vendor: '{ "arch": "arm64", "torizon_arch": "aarch64" }' steps: - uses: actions/checkout@v3 @@ -25,8 +25,19 @@ jobs: echo "${{ github.workspace }}" >> abs-path cat abs-path + - name: Setup Xonsh + run: | + sudo apt-get update + sudo apt-get install -y python3 python3-pip pipx + sudo bash ./scripts/bash/setup-xonsh.sh + sudo ln -s /root/.local/bin/xonsh /usr/bin/xonsh + + - name: Update torizon-utils module + run: | + pipx inject xonsh -f ./scripts/utils/pip/ + - name: Build ${{ matrix.project.folder }} Dockerfile - shell: pwsh + shell: xonsh {0} env: PROJECT_FOLDER: ${{ matrix.project.folder }} PROJECT_CONTAINER: ${{ matrix.project.container }} @@ -34,25 +45,34 @@ jobs: DOCKER_LOGIN: localhost:5002 run: | - $_vendor = ($env:VENDOR | ConvertFrom-Json) - $env:TORIZON_ARCH = $_vendor.torizon_arch - $env:PROJECT_ARCH = $_vendor.arch - - scripts/createFromTemplate.ps1 ` - $env:GITHUB_WORKSPACE/$env:PROJECT_FOLDER ` - "${env:PROJECT_FOLDER}CITest" ` - "${env:PROJECT_CONTAINER}-ci-test" ` - $env:GITHUB_WORKSPACE ` - $env:PROJECT_FOLDER ` - false ` - false - - cp abs-path "${env:GITHUB_WORKSPACE}/${env:PROJECT_FOLDER}CITest" - 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 run-torizon-binfmt - ./.vscode/tasks.ps1 run build-container-torizon-release-${env:PROJECT_ARCH} + import os + import json + + $RAISE_SUBPROC_ERROR = True + $XONSH_SHOW_TRACEBACK = True + $UPDATE_OS_ENVIRON = True + + vendor = json.loads(os.environ['VENDOR']) + $TORIZON_ARCH = vendor["torizon_arch"] + $PROJECT_ARCH = vendor["arch"] + + xonsh ./scripts/create-from-template.xsh \ + @(f"{os.environ['GITHUB_WORKSPACE']}/{os.environ['PROJECT_FOLDER']}") \ + @(f"{os.environ['PROJECT_FOLDER']}CITest") \ + @(f"{os.environ['PROJECT_CONTAINER']}-ci-test") \ + @(os.environ['GITHUB_WORKSPACE']) \ + @(os.environ['PROJECT_FOLDER']) \ + "false" \ + "false" + + cp "abs-path" @(f"{os.environ['GITHUB_WORKSPACE']}/{os.environ['PROJECT_FOLDER']}CITest") + os.chdir(f"{os.environ['GITHUB_WORKSPACE']}/{os.environ['PROJECT_FOLDER']}CITest") + + with open(".vscode/settings.json", "r") as file: + settings_json = json.load(file) + settings_json["torizon_arch"] = os.environ['TORIZON_ARCH'] + with open(".vscode/settings.json", "w") as file: + json.dump(settings_json, file, indent=4) + + xonsh ./.vscode/tasks.xsh run run-torizon-binfmt + xonsh ./.vscode/tasks.xsh run @(f"build-container-torizon-release-{os.environ['PROJECT_ARCH']}") diff --git a/scripts/run-container-if-not-exists.xsh b/scripts/run-container-if-not-exists.xsh index 1ee2622b0..a1cacb5ed 100644 --- a/scripts/run-container-if-not-exists.xsh +++ b/scripts/run-container-if-not-exists.xsh @@ -48,6 +48,7 @@ arg_parser.add_argument( args = arg_parser.parse_args() container_runtime = args.container_runtime.replace("\"", "") run_arguments = args.run_arguments.replace("\"", "") +run_arguments = run_arguments.replace("'", "") container_name = args.container_name.replace("\"", "") if "GITLAB_CI" in os.environ: