Skip to content

Commit

Permalink
update packages existence checking + dependencies after cpan build
Browse files Browse the repository at this point in the history
  • Loading branch information
sdepassio committed Dec 27, 2024
1 parent 62f5134 commit e0b5852
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,6 @@ cpanm Crypt::OpenSSL::Guess

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")

echo 'deb [trusted=yes] https://repo.goreleaser.com/apt/ /' | tee /etc/apt/sources.list.d/goreleaser.list
apt-get update
apt-get install -y nfpm=2.41.0
Expand Down
6 changes: 6 additions & 0 deletions .github/workflows/perl-cpan-libraries.yml
Original file line number Diff line number Diff line change
Expand Up @@ -568,6 +568,7 @@ jobs:
image: ${{ matrix.image }}

name: Test perl CPAN libs packages on ${{ matrix.package_extension }} ${{ matrix.distrib }} ${{ matrix.arch }}

steps:
- if: ${{ matrix.package_extension == 'rpm' }}
name: Install zstd, perl and Centreon repositories
Expand All @@ -580,6 +581,7 @@ jobs:
curl -sSL $GPG_KEY_URL -o RPM-GPG-KEY-CES
rpm --import RPM-GPG-KEY-CES
shell: bash

- if: ${{ matrix.package_extension == 'deb' }}
name: Install zstd, perl and Centreon repositories
run: |
Expand All @@ -589,12 +591,14 @@ jobs:
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

- name: Restore packages from cache
uses: actions/cache/restore@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4.1.2
with:
path: ./*.${{ matrix.package_extension }}
key: ${{ github.sha }}-${{ github.run_id }}-${{ matrix.package_extension }}-${{ matrix.distrib }}
fail-on-cache-miss: true

- if: ${{ matrix.package_extension == 'rpm' }}
name: Install packages
run: |
Expand Down Expand Up @@ -632,6 +636,7 @@ jobs:
exit 1
fi
shell: bash

- if: ${{ matrix.package_extension == 'deb' }}
name: Install packages
run: |
Expand Down Expand Up @@ -672,6 +677,7 @@ jobs:
exit 1
fi
shell: bash

- name: Upload error log
if: failure()
uses: actions/upload-artifact@v4
Expand Down
13 changes: 7 additions & 6 deletions .github/workflows/test-cpan-libraries.yml
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,8 @@ jobs:
- name: "Statistics::Regression"
build_distribs: "bullseye"
version: "0.53"
- name: "WWW::Selenium"
deb_dependencies: "libcarp-always-perl libdata-dumper-compact-perl libexporter-tiny-perl libhttp-headers-fast-perl libhttp-request-ascgi-perl libio-socket-ssl-perl liblwp-useragent-determined-perl libtest-simple-perl libtest-more-utf8-perl liburi-escape-xs-perl libclass-base-perl"
- name: "ZMQ::LibZMQ4"
version: "0.01"
deb_dependencies: "libzmq5"
Expand All @@ -390,26 +392,25 @@ jobs:
id: package-version
run: |
if [ -z "${{ matrix.version }}" ]; then
CPAN_PACKAGE_VERSION=$(cpanm --info ${{ matrix.name }} | sed 's/\.tar\.gz$//' | sed 's/.*\-//' | sed 's/v//')
cpan_info=$(cpanm --info ${{ matrix.name }})
CPAN_PACKAGE_VERSION=$cpan_info | 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
CPAN_PACKAGE_NAME=$cpan_info | sed 's/.*\///g' | sed 's/-[0-9\.]*\.tar\.gz//g' | tr '[:upper:]' '[:lower:]')
echo "package_name=$(echo $CPAN_PACKAGE_NAME)" >> $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)
package_info=$(apt-cache policy ${{ steps.package-version.outputs.package_name }})
if [[ -n $package_info ]]; then
echo "Package already exists in the repository."
candidate_version=$(echo "$package_info" | grep 'Candidate:' | awk '{print $2}')
Expand Down

0 comments on commit e0b5852

Please sign in to comment.