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 15, 2025
1 parent 1b807cf commit ae2ef0a
Show file tree
Hide file tree
Showing 7 changed files with 259 additions and 145 deletions.
70 changes: 45 additions & 25 deletions .github/workflows/build-ccpp.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -29,34 +29,54 @@ 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 }}
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']}")
65 changes: 41 additions & 24 deletions .github/workflows/build-debug-ccpp.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -29,38 +29,55 @@ 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 }}
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
$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']}")
68 changes: 44 additions & 24 deletions .github/workflows/build-debug-python.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -25,34 +25,54 @@ 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 }}
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']}")
64 changes: 40 additions & 24 deletions .github/workflows/build-debug-rust.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -25,40 +25,56 @@ 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 }}
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']}")
Loading

0 comments on commit ae2ef0a

Please sign in to comment.