Skip to content

Added some primitives, fixed some bugs (#111) #4

Added some primitives, fixed some bugs (#111)

Added some primitives, fixed some bugs (#111) #4

Workflow file for this run

name: Validate TSL
on:
push:
branches:
- main
pull_request:
branches:
- main
types:
- opened
- synchronize
- reopened
- ready_for_review
workflow_dispatch:
jobs:
define-targets:
runs-on: ubuntu-latest
outputs:
target-matrix: ${{ steps.parse-target-specs.outputs.target_matrix }}
x86-flags-matrix: ${{ steps.parse-target-specs.outputs.x86_flags_matrix }}
x86-flags-compiler-matrix: ${{ steps.parse-target-specs.outputs.x86_flags_compiler_matrix }}
aarch64-flags-matrix: ${{ steps.parse-target-specs.outputs.aarch64_flags_matrix }}
aarch64-flags-compiler-matrix: ${{ steps.parse-target-specs.outputs.aarch64_flags_compiler_matrix }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ github.ref }}
- name: Parse Target Specs
id: parse-target-specs
run: |
echo "x86_flags_matrix=$(jq '{include: .x86}' .github/workflows/target_specs.json -c)" >> $GITHUB_OUTPUT
echo "x86_flags_compiler_matrix=$(jq '.x86 |= map([
. + {compiler: "g++"},
. + {compiler: "clang++"}
]) | .x86 |= flatten | {include: .x86}' .github/workflows/target_specs.json -c)" >> $GITHUB_OUTPUT
echo "aarch64_flags_matrix=$(jq '{include: .aarch64}' .github/workflows/target_specs.json -c)" >> $GITHUB_OUTPUT
echo "aarch64_flags_compiler_matrix=$(jq '.aarch64 |= map([
. + {compiler: "aarch64-linux-gnu-g++"},
. + {compiler: "clang++"}
]) | .aarch64 |= flatten | {include: .aarch64}' .github/workflows/target_specs.json -c)" >> $GITHUB_OUTPUT
echo "target_matrix=$(jq -c '{include: ([keys[] as $k | .[$k][] | (. + { arch: $k })])}' .github/workflows/target_specs.json -c)" >> $GITHUB_OUTPUT
build-generation-image:
name: Generation Image (build and push on demand)
uses: ./.github/workflows/build_and_push_dockerhub.yml
with:
context: .
path: .github/workflows/docker/generate_ubuntu.dockerfile
image_name: tsl-generate
platforms: linux/amd64
mandatory_files: requirements.txt
secrets:
dockerhub_username: ${{ vars.DOCKERHUB_USERNAME }}
dockerhub_token: ${{ secrets.DOCKERHUB_TOKEN }}
build-compile-image:
name: Compilation Image (build and push on demand)
uses: ./.github/workflows/build_and_push_dockerhub.yml
with:
context: .
path: .github/workflows/docker/compile_ubuntu.dockerfile
image_name: tsl-compile
platforms: linux/amd64
secrets:
dockerhub_username: ${{ vars.DOCKERHUB_USERNAME }}
dockerhub_token: ${{ secrets.DOCKERHUB_TOKEN }}
build-x86-emulation-image:
name: x86 Emulation Image (build and push on demand)
uses: ./.github/workflows/build_and_push_dockerhub.yml
with:
context: .
path: .github/workflows/docker/emulate_x86_archlinux.dockerfile
image_name: tsl-emulate-x86-archlinux
platforms: linux/amd64
secrets:
dockerhub_username: ${{ vars.DOCKERHUB_USERNAME }}
dockerhub_token: ${{ secrets.DOCKERHUB_TOKEN }}
build-aarch64-emulation-image:
name: aarch64 Emulation Image (build and push on demand)
uses: ./.github/workflows/build_and_push_dockerhub.yml
with:
context: .
path: .github/workflows/docker/emulate_aarch64_ubuntu.dockerfile
image_name: tsl-emulate-aarch64-ubuntu
platforms: linux/amd64
secrets:
dockerhub_username: ${{ vars.DOCKERHUB_USERNAME }}
dockerhub_token: ${{ secrets.DOCKERHUB_TOKEN }}
run-validation-tsl:
needs: [build-generation-image]
runs-on: ubuntu-latest
container:
image: ${{ vars.DOCKERHUB_USERNAME }}/${{ needs.build-generation-image.outputs.image_fqname }}:latest
strategy:
fail-fast: false
matrix:
python_version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ github.ref }}
- name: Create Log Directory
run: mkdir -p log
- name: Run TSL validation
run: |
.github/workflows/utils/validate_tsl.sh "${{ matrix.python_version }}" log
- name: Run linter
if: always()
run: |
yamllint --no-warnings -d relaxed ./primitive_data > log/yamllint.log 2>&1
- name: Upload logs
uses: actions/upload-artifact@v4
if: always()
with:
name: validation-${{ matrix.python_version }}
path: ./log
compression-level: 9
consolidate-validation-logs:
needs: [run-validation-tsl]
runs-on: ubuntu-latest
if: always()
steps:
- name: Merge logs
uses: actions/upload-artifact/merge@v4
with:
name: validation-logs
pattern: validation-*
separate-directories: true
delete-merged: true
compression-level: 9
- name: Break on error
run: |
echo "Generate x86 status: ${{ needs.run-validation-tsl.result }}"
if [ "${{ needs.run-validation-tsl.result }}" != "success" ]; then
exit 1
fi
run-generation:
needs: [build-generation-image, define-targets]
runs-on: ubuntu-latest
container:
image: ${{ vars.DOCKERHUB_USERNAME }}/${{ needs.build-generation-image.outputs.image_fqname }}:latest
strategy:
fail-fast: false
matrix: ${{ fromJson(needs.define-targets.outputs.target-matrix) }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ github.ref }}
- name: Generate tsl
run: |
python3 main.py --targets ${{ matrix.flags }} -o docker_out/${{ matrix.name }}
- name: Upload tsl
uses: actions/upload-artifact@v4
with:
name: tsl-${{ matrix.arch }}-${{ matrix.name }}
path: ./docker_out/${{ matrix.name }}
compression-level: 9
consolidate-tsl-generate:
needs: [run-generation]
runs-on: ubuntu-latest
if: always()
steps:
- name: Merge tsl flavors
uses: actions/upload-artifact/merge@v4
with:
name: tsl-artifact-tarball
pattern: tsl-*
separate-directories: true
delete-merged: true
compression-level: 9
- name: Break on error
run: |
echo "Generation status: ${{ needs.run-generation.result }}"
if [ "${{ needs.run-generation.result }}" != "success" ]; then
exit 1
fi
run-compile-and-test-x86:
needs: [define-targets, consolidate-tsl-generate, build-compile-image, build-x86-emulation-image]
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix: ${{ fromJson(needs.define-targets.outputs.x86-flags-compiler-matrix) }}
steps:
- name: Download consolidated tsl
uses: actions/download-artifact@v4
with:
name: tsl-artifact-tarball
path: .
- name: Create Build Directories
run: |
mkdir -p build
mkdir -p log
- name: Run CMake
id: cmake
run: |
set +e
docker run \
-v .:/tsl \
${{ vars.DOCKERHUB_USERNAME }}/${{ needs.build-compile-image.outputs.image_fqname }}:latest \
/bin/bash -c \
"cmake \
-S tsl-x86-${{ matrix.name }} \
-B build/tsl-x86-${{ matrix.name }}-${{ matrix.compiler }} \
-DCMAKE_CXX_COMPILER=${{ matrix.compiler }} \
> log/cmake.log 2>&1"
result=$?
echo "CMake result: $result"
if [ ${result} -ne 0 ]; then
echo "::warning::CMake {{ matrix.name }} with ${{ matrix.compiler }} failed"
echo "cmake failed" >> log/failures.txt
exit 1
fi
- name: Run Make
id: make
run: |
set +e
docker run \
-v .:/tsl \
${{ vars.DOCKERHUB_USERNAME }}/${{ needs.build-compile-image.outputs.image_fqname }}:latest \
/bin/bash -c \
"cmake \
--build build/tsl-x86-${{ matrix.name }}-${{ matrix.compiler }} \
-j \
> log/make.log 2>&1"
result=$?
echo "Make result: $result"
if [ ${result} -ne 0 ]; then
echo "::warning::Make {{ matrix.name }} with ${{ matrix.compiler }} failed"
echo "make failed" >> log/failures.txt
exit 1
fi
- name: Run Tests
id: run-tests
run: |
set +e
docker run \
-v .:/tsl \
${{ vars.DOCKERHUB_USERNAME }}/${{ needs.build-x86-emulation-image.outputs.image_fqname }}:latest \
/bin/bash -c \
"intel-sde -future -- \
build/tsl-x86-${{ matrix.name }}-${{ matrix.compiler }}/src/test/tsl_test \
> log/test.log 2>&1"
result=$?
echo "Tests returned: $result"
if [ ${result} -ne 0 ]; then
echo "::warning::Run {{ matrix.name }} with ${{ matrix.compiler }} failed"
echo "tests failed" >> log/failures.txt
exit 1
fi
- name: Upload Build logs
uses: actions/upload-artifact@v4
if: always()
with:
name: compile-and-test-x86-${{ matrix.name }}-${{ matrix.compiler }}
path: ./log
compression-level: 9
run-compile-and-test-aarch64:
needs: [define-targets, consolidate-tsl-generate, build-compile-image, build-aarch64-emulation-image]
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix: ${{ fromJson(needs.define-targets.outputs.aarch64-flags-compiler-matrix) }}
steps:
- name: Download consolidated tsl
uses: actions/download-artifact@v4
with:
name: tsl-artifact-tarball
path: .
- name: Create Build Directories
run: |
mkdir -p build
mkdir -p log
- name: Run CMake
if: ${{ matrix.compiler == 'clang++' }}
id: cmake-clang
run: |
set +e
docker run \
-v .:/tsl \
${{ vars.DOCKERHUB_USERNAME }}/${{ needs.build-compile-image.outputs.image_fqname }}:latest \
/bin/bash -c \
"cmake \
-S tsl-aarch64-${{ matrix.name }} \
-B build/tsl-aarch64-${{ matrix.name }}-${{ matrix.compiler }} \
-DCMAKE_CXX_COMPILER=${{ matrix.compiler }} \
-DEXTERN_COMPILE_OPTIONS=\"--target=aarch64-linux-gnu;-static\" \
-DRUNS_IN_EMULATOR=True \
> log/cmake.log 2>&1"
result=$?
echo "CMake result: $result"
if [ ${result} -ne 0 ]; then
echo "::warning::CMake {{ matrix.name }} with ${{ matrix.compiler }} failed"
echo "cmake failed" >> log/failures.txt
exit 1
fi
- name: Run CMake
if: ${{ matrix.compiler == 'aarch64-linux-gnu-g++' }}
id: cmake-gcc
run: |
set +e
docker run \
-v .:/tsl \
${{ vars.DOCKERHUB_USERNAME }}/${{ needs.build-compile-image.outputs.image_fqname }}:latest \
/bin/bash -c \
"cmake \
-S tsl-aarch64-${{ matrix.name }} \
-B build/tsl-aarch64-${{ matrix.name }}-${{ matrix.compiler }} \
-DCMAKE_CXX_COMPILER=${{ matrix.compiler }} \
-DEXTERN_COMPILE_OPTIONS=\"-static\" \
-DRUNS_IN_EMULATOR=True \
> log/cmake.log 2>&1"
result=$?
echo "CMake result: $result"
if [ ${result} -ne 0 ]; then
echo "::warning::CMake {{ matrix.name }} with ${{ matrix.compiler }} failed"
echo "cmake failed" >> log/failures.txt
exit 1
fi
- name: Run Make
id: make
run: |
set +e
docker run \
-v .:/tsl \
${{ vars.DOCKERHUB_USERNAME }}/${{ needs.build-compile-image.outputs.image_fqname }}:latest \
/bin/bash -c \
"cmake \
--build build/tsl-aarch64-${{ matrix.name }}-${{ matrix.compiler }} \
-j \
> log/make.log 2>&1"
result=$?
echo "Make result: $result"
if [ ${result} -ne 0 ]; then
echo "::warning::Make {{ matrix.name }} with ${{ matrix.compiler }} failed"
echo "make failed" >> log/failures.txt
exit 1
fi
- name: Run Tests
id: run-tests
run: |
set +e
docker run \
-v .:/tsl \
${{ vars.DOCKERHUB_USERNAME }}/${{ needs.build-aarch64-emulation-image.outputs.image_fqname }}:latest \
/bin/bash -c \
"qemu-arm64 \
build/tsl-aarch64-${{ matrix.name }}-${{ matrix.compiler }}/src/test/tsl_test \
> log/test.log 2>&1"
result=$?
echo "Tests returned: $result"
if [ ${result} -ne 0 ]; then
echo "::warning::Run {{ matrix.name }} with ${{ matrix.compiler }} failed"
echo "tests failed" >> log/failures.txt
exit 1
fi
- name: Upload Build logs
uses: actions/upload-artifact@v4
if: always()
with:
name: compile-and-test-aarch64-${{ matrix.name }}-${{ matrix.compiler }}
path: ./log
compression-level: 9
consolidate-build-and-run-logs:
needs: [run-compile-and-test-x86, run-compile-and-test-aarch64]
runs-on: ubuntu-latest
if: always()
steps:
- name: Merge logs
uses: actions/upload-artifact/merge@v4
with:
name: compile-and-test-logs
pattern: compile-and-test-*
separate-directories: true
delete-merged: true
compression-level: 9
- name : Download failure log
uses: actions/download-artifact@v4
with:
name: compile-and-test-logs
path: ${{ runner.temp }}
- name: Break on error
run: |
echo "Build/Test x86 status: ${{ needs.run-compile-and-test-x86.result }}"
echo "Build/Test aarch64 status: ${{ needs.run-compile-and-test-aarch64.result }}"
if [ "${{ needs.run-compile-and-test-x86.result }}" != "success" ] || [ "${{ needs.run-compile-and-test-aarch64.result }}" != "success" ]; then
exit 1
fi