From b79755a1587d82ce55d03ca7434f50771fe83f2f Mon Sep 17 00:00:00 2001 From: Bojan Rosko Date: Wed, 25 Sep 2024 14:51:23 +0200 Subject: [PATCH] addressed comments. Reduced dockerfile, reduced docker build image tags, fixed upload-artifacts argument, reduced common code in generate_cluster_desc, added comments for commented out archs --- .github/docker_install_common.sh | 26 ++++++++++++++++++++++ .github/ubuntu-20.04.Dockerfile | 26 ++-------------------- .github/ubuntu-22.04.Dockerfile | 25 ++------------------- .github/workflows/build-image.yml | 17 ++------------ .github/workflows/build-target.yml | 10 +++++---- .github/workflows/on-pr-opt.yml | 2 ++ .github/workflows/on-pr.yml | 3 +-- tests/test_utils/generate_cluster_desc.hpp | 7 ++---- 8 files changed, 43 insertions(+), 73 deletions(-) create mode 100644 .github/docker_install_common.sh diff --git a/.github/docker_install_common.sh b/.github/docker_install_common.sh new file mode 100644 index 00000000..9a5f42c0 --- /dev/null +++ b/.github/docker_install_common.sh @@ -0,0 +1,26 @@ +#!/bin/bash + +# Install build and runtime deps +apt-get update && apt-get install -y \ + software-properties-common \ + build-essential \ + cmake \ + ninja-build \ + git \ + libhwloc-dev \ + libgtest-dev \ + libyaml-cpp-dev \ + libboost-all-dev \ + wget + +# Install clang 17 +wget https://apt.llvm.org/llvm.sh && \ + chmod u+x llvm.sh && \ + ./llvm.sh 17 && \ + apt install -y libc++-17-dev libc++abi-17-dev && \ + ln -s /usr/bin/clang-17 /usr/bin/clang && \ + ln -s /usr/bin/clang++-17 /usr/bin/clang++ + +# Install clang-format +apt install -y clang-format-17 && \ + ln -s /usr/bin/clang-format-17 /usr/bin/clang-format diff --git a/.github/ubuntu-20.04.Dockerfile b/.github/ubuntu-20.04.Dockerfile index bb17ac96..899ceffe 100644 --- a/.github/ubuntu-20.04.Dockerfile +++ b/.github/ubuntu-20.04.Dockerfile @@ -2,27 +2,5 @@ FROM ubuntu:20.04 ENV DEBIAN_FRONTEND=noninteractive -# Install build and runtime deps -RUN apt-get update && apt-get install -y \ - software-properties-common \ - build-essential \ - cmake \ - ninja-build \ - git \ - libhwloc-dev \ - libgtest-dev \ - libyaml-cpp-dev \ - libboost-all-dev \ - wget - -# Install clang 17 -RUN wget https://apt.llvm.org/llvm.sh && \ - chmod u+x llvm.sh && \ - ./llvm.sh 17 && \ - apt install -y libc++-17-dev libc++abi-17-dev && \ - ln -s /usr/bin/clang-17 /usr/bin/clang && \ - ln -s /usr/bin/clang++-17 /usr/bin/clang++ - -# Install clang-format -RUN apt install -y clang-format-17 && \ - ln -s /usr/bin/clang-format-17 /usr/bin/clang-format +COPY install_common.sh /install_common.sh +RUN chmod +x /install_common.sh && /install_common.sh diff --git a/.github/ubuntu-22.04.Dockerfile b/.github/ubuntu-22.04.Dockerfile index 3b8b443f..c0743c3e 100644 --- a/.github/ubuntu-22.04.Dockerfile +++ b/.github/ubuntu-22.04.Dockerfile @@ -2,27 +2,6 @@ FROM ubuntu:22.04 ENV DEBIAN_FRONTEND=noninteractive -# Install build and runtime deps -RUN apt-get update && apt-get install -y \ - software-properties-common \ - build-essential \ - cmake \ - ninja-build \ - git \ - libhwloc-dev \ - libgtest-dev \ - libyaml-cpp-dev \ - libboost-all-dev \ - wget +COPY install_common.sh /install_common.sh +RUN chmod +x /install_common.sh && /install_common.sh -# Install clang 17 -RUN wget https://apt.llvm.org/llvm.sh && \ - chmod u+x llvm.sh && \ - ./llvm.sh 17 && \ - apt install -y libc++-17-dev libc++abi-17-dev && \ - ln -s /usr/bin/clang-17 /usr/bin/clang && \ - ln -s /usr/bin/clang++-17 /usr/bin/clang++ - -# Install clang-format -RUN apt install -y clang-format-17 && \ - ln -s /usr/bin/clang-format-17 /usr/bin/clang-format diff --git a/.github/workflows/build-image.yml b/.github/workflows/build-image.yml index 2a110982..a3f64ba5 100644 --- a/.github/workflows/build-image.yml +++ b/.github/workflows/build-image.yml @@ -4,6 +4,7 @@ name: Build and Publish Docker Image on: workflow_dispatch: workflow_call: + push: jobs: build: @@ -39,8 +40,6 @@ jobs: username: ${{ github.repository_owner }} password: ${{ secrets.GITHUB_TOKEN }} - # Build image - - name: Build and export base Docker image uses: docker/build-push-action@v6 with: @@ -51,16 +50,4 @@ jobs: GIT_SHA=${{ github.sha }} tags: | ${{ env.CI_IMAGE_NAME}}:${{ github.sha }} - - # Tag image as latest - - - name: Build and push base Docker image - uses: docker/build-push-action@v6 - with: - context: .github - file: .github/${{ matrix.build.name }}.Dockerfile - push: true - build-args: | - GIT_SHA=${{ github.sha }} - tags: | - ${{ env.CI_IMAGE_NAME}}:latest \ No newline at end of file + ${{ env.CI_IMAGE_NAME}}:latest diff --git a/.github/workflows/build-target.yml b/.github/workflows/build-target.yml index 5aab7cb8..2a85ee41 100644 --- a/.github/workflows/build-target.yml +++ b/.github/workflows/build-target.yml @@ -15,8 +15,9 @@ on: required: true type: string upload-artifacts: - required: true + required: false type: boolean + default: false workflow_dispatch: inputs: arch: @@ -39,9 +40,10 @@ on: - umd_device - umd_tests upload-artifacts: - required: true + required: false description: 'Whether to upload artifacts' type: boolean + default: false env: @@ -86,12 +88,12 @@ jobs: # This is needed to preserve file permissions # https://github.com/actions/upload-artifact?tab=readme-ov-file#permission-loss - name: Tar build, test and run artifacts - if: inputs.upload-artifacts == 'true' + if: ${{ inputs.upload-artifacts }} shell: bash run: tar cvf artifact.tar ${{ env.TEST_OUTPUT_DIR }} ${{ env.LIB_OUTPUT_DIR }} ${{ env.DEPS_OUTPUT_DIR }} ${{ env.CREATE_MAP_BINARIES_DIR }} - name: Upload build artifacts archive - if: inputs.upload-artifacts == 'true' + if: ${{ inputs.upload-artifacts }} uses: actions/upload-artifact@v4 with: name: build-artifacts-${{ inputs.arch }}-${{ matrix.build.runs-on }} diff --git a/.github/workflows/on-pr-opt.yml b/.github/workflows/on-pr-opt.yml index 996b15aa..97033310 100644 --- a/.github/workflows/on-pr-opt.yml +++ b/.github/workflows/on-pr-opt.yml @@ -13,6 +13,7 @@ jobs: fail-fast: false matrix: test-group: [ + # Enable once we have functional cards with specified architecture. # { arch: grayskull }, { arch: wormhole_b0 }, # { arch: blackhole }, @@ -31,6 +32,7 @@ jobs: fail-fast: false matrix: test-group: [ + # Enable once we have functional cards. # { arch: grayskull, card: e75 }, # { arch: grayskull, card: e150 }, # { arch: grayskull, card: e300 }, diff --git a/.github/workflows/on-pr.yml b/.github/workflows/on-pr.yml index 1eebb6f3..0a4808e9 100644 --- a/.github/workflows/on-pr.yml +++ b/.github/workflows/on-pr.yml @@ -21,5 +21,4 @@ jobs: with: arch: ${{ matrix.test-group.arch }} timeout: 10 - build-target: umd_device - upload-artifacts: false \ No newline at end of file + build-target: umd_device \ No newline at end of file diff --git a/tests/test_utils/generate_cluster_desc.hpp b/tests/test_utils/generate_cluster_desc.hpp index ff8cb927..d00ef6d7 100644 --- a/tests/test_utils/generate_cluster_desc.hpp +++ b/tests/test_utils/generate_cluster_desc.hpp @@ -16,16 +16,13 @@ inline std::string GetAbsPath(std::string path_){ // Note that __FILE__ might be resolved at compile time to an absolute or relative address, depending on the compiler. std::filesystem::path current_file_path = std::filesystem::path(__FILE__); if (current_file_path.is_absolute()) { - std::filesystem::path umd_root_relative = std::filesystem::relative(std::filesystem::path(__FILE__).parent_path().parent_path().parent_path(), "../"); std::filesystem::path umd_root = current_file_path.parent_path().parent_path().parent_path(); - std::filesystem::path abs_path = umd_root / path_; - return abs_path.string(); } else { std::filesystem::path umd_root_relative = std::filesystem::relative(std::filesystem::path(__FILE__).parent_path().parent_path().parent_path(), "../"); std::filesystem::path umd_root = std::filesystem::canonical(umd_root_relative); - std::filesystem::path abs_path = umd_root / path_; - return abs_path.string(); } + std::filesystem::path abs_path = umd_root / path_; + return abs_path.string(); } inline std::string GetClusterDescYAML(){