Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
112 changes: 112 additions & 0 deletions .github/workflows/build-test-run-reusable-workflow.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
on:
workflow_call:
inputs:
runner:
description: 'The runner to use for the job. Must be a runner-name available from GitHub actions.'
required: true
type: string
host-platform:
description: 'The host platform to use for the job. Must be the same type as the runnner. Options: [ubuntu | windows]'
required: true
type: string
target-platform:
description: 'The target platform to use for the job. Options: [host | zynq]'
required: true
type: string

jobs:
build:
runs-on: ${{ inputs.runner }}
name : Build (Target ${{ inputs.target-platform }} - Host ${{ inputs.host-platform }})
timeout-minutes: 15
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- uses: jwlawson/actions-setup-cmake@v1.14
with:
cmake-version: "3.30.x"
- uses: actions/setup-python@v5
with:
python-version: '3.11'
- run: |
python -u Scripts/BuildAndInstallExternalLibs.py --TargetPlatform ${{ inputs.target-platform }}
python -u Scripts/BuildAndInstallCoDeLib.py --TargetPlatform ${{ inputs.target-platform }}
python -u Scripts/BuildBenchmark.py --TargetPlatform ${{ inputs.target-platform }}
- name: 'Upload CoDeLib build artifacts'
uses: actions/upload-artifact@v4
with:
name: CoDeLibBuildArtifacts-target-${{ inputs.target-platform }}-host-${{ inputs.host-platform }}
path: CoDeLib/Build
retention-days: 1
- name: 'Upload benchmark build artifacts'
uses: actions/upload-artifact@v4
with:
name: BenchmarkBuildArtifacts-target-${{ inputs.target-platform }}-host-${{ inputs.host-platform }}
path: Benchmark/Build
retention-days: 1

test:
if: ${{ inputs.target-platform == 'host' }}
runs-on: ${{ inputs.runner }}
name : Test (Target ${{ inputs.target-platform }} - Host ${{ inputs.host-platform }})
needs: build
timeout-minutes: 15
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.11'
- uses: actions/download-artifact@v4
with:
name: CoDeLibBuildArtifacts-target-${{ inputs.target-platform }}-host-${{ inputs.host-platform }}
path: CoDeLib/Build
- run: |
python -u Scripts/RunTest.py
- name: 'Upload test results'
uses: actions/upload-artifact@v4
with:
name: TestResults-target-${{ inputs.target-platform }}-host-${{ inputs.host-platform }}.txt
path: TestResults.txt
retention-days: 1

benchmark:
if: ${{ inputs.target-platform == 'host' }}
runs-on: ${{ inputs.runner }}
name : Benchmark (Target ${{ inputs.target-platform }} - Host ${{ inputs.host-platform }})
needs: build
timeout-minutes: 15
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.11'
- uses: actions/download-artifact@v4
with:
name: BenchmarkBuildArtifacts-target-${{ inputs.target-platform }}-host-${{ inputs.host-platform }}
path: Benchmark/Build
- run: |
python -u Scripts/RunBenchmark.py
- name: 'Upload benchmark results'
uses: actions/upload-artifact@v4
with:
name: BenchmarkResults-target-${{ inputs.target-platform }}-host-${{ inputs.host-platform }}
path: BenchmarkResults.txt
retention-days: 1

comment_benchmark_results:
if: ${{ github.branch != 'main' }}
runs-on: ${{ inputs.runner }}
name: Comment Benchmark Results (Target ${{ inputs.target-platform }} - Host ${{ inputs.host-platform }})
needs: benchmark
timeout-minutes: 15
permissions:
pull-requests: write
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
name: BenchmarkResults-target-${{ inputs.target-platform }}-host-${{ inputs.host-platform }}
- uses: thollander/actions-comment-pull-request@v2
with:
filePath: BenchmarkResults.txt
130 changes: 55 additions & 75 deletions .github/workflows/pull-request-benchmark-workflow.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,96 +11,76 @@ on:
- "**.hpp"

jobs:
build_benchmark_test_ubuntu:

#========================================
# Checks
#========================================

check_formatting:
runs-on: ubuntu-22.04
name: Check Formatting
timeout-minutes: 15
permissions:
pull-requests: write
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- uses: jwlawson/actions-setup-cmake@v1.14
with:
cmake-version: "3.30.x"
- uses: actions/setup-python@v5
with:
python-version: '3.11'
- run: |
python -u Scripts/CheckFormattingAll_c_h_cpp_hpp.py
python -u Scripts/BuildAndInstallExternalLibs.py
python -u Scripts/BuildAndInstallCoDeLib.py
python -u Scripts/RunTest.py
python -u Scripts/BuildBenchmark.py
python -u Scripts/RunBenchmark.py
- uses: thollander/actions-comment-pull-request@v2
with:
filePath: BenchmarkResults.txt

build_benchmark_test_windows:
runs-on: windows-2022
timeout-minutes: 15
#========================================
# Target Ubuntu - Host Ubuntu
#========================================

target_ubuntu_host_ubuntu:
needs: check_formatting
permissions:
pull-requests: write
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- uses: jwlawson/actions-setup-cmake@v1.14
with:
cmake-version: "3.30.x"
- uses: actions/setup-python@v5
with:
python-version: '3.11'
- run: |
python -u Scripts/CheckFormattingAll_c_h_cpp_hpp.py
python -u Scripts/BuildAndInstallExternalLibs.py
python -u Scripts/BuildAndInstallCoDeLib.py
python -u Scripts/RunTest.py
python -u Scripts/BuildBenchmark.py
python -u Scripts/RunBenchmark.py
- uses: thollander/actions-comment-pull-request@v2
with:
filePath: BenchmarkResults.txt
uses: ./.github/workflows/build-test-run-reusable-workflow.yaml
with:
runner: 'ubuntu-22.04'
host-platform: 'ubuntu'
target-platform: 'host'

#========================================
# Target Windows - Host Windows
#========================================

target_windows_host_windows:
needs: check_formatting
permissions:
pull-requests: write
uses: ./.github/workflows/build-test-run-reusable-workflow.yaml
with:
runner: 'windows-2022'
host-platform: 'windows'
target-platform: 'host'

# build_linux_for_zynq_on_ubuntu:
# runs-on: ubuntu-22.04
# timeout-minutes: 15
#========================================
# Target Zynq - Host Ubuntu
#========================================

# build_target_zynq_host_ubuntu:
# needs: check_formatting
# permissions:
# pull-requests: write
# steps:
# - uses: actions/checkout@v4
# with:
# submodules: recursive
# - uses: jwlawson/actions-setup-cmake@v1.14
# with:
# cmake-version: "3.30.x"
# - uses: actions/setup-python@v5
# with:
# python-version: '3.11'
# - run: |
# python -u Scripts/CheckFormattingAll_c_h_cpp_hpp.py
# python -u Scripts/BuildAndInstallExternalLibs.py --TargetPlatform zynq
# python -u Scripts/BuildAndInstallCoDeLib.py --TargetPlatform zynq
# python -u Scripts/BuildBenchmark.py --TargetPlatform zynq
# uses: ./.github/workflows/build-test-run-reusable-workflow.yaml
# with:
# runner: 'ubuntu-22.04'
# host-platform: 'ubuntu'
# target-platform: 'zynq'

build_linux_for_zynq_on_windows:
runs-on: windows-2022
timeout-minutes: 15

#========================================
# Target Zynq - Host Windows
#========================================

build_target_zynq_host_windows:
needs: check_formatting
permissions:
pull-requests: write
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- uses: jwlawson/actions-setup-cmake@v1.14
with:
cmake-version: "3.30.x"
- uses: actions/setup-python@v5
with:
python-version: '3.11'
- run: |
python -u Scripts/CheckFormattingAll_c_h_cpp_hpp.py
python -u Scripts/BuildAndInstallExternalLibs.py --TargetPlatform zynq
python -u Scripts/BuildAndInstallCoDeLib.py --TargetPlatform zynq
python -u Scripts/BuildBenchmark.py --TargetPlatform zynq
uses: ./.github/workflows/build-test-run-reusable-workflow.yaml
with:
runner: 'windows-2022'
host-platform: 'windows'
target-platform: 'zynq'
78 changes: 64 additions & 14 deletions .github/workflows/push-to-main-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,76 @@ on:
branches:
- main
jobs:
build_run_targets:

#========================================
# Checks
#========================================

check_formatting:
runs-on: ubuntu-22.04
name: Check Formatting
timeout-minutes: 15
permissions:
pull-requests: write
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- uses: jwlawson/actions-setup-cmake@v1.14
with:
cmake-version: "3.30.x"
- uses: actions/setup-python@v5
with:
python-version: '3.11'

- run: |
python -u Scripts/CheckFormattingAll_c_h_cpp_hpp.py
python -u Scripts/BuildAndInstallExternalLibs.py
python -u Scripts/BuildAndInstallCoDeLib.py
python -u Scripts/RunTest.py
python -u Scripts/BuildBenchmark.py
python -u Scripts/RunBenchmark.py

#========================================
# Target Ubuntu - Host Ubuntu
#========================================

target_ubuntu_host_ubuntu:
needs: check_formatting
permissions:
pull-requests: write
uses: ./.github/workflows/build-test-run-reusable-workflow.yaml
with:
runner: 'ubuntu-22.04'
host-platform: 'ubuntu'
target-platform: 'host'

#========================================
# Target Windows - Host Windows
#========================================

target_windows_host_windows:
needs: check_formatting
permissions:
pull-requests: write
uses: ./.github/workflows/build-test-run-reusable-workflow.yaml
with:
runner: 'windows-2022'
host-platform: 'windows'
target-platform: 'host'

#========================================
# Target Zynq - Host Ubuntu
#========================================

# build_target_zynq_host_ubuntu:
# needs: check_formatting
# permissions:
# pull-requests: write
# uses: ./.github/workflows/build-test-run-reusable-workflow.yaml
# with:
# runner: 'ubuntu-22.04'
# host-platform: 'ubuntu'
# target-platform: 'zynq'


#========================================
# Target Zynq - Host Windows
#========================================

build_target_zynq_host_windows:
needs: check_formatting
permissions:
pull-requests: write
uses: ./.github/workflows/build-test-run-reusable-workflow.yaml
with:
runner: 'windows-2022'
host-platform: 'windows'
target-platform: 'zynq'
8 changes: 8 additions & 0 deletions Scripts/RunBenchmark.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import os
import stat
from pathlib import Path
import subprocess
import re
Expand Down Expand Up @@ -120,6 +121,13 @@ def RunBenchmark(
print(BenchmarkHeader, end="")

BenchmarkExecutablePath = Path(BuildDirectory / BenchmarkName)
if targetPlatform == EnvironmentConfig.Platform.WINDOWS:
BenchmarkExecutablePath = BenchmarkExecutablePath.with_suffix(".exe")

BenchmarkExecutablePath.chmod(
BenchmarkExecutablePath.stat().st_mode | stat.S_IEXEC
)

BenchmarkCommand = str(BenchmarkExecutablePath) + " " + BenchmarkOptions
print("Command: {}".format(BenchmarkCommand))

Expand Down
6 changes: 6 additions & 0 deletions Scripts/RunTest.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import os
import stat
from pathlib import Path
import subprocess
import EnvironmentConfig
Expand Down Expand Up @@ -107,6 +108,11 @@ def RunTests(
print(testHeader, end="")

TestExecutablePath = Path(CoDeLibBuildPath / "Test" / testName)
if targetPlatform == EnvironmentConfig.Platform.WINDOWS:
TestExecutablePath = TestExecutablePath.with_suffix(".exe")

TestExecutablePath.chmod(TestExecutablePath.stat().st_mode | stat.S_IEXEC)

TestOptions = '"' + str(BenchmarkTestFilesPath) + '/"'
TestCommand = str(TestExecutablePath) + " " + TestOptions

Expand Down