From 611a2d0a3978a6386a70ba25aabeb11f65cf236e Mon Sep 17 00:00:00 2001 From: Ben Nibbelink Date: Thu, 4 Apr 2024 18:19:07 -0500 Subject: [PATCH 1/3] fix debian package generation process and add to CI --- .github/workflows/publish_release.yml | 24 +++++++++++++++++++++++- CMakeLists.txt | 9 +-------- docker/Dockerfile | 7 +++++++ 3 files changed, 31 insertions(+), 9 deletions(-) diff --git a/.github/workflows/publish_release.yml b/.github/workflows/publish_release.yml index aedb83bc7..8c34eb07b 100644 --- a/.github/workflows/publish_release.yml +++ b/.github/workflows/publish_release.yml @@ -11,7 +11,7 @@ jobs: build-and-test-for-release: runs-on: ubuntu-latest permissions: - contents: read + contents: write packages: write strategy: @@ -57,6 +57,7 @@ jobs: with: cache-from: type=registry,ref=ghcr.io/cyclus/cycamore_${{ matrix.ubuntu_versions }}_${{ matrix.pkg_mgr }}/cycamore:ci-layer-cache file: docker/Dockerfile + target: cycamore push: true tags: | ghcr.io/cyclus/cycamore_${{ matrix.ubuntu_versions }}_${{ matrix.pkg_mgr }}/cycamore:${{ env.version_tag }} @@ -65,3 +66,24 @@ jobs: pkg_mgr=${{ matrix.pkg_mgr }} ubuntu_version=${{ matrix.ubuntu_versions }} cyclus_tag=stable + + - name: Make Debian Package + if: matrix.pkg_mgr == 'apt' && matrix.ubuntu_versions == '22.04' + uses: docker/build-push-action@v5 + with: + cache-from: type=registry,ref=ghcr.io/cyclus/cycamore_${{ matrix.ubuntu_versions }}_${{ matrix.pkg_mgr }}/cycamore:ci-layer-cache + file: docker/Dockerfile + target: deb-package + outputs: type=local,dest=. + build-args: | + pkg_mgr=${{ matrix.pkg_mgr }} + ubuntu_version=${{ matrix.ubuntu_versions }} + cyclus_tag=stable + + - name: Upload .deb to release + if: github.event_name == 'release' && matrix.pkg_mgr == 'apt' && matrix.ubuntu_versions == '22.04' + uses: alexellis/upload-assets@0.4.0 + env: + GITHUB_TOKEN: ${{ github.token }} + with: + asset_paths: '["cycamore*.deb"]' \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt index b67d493ae..5a9e2eb78 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -349,7 +349,7 @@ IF(NOT CYCLUS_DOC_ONLY) SET(CPACK_PACKAGE_VERSION_PATCH "${CMAKE_PROJECT_VERSION_PATCH}") # Dependencies - SET(CPACK_DEBIAN_PACKAGE_DEPENDS "cyclus (>= 1.4.0)") + SET(CPACK_DEBIAN_PACKAGE_DEPENDS "cyclus (>= 1.5.5)") MESSAGE("CPACK_DEBIAN_PACKAGE_DEPENDS ${CPACK_DEBIAN_PACKAGE_DEPENDS}") # Names @@ -358,13 +358,6 @@ IF(NOT CYCLUS_DOC_ONLY) SET(CPACK_PACKAGE_INSTALL_DIRECTORY "${CPACK_PACKAGE_INSTALL_DIRECTORY}.${CPACK_PACKAGE_VERSION_MINOR}") SET(CPACK_PACKAGE_INSTALL_DIRECTORY "${CPACK_PACKAGE_INSTALL_DIRECTORY}.${CPACK_PACKAGE_VERSION_PATCH}") - SET(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}") - SET(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_FILE_NAME}_${CPACK_PACKAGE_VERSION_MAJOR}") - SET(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_FILE_NAME}.${CPACK_PACKAGE_VERSION_MINOR}") - SET(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_FILE_NAME}.${CPACK_PACKAGE_VERSION_PATCH}") - SET(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_FILE_NAME}_${CPACK_HASH_NAME}") - SET(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_FILE_NAME}_${CPACK_SYSTEM_NAME}") - # Configuration SET(CPACK_INCLUDE_TOPLEVEL_DIRECTORY "1") SET(CPACK_DEBIAN_PACKAGE_SHLIBDEPS OFF) diff --git a/docker/Dockerfile b/docker/Dockerfile index 68f3badf2..a8f331177 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -10,6 +10,13 @@ WORKDIR /cycamore RUN python install.py -j ${make_cores} --build-type=Release +FROM cycamore as deb-generation +WORKDIR /cyclus/build +RUN make package + +FROM scratch as deb-package +COPY --from=deb-generation /cycamore/build/cycamore*.deb / + FROM cycamore as cycamore-test RUN cycamore_unit_tests From 53137d8b134ac04fdf9a771f169b3ac3846b2c1d Mon Sep 17 00:00:00 2001 From: Ben Nibbelink Date: Thu, 4 Apr 2024 18:23:34 -0500 Subject: [PATCH 2/3] update changelog --- CHANGELOG.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 430ce5434..551ccd088 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -6,7 +6,7 @@ cycamore Change Log **Added:** * Downstream testing in CI workflows (#573, #580, #582, #583) -* GitHub workflow for publishing images on release (#573, #582, #583) +* GitHub workflow for publishing images and debian packages on release (#573, #582, #583, #593) * GitHub workflows for building/testing on a PR and push to `main` (#549, #564, #573, #582, #583, #590) * Add functionality for random behavior on the size (#550) and frequency (#565) of a sink * GitHub workflow to check that the CHANGELOG has been updated (#562) From 73c2dc83787cef24cc7321880a3b2ee2f8a1b4e9 Mon Sep 17 00:00:00 2001 From: bennibbelink <79653949+bennibbelink@users.noreply.github.com> Date: Thu, 4 Apr 2024 20:40:21 -0500 Subject: [PATCH 3/3] fix typo in WORKDIR --- docker/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index a8f331177..970b2c5aa 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -11,7 +11,7 @@ WORKDIR /cycamore RUN python install.py -j ${make_cores} --build-type=Release FROM cycamore as deb-generation -WORKDIR /cyclus/build +WORKDIR /cycamore/build RUN make package FROM scratch as deb-package