Skip to content

Commit

Permalink
github: workflow: build workflows use xonsh instead of pwsh 😢
Browse files Browse the repository at this point in the history
Signed-off-by: Matheus Castello <[email protected]>
  • Loading branch information
microhobby committed Jan 13, 2025
1 parent 1b807cf commit 28d0291
Show file tree
Hide file tree
Showing 7 changed files with 205 additions and 139 deletions.
62 changes: 37 additions & 25 deletions .github/workflows/build-ccpp.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,21 @@ on:
jobs:
ccpp:
runs-on: ubuntu-latest
container:
image: torizonextras/torizon-dev:dev
options: --user root
if: github.ref == 'refs/heads/bookworm' || github.ref == 'refs/heads/dev'
name: C/C++ Container
strategy:
matrix:
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
Expand All @@ -30,33 +33,42 @@ jobs:
cat abs-path
- name: Build ${{ matrix.project.folder }} Dockerfile
shell: pwsh
shell: xonsh {0}
env:
PROJECT_FOLDER: ${{ matrix.project.folder }}
PROJECT_CONTAINER: ${{ matrix.project.container }}
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
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']}")
53 changes: 31 additions & 22 deletions .github/workflows/build-debug-ccpp.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ on:
jobs:
ccpp-debug:
runs-on: ubuntu-latest
container:
image: torizonextras/torizon-dev:dev
options: --user root
if: github.ref == 'refs/heads/bookworm' || github.ref == 'refs/heads/dev'
name: C/C++ Container Debug
strategy:
Expand All @@ -30,37 +33,43 @@ jobs:
cat abs-path
- name: Build ${{ matrix.project.folder }} Dockerfile
shell: pwsh
shell: xonsh {0}
env:
PROJECT_FOLDER: ${{ matrix.project.folder }}
PROJECT_CONTAINER: ${{ matrix.project.container }}
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
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"]
$_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
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"
# TODO: this is bad, but it's the only way to make it work for now
chmod 777 . -R
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")
./.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}
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-debug-{os.environ['PROJECT_ARCH']}")
xonsh ./.vscode/tasks.xsh run @(f"build-container-torizon-debug-{os.environ['PROJECT_ARCH']}")
58 changes: 35 additions & 23 deletions .github/workflows/build-debug-python.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ on:
jobs:
python3-debug:
runs-on: ubuntu-latest
container:
image: torizonextras/torizon-dev:dev
options: --user root
if: github.ref == 'refs/heads/bookworm' || github.ref == 'refs/heads/dev'
name: Python3 Container Debug
strategy:
Expand All @@ -26,33 +29,42 @@ jobs:
cat abs-path
- name: Build ${{ matrix.project.folder }} Dockerfile
shell: pwsh
shell: xonsh {0}
env:
PROJECT_FOLDER: ${{ matrix.project.folder }}
PROJECT_CONTAINER: ${{ matrix.project.container }}
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
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']}")
54 changes: 31 additions & 23 deletions .github/workflows/build-debug-rust.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ on:
jobs:
rust-debug:
runs-on: ubuntu-latest
container:
image: torizonextras/torizon-dev:dev
options: --user root
if: github.ref == 'refs/heads/bookworm' || github.ref == 'refs/heads/dev'
name: Rust Container Debug
strategy:
Expand All @@ -26,39 +29,44 @@ jobs:
cat abs-path
- name: Build ${{ matrix.project.folder }} Dockerfile
shell: pwsh
shell: xonsh {0}
env:
PROJECT_FOLDER: ${{ matrix.project.folder }}
PROJECT_CONTAINER: ${{ matrix.project.container }}
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
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']}")
58 changes: 35 additions & 23 deletions .github/workflows/build-python.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ on:
jobs:
python3:
runs-on: ubuntu-latest
container:
image: torizonextras/torizon-dev:dev
options: --user root
if: github.ref == 'refs/heads/bookworm' || github.ref == 'refs/heads/dev'
name: Python3 Container
strategy:
Expand All @@ -26,33 +29,42 @@ jobs:
cat abs-path
- name: Build ${{ matrix.project.folder }} Dockerfile
shell: pwsh
shell: xonsh {0}
env:
PROJECT_FOLDER: ${{ matrix.project.folder }}
PROJECT_CONTAINER: ${{ matrix.project.container }}
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
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']}")
Loading

0 comments on commit 28d0291

Please sign in to comment.