From 6ef150dbdd6b39a31632f4119fb82603583d4e46 Mon Sep 17 00:00:00 2001 From: Sophie Depassio Date: Fri, 20 Dec 2024 16:37:55 +0100 Subject: [PATCH] test building all debs with fpm --- .github/workflows/perl-cpan-libraries.yml | 2 +- .github/workflows/test-cpan-libraries.yml | 479 ++++++++++++++++++---- 2 files changed, 395 insertions(+), 86 deletions(-) diff --git a/.github/workflows/perl-cpan-libraries.yml b/.github/workflows/perl-cpan-libraries.yml index 5e344fc62..7b3e82beb 100644 --- a/.github/workflows/perl-cpan-libraries.yml +++ b/.github/workflows/perl-cpan-libraries.yml @@ -678,7 +678,7 @@ jobs: error_output=$(dpkg -i $package 2>&1) || { echo "$error_output" >> $error_log; echo "Error during installation of the package $package" >> $error_log; true; } echo "Package installation done." echo "Package uninstallation..." - error_output=$(dpkg --purge $(echo $package | sed 's/_[0-9].*\.deb//' | sed 's/.\///') 2>&1) || { echo "$error_output" >> $error_log; echo "Error during autoremove of the package $package" >> $error_log; true; } + error_output=$(apt autoremove --purge $(echo $package | sed 's/_[0-9].*\.deb//' | sed 's/.\///') 2>&1) || { echo "$error_output" >> $error_log; echo "Error during autoremove of the package $package" >> $error_log; true; } echo "Package uninstallation done." done # If the file error_log exists and is not empty, the workflow is in error diff --git a/.github/workflows/test-cpan-libraries.yml b/.github/workflows/test-cpan-libraries.yml index 8f921b098..b633bada2 100644 --- a/.github/workflows/test-cpan-libraries.yml +++ b/.github/workflows/test-cpan-libraries.yml @@ -6,9 +6,9 @@ concurrency: on: workflow_dispatch: -# pull_request: -# paths: -# - ".github/workflows/test-cpan-libraries.yml" + pull_request: + paths: + - ".github/workflows/test-cpan-libraries.yml" jobs: get-environment: @@ -16,13 +16,15 @@ jobs: package-rpm: needs: [get-environment] - if: ${{ needs.get-environment.outputs.stability != 'stable' }} + if: | + needs.get-environment.outputs.skip_workflow == 'false' && + needs.get-environment.outputs.stability != 'stable' runs-on: ubuntu-24.04 strategy: fail-fast: false matrix: - distrib: [el8] + distrib: [el8, el9] name: [ "ARGV::Struct", @@ -55,32 +57,39 @@ jobs: "Net::FTPSSL", "Net::HTTPTunnel", "Net::NTP", + "Net::SMTPS", "Net::SMTP_auth", "Net::Subnet", "Net::TFTP", + "Paws", "PBKDF2::Tiny", + "Statistics::Descriptive", "Statistics::Regression", "Term::Clui", "Unicode::Stringprep", "URI::Template", "URL::Encode", + "URL::Encode::XS", "UUID", "UUID::URandom", "WWW::Selenium", "XML::LibXML::Simple", + "ZMQ::Constants", "ZMQ::FFI", "ZMQ::LibZMQ4" ] include: - - build_distribs: "el8" + - build_distribs: "el8,el9" - rpm_dependencies: "" - rpm_provides: "" - version: "" - - spec_file: "" - no-auto-depends: false - distrib: el8 package_extension: rpm image: packaging-plugins-alma8 + - distrib: el9 + package_extension: rpm + image: packaging-plugins-alma9 - name: "BSON" rpm_provides: "perl(BSON::Bytes) perl(BSON::Code) perl(BSON::DBRef) perl(BSON::OID) perl(BSON::Raw) perl(BSON::Regex) perl(BSON::Time) perl(BSON::Timestamp) perl(BSON::Types) perl(BSON)" - name: "DateTime::Format::Duration::ISO8601" @@ -101,10 +110,18 @@ jobs: no-auto-depends: true - name: "Net::DHCP" rpm_provides: "perl(Net::DHCP::Constants) perl(Net::DHCP::Packet)" + - name: "Net::SMTPS" + build_distribs: el9 + - name: "Statistics::Descriptive" + build_distribs: el9 - name: "Statistics::Regression" version: "0.53" + - name: "URL::Encode::XS" + build_distribs: el9 - name: "UUID" version: "0.31" + - name: "ZMQ::Constants" + build_distribs: "el9" - name: "ZMQ::FFI" rpm_dependencies: "zeromq" - name: "ZMQ::LibZMQ4" @@ -151,7 +168,7 @@ jobs: make install shell: bash - - if: ${{ contains(matrix.build_distribs, matrix.distrib) && matrix.spec_file == '' }} + - if: ${{ contains(matrix.build_distribs, matrix.distrib) }} run: | if [ -z "${{ matrix.version }}" ]; then PACKAGE_VERSION="" @@ -187,15 +204,6 @@ jobs: fpm -s cpan -t ${{ matrix.package_extension }} --rpm-dist ${{ matrix.distrib }} --verbose --cpan-verbose --no-cpan-test$PACKAGE_DEPENDENCIES$PACKAGE_PROVIDES$PACKAGE_VERSION ${{ matrix.name }} shell: bash - - if: ${{ contains(matrix.build_distribs, matrix.distrib) && matrix.spec_file != '' }} - run: | - mkdir -p ~/rpmbuild/{BUILD,BUILDROOT,RPMS,SOURCES,SPECS,SRPMS} - - rpmbuild --undefine=_disable_source_fetch -ba ${{ matrix.spec_file }} - - cp -r ~/rpmbuild/RPMS/noarch/*.rpm . - shell: bash - - if: ${{ contains(matrix.build_distribs, matrix.distrib) }} name: Replace '::' with - in the feature path id: package-name @@ -214,11 +222,14 @@ jobs: retention-days: 1 merge-package-rpm-artifacts: - needs: [package-rpm] + needs: [get-environment, package-rpm] + if: | + needs.get-environment.outputs.skip_workflow == 'false' && + needs.get-environment.outputs.stability != 'stable' runs-on: ubuntu-24.04 strategy: matrix: - distrib: [el8] + distrib: [el8, el9] steps: - name: Merge Artifacts @@ -236,12 +247,15 @@ jobs: failOnError: false sign-rpm: - needs: [merge-package-rpm-artifacts] + needs: [get-environment, merge-package-rpm-artifacts] + if: | + needs.get-environment.outputs.skip_workflow == 'false' && + needs.get-environment.outputs.stability != 'stable' runs-on: ubuntu-24.04 strategy: matrix: - distrib: [el8] + distrib: [el8, el9] name: sign rpm ${{ matrix.distrib }} container: image: docker.centreon.com/centreon-private/rpm-signing:latest @@ -272,8 +286,233 @@ jobs: path: ./*.rpm key: ${{ github.sha }}-${{ github.run_id }}-rpm-${{ matrix.distrib }} + package-deb: + needs: [get-environment] + if: | + needs.get-environment.outputs.skip_workflow == 'false' && + needs.get-environment.outputs.stability != 'stable' + + runs-on: ${{ matrix.runner_name }} + strategy: + fail-fast: false + matrix: + image: [packaging-plugins-bullseye, packaging-plugins-bookworm, packaging-plugins-jammy, packaging-plugins-bullseye-arm64] + name: + [ + "ARGV::Struct", + "Authen::SCRAM::Client", + "Config::AWS", + "Convert::EBCDIC", + "Crypt::Blowfish_PP", + "Crypt::OpenSSL::AES", + "DataStruct::Flat", + "DateTime::Format::Duration::ISO8601", + "Device::Modbus", + "Device::Modbus::RTU::Client", + "Device::Modbus::TCP::Client", + "Digest::SHA1", + "Email::Send::SMTP::Gmail", + "Hash::Ordered", + "HTTP::ProxyPAC", + "JMX::Jmx4Perl", + "Mojo::IOLoop::Signal", + "Net::Amazon::Signature::V4", + "Net::FTPSSL", + "Net::HTTPTunnel", + "Net::MQTT::Simple", + "Net::SMTP_auth", + "Paws", + "Statistics::Regression", + "WWW::Selenium", + "ZMQ::Constants", + "ZMQ::LibZMQ4" + ] + include: + - runner_name: ubuntu-24.04 + - arch: amd64 + - build_distribs: "bullseye,bookworm,jammy" + - deb_dependencies: "" + - rpm_provides: "" + - version: "" + - distrib: bullseye + package_extension: deb + image: packaging-plugins-bullseye + - distrib: bookworm + package_extension: deb + image: packaging-plugins-bookworm + - distrib: jammy + package_extension: deb + image: packaging-plugins-jammy + - distrib: bullseye + package_extension: deb + image: packaging-plugins-bullseye-arm64 + arch: arm64 + runner_name: ["self-hosted", "collect-arm64"] + - name: "Device::Modbus::RTU::Client" + build_distribs: "bookworm" + - name: "Device::Modbus::TCP::Client" + build_distribs: "bookworm" + - name: "Digest::SHA1" + build_distribs: "jammy" + - name: "Net::Amazon::Signature::V4" + build_distribs: ["bullseye", "jammy"] + - name: "Net::MQTT::Simple" + version: "1.29" + - name: "Paws" + deb_dependencies: "libmoose-perl libmoosex-classattribute-perl libjson-maybexs-perl liburl-encode-perl libargv-struct-perl libmoo-perl libtype-tiny-perl libdatastruct-flat-perl libmodule-find-perl libthrowable-perl liburi-template-perl libnet-amazon-signature-v4-perl" + no-auto-depends: true + - name: "Statistics::Regression" + build_distribs: "bullseye" + version: "0.53" + - name: "ZMQ::LibZMQ4" + version: "0.01" + deb_dependencies: "libzmq5" + name: package ${{ matrix.distrib }} ${{ matrix.arch }} ${{ matrix.name }} + container: + image: ${{ vars.DOCKER_INTERNAL_REGISTRY_URL }}/${{ matrix.image }}:latest + credentials: + username: ${{ secrets.HARBOR_CENTREON_PULL_USERNAME }} + password: ${{ secrets.HARBOR_CENTREON_PULL_TOKEN }} + + steps: + - if: ${{ contains(matrix.build_distribs, matrix.distrib) }} + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + + - if: ${{ contains(matrix.build_distribs, matrix.distrib) }} + name: Parse distrib name + id: parse-distrib + uses: ./.github/actions/parse-distrib + with: + distrib: ${{ matrix.distrib }} + + - if: ${{ contains(matrix.build_distribs, matrix.distrib) }} + name: Get package version + id: package-version + run: | + apt-get update + apt-get install -y cpanminus + + if [ -z "${{ matrix.version }}" ]; then + CPAN_PACKAGE_VERSION=$(cpanm --info ${{ matrix.name }} | sed 's/\.tar\.gz$//' | sed 's/.*\-//' | sed 's/v//') + + if [[ ! $CPAN_PACKAGE_VERSION =~ ^[0-9]+\.[0-9]+ ]]; then + echo "::error::Invalid version number: ${CPAN_PACKAGE_VERSION}" + exit 1 + fi + + PACKAGE_VERSION="${CPAN_PACKAGE_VERSION}" + else + PACKAGE_VERSION="${{ matrix.version }}" + fi + + echo "package_version=$(echo $PACKAGE_VERSION)" >> $GITHUB_OUTPUT + shell: bash + + - if: ${{ contains(matrix.build_distribs, matrix.distrib) }} + name: Check if package already exists + run: | + package_name=$(echo "lib${{ matrix.name }}-perl" | sed 's/::/-/g' | tr '[:upper:]' '[:lower:]') + package_info=$(apt-cache policy $package_name) + if [[ -n $package_info ]]; then + echo "Package already exists in the repository." + candidate_version=$(echo "$package_info" | grep 'Candidate:' | awk '{print $2}') + if [[ "$candidate_version" == "${{ steps.package-version.outputs.package_version }}"* ]]; then + echo "Package already exists in the repository with the same version." + exit 0 + fi + fi + shell: bash + + - if: ${{ contains(matrix.build_distribs, matrix.distrib) }} + run: | + apt-get install -y ruby libcurl4-openssl-dev libssh-dev uuid-dev libczmq-dev + + if [ -z "${{ matrix.deb_dependencies }}" ]; then + PACKAGE_DEPENDENCIES="" + else + for PACKAGE_DEPENDENCY in `echo ${{ matrix.deb_dependencies }}`; do + PACKAGE_DEPENDENCIES="$PACKAGE_DEPENDENCIES --depends $PACKAGE_DEPENDENCY" + done + fi + + if [ ! -z "${{ matrix.no-auto-depends }}" ]; then + PACKAGE_DEPENDENCIES="$PACKAGE_DEPENDENCIES --no-auto-depends" + fi + + cpanm Module::Build::Tiny + cpanm Module::Install + + gem install fpm + # Patch to apply fpm fix for debian package generation while waiting for the official fix to be released. + patch -i .github/patch/fpm-deb.rb.diff $(find / -type f -name "deb.rb") + + fpm -a native -s cpan -t ${{ matrix.package_extension }} --deb-dist ${{ matrix.distrib }} --iteration ${{ steps.parse-distrib.outputs.package_distrib_name }} --verbose --cpan-verbose --no-cpan-test$PACKAGE_DEPENDENCIES -v ${{ steps.package-version.outputs.package_version }} ${{ matrix.name }} + shell: bash + + - if: ${{ contains(matrix.build_distribs, matrix.distrib) }} + name: Replace '::' with - in the feature path + id: package-name + run: | + name="${{ matrix.name }}" + name_with_dash="${name//::/-}" + echo "Modified Name: $name_with_dash" + echo "name_with_dash=$name_with_dash" >> $GITHUB_OUTPUT + shell: bash + + - if: ${{ contains(matrix.build_distribs, matrix.distrib) }} + uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0 + with: + name: packages-${{ matrix.package_extension }}-${{ matrix.distrib }}-${{ matrix.arch }}-${{ steps.package-name.outputs.name_with_dash}} + path: ./*.${{ matrix.package_extension }} + retention-days: 1 + + merge-package-deb-artifacts: + needs: [get-environment, package-deb] + if: | + needs.get-environment.outputs.skip_workflow == 'false' && + needs.get-environment.outputs.stability != 'stable' + runs-on: ubuntu-24.04 + strategy: + matrix: + distrib: [bullseye, bookworm, jammy] + + steps: + - name: Merge Artifacts + uses: actions/upload-artifact/merge@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0 + with: + name: packages-deb-${{ matrix.distrib }} + pattern: packages-deb-${{ matrix.distrib }}-* + delete-merged: false # cannot be set to true due to random fails: Failed to DeleteArtifact: Unable to make request: ECONNRESET + retention-days: 1 + + - name: Delete merged artifacts + uses: geekyeggo/delete-artifact@f275313e70c08f6120db482d7a6b98377786765b # v5.1.0 + with: + name: packages-deb-${{ matrix.distrib }}-* + failOnError: false + + download-and-cache-deb: + needs: [get-environment, merge-package-deb-artifacts] + if: | + needs.get-environment.outputs.skip_workflow == 'false' && + needs.get-environment.outputs.stability != 'stable' + runs-on: ubuntu-24.04 + strategy: + matrix: + distrib: [bullseye, bookworm, jammy] + steps: + - uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8 + with: + name: packages-deb-${{ matrix.distrib }} + path: ./ + + - uses: actions/cache/save@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2 + with: + path: ./*.deb + key: ${{ github.sha }}-${{ github.run_id }}-deb-${{ matrix.distrib }} + test-packages: - needs: [get-environment, sign-rpm] + needs: [get-environment, sign-rpm, download-and-cache-deb] strategy: fail-fast: false matrix: @@ -283,6 +522,31 @@ jobs: distrib: el8 arch: amd64 runner_name: ubuntu-24.04 + - package_extension: rpm + image: almalinux:9 + distrib: el9 + arch: amd64 + runner_name: ubuntu-24.04 + - package_extension: deb + image: debian:bullseye + distrib: bullseye + arch: amd64 + runner_name: ubuntu-24.04 + - package_extension: deb + image: debian:bookworm + distrib: bookworm + arch: amd64 + runner_name: ubuntu-24.04 + - package_extension: deb + image: ubuntu:jammy + distrib: jammy + arch: amd64 + runner_name: ubuntu-24.04 + - package_extension: deb + image: arm64v8/debian:bullseye + distrib: bullseye + arch: arm64 + runner_name: ["self-hosted", "collect-arm64"] runs-on: ${{ matrix.runner_name }} container: @@ -300,21 +564,13 @@ jobs: GPG_KEY_URL="https://yum-gpg.centreon.com/RPM-GPG-KEY-CES" curl -sSL $GPG_KEY_URL -o RPM-GPG-KEY-CES rpm --import RPM-GPG-KEY-CES - # Add Centreon plugins repositories - # echo -e '[centreon-plugins-stable]\nname=centreon plugins stable x86_64\nbaseurl=https://packages.centreon.com/rpm-plugins/${{ matrix.distrib }}/stable/x86_64\nenabled=1\ngpgcheck=1\ngpgkey=https://yum-gpg.centreon.com/RPM-GPG-KEY-CES\n[centreon-plugins-stable-noarch]\nname=centreon plugins stable noarch\nbaseurl=https://packages.centreon.com/rpm-plugins/${{ matrix.distrib }}/stable/noarch\nenabled=1\ngpgcheck=1\ngpgkey=https://yum-gpg.centreon.com/RPM-GPG-KEY-CES\n' >> /etc/yum.repos.d/centreon-plugins.repo shell: bash - if: ${{ matrix.package_extension == 'deb' }} name: Install zstd, perl and Centreon repositories run: | export DEBIAN_FRONTEND=noninteractive apt-get update - apt-get install -y zstd perl wget gpg apt-utils - # Add Centreon plugins repositories - # if [ "${{ matrix.distrib }}" == "jammy" ]; then - # echo "deb https://packages.centreon.com/ubuntu-plugins-stable/ ${{ matrix.distrib }} main" | tee /etc/apt/sources.list.d/centreon-plugins.list - # else - # echo "deb https://packages.centreon.com/apt-plugins-stable/ ${{ matrix.distrib }} main" | tee /etc/apt/sources.list.d/centreon-plugins.list - # fi + apt-get install -y zstd perl wget gpg apt-utils procps wget -O- https://apt-key.centreon.com | gpg --dearmor | tee /etc/apt/trusted.gpg.d/centreon.gpg > /dev/null 2>&1 apt-get update shell: bash @@ -324,71 +580,76 @@ jobs: path: ./*.${{ matrix.package_extension }} key: ${{ github.sha }}-${{ github.run_id }}-${{ matrix.package_extension }}-${{ matrix.distrib }} fail-on-cache-miss: true - - name: Install packages + - if: ${{ matrix.package_extension == 'rpm' }} + name: Install packages run: | error_log="install_error_${{ matrix.distrib }}_${{ matrix.arch }}.log" - for package in ./*.${{ matrix.package_extension }}; do - echo "Package found: $package" - # If a debian package name ends with amd64 or arm64, we only install it if the tested architecture is the same, otherwise we skip it - if [[ ${{ matrix.package_extension }} == 'deb' && ($package == *amd64.deb && ${{ matrix.arch }} != "amd64" || $package == *arm64.deb && ${{ matrix.arch }} != "arm64") ]]; then + for package in ./*.rpm; do + echo "Installing package: $package" + # List dependencies, and remove version and comparison operators + dependencies=$(rpm -qpR $package | sed 's/ [0-9.-]*\(\s\|$\)/ /g' | sed 's/ [<>!=]*\(\s\|$\)/ /g') + for dependency in $dependencies; do + # Skip non-perl dependencies + if [[ $dependency != perl* ]]; then + continue + else + echo "Check dependency: $dependency" + # Update the dependency name to match the package name + dependency=$(echo $dependency | sed 's/(/-/g' | sed 's/)//g' | sed 's/::/-/g') + fi + # If the dependency has been built in the same workflow, install it + if [[ -n $(find . -maxdepth 1 -regex "\.\/$dependency-[0-9v].*\.rpm") ]]; then + echo "Installing dependency: $dependency" + error_output=$(dnf install -y ./$dependency*.rpm 2>&1) || { echo "$error_output" >> $error_log; echo "Error during installation of the dependency $dependency" >> $error_log; true; } + fi + done + # Install package, then uninstall it with all his dependencies + echo "Package installation..." + error_output=$(dnf install -y $package 2>&1) || { echo "$error_output" >> $error_log; echo "Error during installation of the package $package" >> $error_log; true; } + echo "Package installation done." + echo "Package uninstallation..." + error_output=$(dnf autoremove -y $(echo $package | sed 's/_[0-9].*\.rpm//' | sed 's/.\///') 2>&1) || { echo "$error_output" >> $error_log; echo "Error during autoremove of the package $package" >> $error_log; true; } + echo "Package uninstallation done." + done + # If the file error_log exists and is not empty, the workflow is in error + if [[ -s $error_log ]]; then + cat $error_log + exit 1 + fi + shell: bash + - if: ${{ matrix.package_extension == 'deb' }} + name: Install packages + run: | + error_log="install_error_${{ matrix.distrib }}_${{ matrix.arch }}.log" + for package in ./*.deb; do + # If the debian package name ends with amd64 or arm64, we only install it if the tested architecture is the same, otherwise we skip it + if [[ $package == *amd64.deb && ${{ matrix.arch }} != "amd64" || $package == *arm64.deb && ${{ matrix.arch }} != "arm64" ]]; then continue fi echo "Installing package: $package" # List dependencies - if [ "${{ matrix.package_extension }}" == "rpm" ]; then - # List dependencies, and remove version and comparison operators - dependencies=$(rpm -qpR $package | sed 's/ [0-9.-]*\(\s\|$\)/ /g' | sed 's/ [<>!=]*\(\s\|$\)/ /g') - else - dependencies=$(dpkg-deb -I $package | grep Depends | sed 's/Depends: //' | sed 's/,//g') - fi - echo "Dependencies: $dependencies" + dependencies=$(dpkg-deb -I $package | grep Depends | sed 's/Depends: //' | sed 's/,//g' | sed 's/(\(.*\)//g') || { echo "$error_output" >> $error_log; echo "Error while listing dependencies of the package $package" >> $error_log; true; } for dependency in $dependencies; do - echo "Dependency: $dependency" - # Skip non-perl dependencies - if [ "${{ matrix.package_extension }}" == "rpm" ]; then - if [[ $dependency != perl* ]]; then - continue - else - echo "Check dependency: $dependency" - # Update the dependency name to match the package name - dependency=$(echo $dependency | sed 's/(/-/g' | sed 's/)//g' | sed 's/::/-/g') - fi - elif [[ ${{ matrix.package_extension }} == "deb" && $dependency != lib*-perl ]]; then - continue - fi - # If the dependency has been built in the same workflow, install it - echo "searching file: $dependency*.${{ matrix.package_extension }}" - if [[ -n $(find . -maxdepth 1 -regex "\.\/$dependency[-_][\dv].*\.${{ matrix.package_extension }}") ]]; then - echo "Installing dependency: $dependency" - if [ "${{ matrix.package_extension }}" == "rpm" ]; then - error_output=$(dnf install -y ./$dependency*.rpm 2>&1) || { echo "$error_output" >> $error_log; echo "Error during installation of the dependency $dependency" >> $error_log; true; } - else - error_output=$(apt-get install -y ./$dependency*.deb 2>&1) || { echo "$error_output" >> $error_log; echo "Error during installation of the dependency $dependency" >> $error_log; true; } - fi + # If the dependency exists in the Debian repository, don't check the local dependencies + dependency_info=$(apt-cache policy $dependency) + if [[ -n $dependency_info ]]; then + echo "Dependency $dependency exists in debian repository." + continue else - echo "Dependency $dependency not found" + # If the dependency has been built in the same workflow, install it + for dependency_package in $(find . -maxdepth 1 -regex "\.\/${dependency}_[0-9].*all\.deb" -o -regex "\.\/${dependency}_[0-9].*${{ matrix.arch }}\.deb"); do + echo "Installing dependency: $dependency_package" + error_output=$(apt-get install -y ./$dependency_package 2>&1) || { echo "$error_output" >> $error_log; echo "Error during installation of the dependency $dependency" >> $error_log; true; } + done fi done # Install package, then uninstall it with all his dependencies - if [ "${{ matrix.package_extension }}" == "rpm" ]; then - echo "Package installation..." - error_output=$(dnf install -y $package 2>&1) || { echo "$error_output" >> $error_log; echo "Error during installation of the package $package" >> $error_log; true; } - echo "Package installation done." - echo "Package uninstallation..." - error_output=$(dnf autoremove -y $(echo $package | sed 's/_[0-9].*\.rpm//' | sed 's/.\///') 2>&1) || { echo "$error_output" >> $error_log; echo "Error during autoremove of the package $package" >> $error_log; true; } - echo "Package uninstallation done." - # Clean dnf cache - dnf clean all - else - echo "Package installation..." - error_output=$(apt-get install -y $package 2>&1) || { echo "$error_output" >> $error_log; echo "Error during installation of the package $package" >> $error_log; true; } - echo "Package installation done." - echo "Package uninstallation..." - error_output=$(apt-get autoremove -y --purge $(echo $package | sed 's/_[0-9].*\.deb//' | sed 's/.\///') 2>&1) || { echo "$error_output" >> $error_log; echo "Error during autoremove of the package $package" >> $error_log; true; } - echo "Package uninstallation done." - # Clean apt cache - apt-get clean - fi + echo "Package installation..." + error_output=$(apt-get install -y $package 2>&1) || { echo "$error_output" >> $error_log; echo "Error during installation of the package $package" >> $error_log; true; } + echo "Package installation done." + echo "Package uninstallation..." + error_output=$(apt-get autoremove -y --purge $(echo $package | sed 's/_[0-9].*\.deb//' | sed 's/.\///') 2>&1) || { echo "$error_output" >> $error_log; echo "Error during autoremove of the package $package" >> $error_log; true; } + echo "Package uninstallation done." done # If the file error_log exists and is not empty, the workflow is in error if [[ -s $error_log ]]; then @@ -402,3 +663,51 @@ jobs: with: name: install_error_log_${{ matrix.distrib }}-${{ matrix.arch }} path: install_error_${{ matrix.distrib }}_${{ matrix.arch }}.log + + deliver-packages: + needs: [get-environment, sign-rpm, download-and-cache-deb, test-packages] + if: | + needs.get-environment.outputs.skip_workflow == 'false' && + (contains(fromJson('["testing", "unstable"]'), needs.get-environment.outputs.stability) || ( needs.get-environment.outputs.stability == 'stable' && github.event_name != 'workflow_dispatch')) && + ! cancelled() && + ! contains(needs.*.result, 'failure') && + ! contains(needs.*.result, 'cancelled') + runs-on: ubuntu-24.04 + strategy: + fail-fast: false + matrix: + include: + - distrib: el8 + package_extension: rpm + - distrib: el9 + package_extension: rpm + - distrib: bullseye + package_extension: deb + - distrib: bookworm + package_extension: deb + - distrib: jammy + package_extension: deb + + name: deliver ${{ matrix.distrib }} + steps: + - name: Checkout sources + uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 + + - name: Delivery + uses: ./.github/actions/package-delivery + with: + module_name: perl-cpan-libraries + distrib: ${{ matrix.distrib }} + cache_key: ${{ github.sha }}-${{ github.run_id }}-${{ matrix.package_extension }}-${{ matrix.distrib }} + stability: ${{ needs.get-environment.outputs.stability }} + release_type: ${{ needs.get-environment.outputs.release_type }} + artifactory_token: ${{ secrets.ARTIFACTORY_ACCESS_TOKEN }} + + set-skip-label: + needs: [get-environment, deliver-packages] + if: | + needs.get-environment.outputs.skip_workflow == 'false' && + ! cancelled() && + ! contains(needs.*.result, 'failure') && + ! contains(needs.*.result, 'cancelled') + uses: ./.github/workflows/set-pull-request-skip-label.yml