Skip to content

Commit

Permalink
addressed comments. Reduced dockerfile, reduced docker build image ta…
Browse files Browse the repository at this point in the history
…gs, fixed upload-artifacts argument, reduced common code in generate_cluster_desc, added comments for commented out archs
  • Loading branch information
broskoTT committed Sep 25, 2024
1 parent c325c72 commit b79755a
Show file tree
Hide file tree
Showing 8 changed files with 43 additions and 73 deletions.
26 changes: 26 additions & 0 deletions .github/docker_install_common.sh
Original file line number Diff line number Diff line change
@@ -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
26 changes: 2 additions & 24 deletions .github/ubuntu-20.04.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
25 changes: 2 additions & 23 deletions .github/ubuntu-22.04.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
17 changes: 2 additions & 15 deletions .github/workflows/build-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ name: Build and Publish Docker Image
on:
workflow_dispatch:
workflow_call:
push:

jobs:
build:
Expand Down Expand Up @@ -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:
Expand All @@ -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
${{ env.CI_IMAGE_NAME}}:latest
10 changes: 6 additions & 4 deletions .github/workflows/build-target.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@ on:
required: true
type: string
upload-artifacts:
required: true
required: false
type: boolean
default: false
workflow_dispatch:
inputs:
arch:
Expand All @@ -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:
Expand Down Expand Up @@ -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 }}
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/on-pr-opt.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 },
Expand All @@ -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 },
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/on-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,4 @@ jobs:
with:
arch: ${{ matrix.test-group.arch }}
timeout: 10
build-target: umd_device
upload-artifacts: false
build-target: umd_device
7 changes: 2 additions & 5 deletions tests/test_utils/generate_cluster_desc.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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(){
Expand Down

0 comments on commit b79755a

Please sign in to comment.