Skip to content

Commit

Permalink
upload
Browse files Browse the repository at this point in the history
  • Loading branch information
andreasfertig committed Apr 5, 2024
1 parent 58e91ea commit 3665892
Showing 1 changed file with 48 additions and 207 deletions.
255 changes: 48 additions & 207 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -459,203 +459,20 @@ jobs:
#------------------------------------------------------------------------------
# BUILD INSIDE DOCKER
#------------------------------------------------------------------------------
docker_amd64:
docker:
runs-on: ubuntu-22.04
name: ${{ matrix.config.name }}
container:
image: andreasfertig/cppinsights-builder
name: ${{ matrix.config.name }} @${{ matrix.arch }}
strategy:
fail-fast: false
matrix:
config:
# GCC 13 / LLVM 18
- {
name: "GCC 13 / LLVM 18 @ Ubuntu Release @docker",
build_type: Release,
cxx: "g++-13",
llvm_version: "18.1.0",
llvm_config: "/usr/bin/llvm-config-18",
coverage: "No",
static: "Yes",
debug: "No",
tidy: "No",
run_tests: "No",
libcxx: "No",
bin_name: "insights",
archive_name: "insights-ubuntu-amd64",
upload: "Yes",
docs: "Yes",
}

# GCC 13 / LLVM 18
- {
name: "GCC 13 / LLVM 18 @ Ubuntu Code Coverage & Debug @docker",
build_type: Release,
cxx: "g++-13",
llvm_version: "18.1.0",
llvm_config: "/usr/bin/llvm-config-18",
coverage: "Yes",
static: "No",
debug: "Yes",
tidy: "No",
run_tests: "No",
libcxx: "No",
bin_name: "insights",
archive_name: "insights-ubuntu-amd64",
}

# GCC 13 / LLVM 18
- {
name: "GCC 13 / LLVM 18 @ Ubuntu Code Coverage (libc++) @docker",
build_type: Release,
cxx: "g++-13",
llvm_version: "18.1.0",
llvm_config: "/usr/bin/llvm-config-18",
coverage: "Yes",
static: "No",
debug: "Yes",
tidy: "No",
run_tests: "No",
libcxx: "Yes",
bin_name: "insights",
archive_name: "insights-ubuntu-amd64",
}

steps:
- uses: actions/checkout@v4
with:
path: cppinsights

- name: Configure
id: cmake_configure
run: |
export CXX=${{ matrix.config.cxx }}
mkdir build
cd build
cmake -G Ninja -DINSIGHTS_STATIC=${{ matrix.config.static }} -DDEBUG=${{ matrix.config.debug }} -DINSIGHTS_COVERAGE=${{ matrix.config.coverage }} -DINSIGHTS_USE_LIBCPP=${{ matrix.config.libcxx }} ../cppinsights
- name: Build
shell: cmake -P {0}
continue-on-error: false
run: |
set(ENV{NINJA_STATUS} "[%f/%t %o/sec] ")
execute_process(
COMMAND cmake --build build
RESULT_VARIABLE result
)
if (NOT result EQUAL 0)
message(FATAL_ERROR "Bad exit status")
endif()
- name: Run tests
if: matrix.config.run_tests == 'Yes'
id: run_tests
shell: cmake -P {0}
continue-on-error: false
run: |
set(ENV{NINJA_STATUS} "[%f/%t %o/sec] ")
execute_process(
COMMAND cmake --build build --target tests
RESULT_VARIABLE result
)
if (NOT result EQUAL 0)
message(FATAL_ERROR "Bad exit status during tests")
endif()
- name: Make docs
if: matrix.config.docs == 'Yes'
shell: cmake -P {0}
continue-on-error: false
run: |
set(ENV{NINJA_STATUS} "[%f/%t %o/sec] ")
execute_process(
COMMAND cmake --build build --target doc
RESULT_VARIABLE result
)
if (NOT result EQUAL 0)
message(FATAL_ERROR "Bad exit status during doc")
endif()
file(MAKE_DIRECTORY "$ENV{GITHUB_WORKSPACE}/build/archive/")
file(COPY "$ENV{GITHUB_WORKSPACE}/build/html" DESTINATION "$ENV{GITHUB_WORKSPACE}/build/archive/")
- name: Run coverage
if: matrix.config.coverage == 'Yes'
id: run_coverage
shell: cmake -P {0}
continue-on-error: false
run: |
set(ENV{NINJA_STATUS} "[%f/%t %o/sec] ")
execute_process(
COMMAND cmake --build build --target coverage
RESULT_VARIABLE result
)
if (NOT result EQUAL 0)
message(FATAL_ERROR "Bad exit status during coverage")
endif()
- name: Run coverage upload
if: matrix.config.coverage == 'Yes'
id: run_coverage_upload
continue-on-error: false
env:
LIBCXX: ${{ matrix.config.libcxx }}
shell: bash
run: |
if [ ! -f ${GITHUB_WORKSPACE}/build/filtered.info ]; then
echo -e "\033[1;31mlcov did not create filtered.info!\033[0m"
exit 1;
fi
if [ ! -s ${GITHUB_WORKSPACE}/build/filtered.info ]; then
echo -e "\033[1;31mlcov did create an empty filtered.info!\033[0m"
exit 1;
fi
flag="ubuntu"
if [ "Yes" == "${LIBCXX}" ]; then
flag="ubuntu-libcxx"
fi
# Uploading report to CodeCov
bash <(curl -s https://codecov.io/bash) -f ${GITHUB_WORKSPACE}/build/filtered.info -F ${flag} || echo "Codecov did not collect coverage reports"
arch:
- arm64
- amd64

- name: Create archive
if: matrix.config.upload == 'Yes'
working-directory: ${{ github.workspace }}/build
shell: cmake -P {0}
continue-on-error: false
run: |
file(MAKE_DIRECTORY "$ENV{GITHUB_WORKSPACE}/build/archive")
execute_process(COMMAND ${CMAKE_COMMAND} -E tar cvz "$ENV{GITHUB_WORKSPACE}/build/archive/${{ matrix.config.archive_name }}.tar.gz" -- "${{ matrix.config.bin_name }}")
file(SHA256 "$ENV{GITHUB_WORKSPACE}/build/${{ matrix.config.bin_name }}" CHKSM)
file(WRITE "$ENV{GITHUB_WORKSPACE}/build/archive/${{ matrix.config.archive_name }}.sha256" ${CHKSM})
- uses: actions/upload-artifact@v3
if: matrix.config.upload == 'Yes'
with:
name: insights-artifact-ubuntu
if-no-files-found: error
path: |
${{ github.workspace }}/build/archive/*
#------------------------------------------------------------------------------
# BUILD INSIDE DOCKER for ARM
#------------------------------------------------------------------------------
docker_arm64:
runs-on: ubuntu-22.04
name: ${{ matrix.config.name }}
strategy:
fail-fast: false
matrix:
config:
# GCC 13 / LLVM 18
- {
name: "GCC 13 / LLVM 18 @ Ubuntu ARM Release @docker",
name: "GCC 13 / LLVM 18 @ Ubuntu Release",
build_type: Release,
cxx: "g++-13",
llvm_version: "18.1.0",
Expand All @@ -667,14 +484,14 @@ jobs:
run_tests: "No",
libcxx: "No",
bin_name: "insights",
archive_name: "insights-ubuntu-arm64",
archive_name: "insights-ubuntu",
upload: "Yes",
docs: "No",
docs: "Yes",
}

# GCC 13 / LLVM 18
- {
name: "GCC 13 / LLVM 18 @ Ubuntu ARM Code Coverage & Debug @docker",
name: "GCC 13 / LLVM 18 @ Ubuntu Code Coverage & Debug",
build_type: Release,
cxx: "g++-13",
llvm_version: "18.1.0",
Expand All @@ -686,12 +503,12 @@ jobs:
run_tests: "No",
libcxx: "No",
bin_name: "insights",
archive_name: "insights-ubuntu-arm64",
archive_name: "insights-ubuntu",
}

# GCC 13 / LLVM 18
- {
name: "GCC 13 / LLVM 18 @ Ubuntu ARM Code Coverage (libc++) @docker",
name: "GCC 13 / LLVM 18 @ Ubuntu Code Coverage (libc++)",
build_type: Release,
cxx: "g++-13",
llvm_version: "18.1.0",
Expand All @@ -703,7 +520,7 @@ jobs:
run_tests: "No",
libcxx: "Yes",
bin_name: "insights",
archive_name: "insights-ubuntu-arm64",
archive_name: "insights-ubuntu",
}

steps:
Expand All @@ -721,10 +538,14 @@ jobs:
docker run \
--rm \
-v $(pwd):/${{ github.workspace }} \
-w ${{ github.workspace }} \
-v "/var/run/docker.sock":"/var/run/docker.sock" \
-v "/home/runner/work/_temp/_github_home":"/github/home" \
-v "/home/runner/work/_temp/_github_workflow":"/github/workflow" \
-v "/home/runner/work/_temp/_runner_file_commands":"/github/file_commands" \
-v "/home/runner/work/cppinsights/cppinsights":"/github/workspace" \
--workdir /github/workspace \
--user $(id -u):$(id -g) \
--platform linux/arm64 \
--platform linux/${{ matrix.arch }} \
andreasfertig/cppinsights-builder \
/bin/bash -e ./__cmd.sh
EOF
Expand All @@ -733,6 +554,7 @@ jobs:
sudo chmod 0755 /usr/bin/docker-shell
- name: Set up QEMU
if: matrix.arch == 'arm64'
uses: docker/setup-qemu-action@v3
with:
platforms: arm64
Expand All @@ -742,8 +564,8 @@ jobs:
shell: docker-shell {0}
run: |
mkdir build
cd build
CXX=${{ matrix.config.cxx }} cmake -G Ninja -DINSIGHTS_STATIC=${{ matrix.config.static }} -DDEBUG=${{ matrix.config.debug }} -DINSIGHTS_COVERAGE=${{ matrix.config.coverage }} -DINSIGHTS_USE_LIBCPP=${{ matrix.config.libcxx }} ../cppinsights
- name: Build
Expand All @@ -760,6 +582,25 @@ jobs:
run: |
cmake --build build --target tests
# docker-shell fails building doc with an unknown reason. Use the original container
- name: Make docs 1/2
if: "((matrix.arch == 'amd64') && (matrix.config.docs == 'Yes'))"
uses: docker://andreasfertig/cppinsights-builder:latest
with:
args: |
/bin/bash -c "cmake --build build --target doc"
- name: Make docs 2/2
if: "((matrix.arch == 'amd64') && (matrix.config.docs == 'Yes'))"
working-directory: ${{ github.workspace }}/build
shell: bash
run: |
sudo chown -R $(id -u):$(id -g) ${GITHUB_WORKSPACE}/build/
ls -l ${GITHUB_WORKSPACE}/build/
ls -l ${GITHUB_WORKSPACE}/build/html
mkdir -p ${GITHUB_WORKSPACE}/build/archive
mv ${GITHUB_WORKSPACE}/build/html ${GITHUB_WORKSPACE}/build/archive/
- name: Run coverage
if: matrix.config.coverage == 'Yes'
id: run_coverage
Expand All @@ -785,9 +626,9 @@ jobs:
exit 1;
fi
flag="ubuntu-arm64"
flag="ubuntu-${{ matrix.arch }}"
if [ "Yes" == "${LIBCXX}" ]; then
flag="ubuntu-arm64-libcxx"
flag="ubuntu-${{ matrix.arch }}-libcxx"
fi
# Uploading report to CodeCov
Expand All @@ -796,13 +637,13 @@ jobs:
- name: Create archive
if: matrix.config.upload == 'Yes'
working-directory: ${{ github.workspace }}/build
shell: cmake -P {0}
shell: bash
continue-on-error: false
run: |
file(MAKE_DIRECTORY "$ENV{GITHUB_WORKSPACE}/build/archive")
execute_process(COMMAND ${CMAKE_COMMAND} -E tar cvz "$ENV{GITHUB_WORKSPACE}/build/archive/${{ matrix.config.archive_name }}.tar.gz" -- "${{ matrix.config.bin_name }}")
file(SHA256 "$ENV{GITHUB_WORKSPACE}/build/${{ matrix.config.bin_name }}" CHKSM)
file(WRITE "$ENV{GITHUB_WORKSPACE}/build/archive/${{ matrix.config.archive_name }}.sha256" ${CHKSM})
mkdir -p ${GITHUB_WORKSPACE}/build/archive
tar -cvzf ${GITHUB_WORKSPACE}/build/archive/${{ matrix.config.archive_name }}-${{ matrix.arch }}.tar.gz ${{ matrix.config.bin_name }}
sha256sum ${GITHUB_WORKSPACE}/build/${{ matrix.config.bin_name }} > ${GITHUB_WORKSPACE}/build/archive/${{ matrix.config.archive_name }}-${{ matrix.arch }}.sha256
- uses: actions/upload-artifact@v3
if: matrix.config.upload == 'Yes'
Expand All @@ -815,7 +656,7 @@ jobs:
# DEPLOY
#------------------------------------------------------------------------------
deploy:
needs: [build, docker_amd64, docker_arm64]
needs: [build, docker]
if: github.ref == 'refs/heads/main'
name: Final Deploy
runs-on: ubuntu-22.04
Expand Down

0 comments on commit 3665892

Please sign in to comment.