From d5955f06d79c704dbd10ecc29f8a1a1a0571da92 Mon Sep 17 00:00:00 2001 From: Marcus Holland-Moritz Date: Wed, 10 Jan 2024 13:48:33 +0100 Subject: [PATCH] chore: try artifact upload in workflow --- .docker/build-linux.sh | 6 +++++ .github/workflows/build.yml | 45 +++++++++++++++++++++++++++++++++++++ CMakeLists.txt | 5 +++++ 3 files changed, 56 insertions(+) diff --git a/.docker/build-linux.sh b/.docker/build-linux.sh index da6635c7..5b657527 100644 --- a/.docker/build-linux.sh +++ b/.docker/build-linux.sh @@ -157,5 +157,11 @@ if [[ "-$BUILD_TYPE-" == *-static-* ]]; then $BUILD_TOOL copy_artifacts + rm -rf /tmp-runner/artifacts + mkdir -p /tmp-runner/artifacts + cp artifacts.env /tmp-runner + cp dwarfs-universal-* /tmp-runner/artifacts + cp dwarfs-*-Linux*.tar.zst /tmp-runner/artifacts + $BUILD_TOOL realclean fi diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 075b0a9d..61412670 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -69,6 +69,29 @@ jobs: cmake --build ${{ runner.temp }}\build --target copy_artifacts if: matrix.build_mode == 'Release' + - name: Prepare Artifact Upload + shell: cmd + run: cat ${{ runner.temp }}\build\artifacts.env >> %GITHUB_ENV% + if: matrix.build_mode == 'Release' + + - name: Upload Binary Tarball + uses: actions/upload-artifact@v4 + with: + name: ${{ env.binary_tarball }} + path: ${{ runner.temp }}\build\${{ env.binary_tarball }} + if-no-files-found: error + compression-level: 0 + if: matrix.build_mode == 'Release' + + - name: Upload Universal Binary + uses: actions/upload-artifact@v4 + with: + name: ${{ env.universal_binary }} + path: ${{ runner.temp }}\build\${{ env.universal_binary }} + if-no-files-found: error + compression-level: 0 + if: matrix.build_mode == 'Release' + linux: strategy: matrix: @@ -148,3 +171,25 @@ jobs: token: ${{ secrets.CODECOV_TOKEN }} files: ${{ steps.coverage-files.outputs.list }} fail_ci_if_error: true + + - name: Prepare Artifact Upload + run: cat ${{ runner.temp }}/artifacts.env >> $GITHUB_ENV + if: ${{ endsWith(matrix.build_type, '-static') }} + + - name: Upload Binary Tarball + uses: actions/upload-artifact@v4 + with: + name: ${{ env.binary_tarball }} + path: ${{ runner.temp }}/artifacts/${{ env.binary_tarball }} + if-no-files-found: error + compression-level: 0 + if: ${{ endsWith(matrix.build_type, '-static') }} + + - name: Upload Universal Binary + uses: actions/upload-artifact@v4 + with: + name: ${{ env.universal_binary }} + path: ${{ runner.temp }}/artifacts/${{ env.universal_binary }} + if-no-files-found: error + compression-level: 0 + if: ${{ endsWith(matrix.build_type, '-static') }} diff --git a/CMakeLists.txt b/CMakeLists.txt index 7225b98d..cc08bdc2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1000,6 +1000,7 @@ add_custom_target( vcpkg-manifest-install.log build.ninja .ninja_deps Makefile compile_commands.json + artifacts.env COMMAND ${CMAKE_COMMAND} -E rm -rf ${REALCLEAN_FILES} ) @@ -1093,6 +1094,10 @@ if(STATIC_BUILD_DO_NOT_USE OR WIN32) set(PACKAGE_EXT ".tar.zst") endif() + file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/artifacts.env" + "binary_tarball=${CMAKE_PROJECT_NAME}-${DWARFS_ARTIFACT_ID}${PACKAGE_EXT}\n" + "universal_binary=${UNIVERSAL_PACKED}\n") + add_custom_target(copy_artifacts COMMAND ${CMAKE_COMMAND} -E make_directory ${ARTIFACTS_FULL_PATH} COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_PROJECT_NAME}-${DWARFS_ARTIFACT_ID}${PACKAGE_EXT} ${ARTIFACTS_FULL_PATH}