mirror of
https://github.com/php-gnupg/php-gnupg.git
synced 2026-12-01 21:18:50 +00:00
Declare the extension metadata and GpgME dependency for PIE, document installation, and verify a PIE install from the checkout in CI.
158 lines
4.4 KiB
YAML
158 lines
4.4 KiB
YAML
name: CI
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- master
|
|
pull_request:
|
|
branches:
|
|
- master
|
|
|
|
env:
|
|
NO_INTERACTION: 1
|
|
REPORT_EXIT_STATUS: 1
|
|
TEST_PHP_ARGS: --show-diff
|
|
|
|
jobs:
|
|
# All supported PHP versions with gpgme provided by the distribution
|
|
# (ubuntu-22.04 has gpgme 1.16, ubuntu-24.04 has gpgme 1.18).
|
|
distro-gpgme:
|
|
name: PHP ${{ matrix.php }} / distro gpgme / ${{ matrix.os }}
|
|
runs-on: ${{ matrix.os }}
|
|
continue-on-error: ${{ matrix.php == 'nightly' }}
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
os: [ubuntu-24.04]
|
|
php: ['7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3', '8.4', '8.5', 'nightly']
|
|
include:
|
|
- os: ubuntu-22.04
|
|
php: '7.4'
|
|
- os: ubuntu-22.04
|
|
php: '8.4'
|
|
|
|
steps:
|
|
- name: Checkout php-gnupg
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Install dependencies
|
|
run: |
|
|
sudo apt-get update
|
|
sudo apt-get install -y gpg gpgsm libgpgme-dev
|
|
|
|
- name: Setup PHP
|
|
uses: shivammathur/setup-php@v2
|
|
with:
|
|
php-version: ${{ matrix.php }}
|
|
coverage: none
|
|
tools: none
|
|
|
|
- name: Show versions
|
|
run: |
|
|
php -v
|
|
gpg --version | head -n 2
|
|
dpkg -s libgpgme-dev | grep Version
|
|
|
|
- name: Build php-gnupg
|
|
run: |
|
|
phpize
|
|
./configure
|
|
make -j"$(nproc)"
|
|
|
|
- name: Run tests
|
|
run: make test
|
|
|
|
# Selected gpgme versions built from source.
|
|
source-gpgme:
|
|
name: PHP ${{ matrix.php }} / gpgme ${{ matrix.gpgme }}
|
|
runs-on: ubuntu-24.04
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
gpgme: ['1.24.3', '2.0.0']
|
|
php: ['7.2', '8.5']
|
|
env:
|
|
GPGME_PREFIX: /opt/gpgme-${{ matrix.gpgme }}
|
|
|
|
steps:
|
|
- name: Checkout php-gnupg
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Install dependencies
|
|
run: |
|
|
sudo apt-get update
|
|
sudo apt-get install -y gpg gpgsm libgpg-error-dev libassuan-dev
|
|
|
|
- name: Cache gpgme
|
|
id: cache-gpgme
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: ${{ env.GPGME_PREFIX }}
|
|
key: gpgme-${{ matrix.gpgme }}-${{ runner.os }}-ubuntu-24.04-v1
|
|
|
|
- name: Build gpgme
|
|
if: steps.cache-gpgme.outputs.cache-hit != 'true'
|
|
run: |
|
|
curl -fsSL -o gpgme.tar.bz2 "https://gnupg.org/ftp/gcrypt/gpgme/gpgme-${{ matrix.gpgme }}.tar.bz2"
|
|
mkdir gpgme-src
|
|
tar -xjf gpgme.tar.bz2 -C gpgme-src --strip-components=1
|
|
cd gpgme-src
|
|
./configure --prefix="$GPGME_PREFIX" --enable-languages= --disable-gpg-test --disable-gpgsm-test --disable-gpgconf-test --disable-g13-test
|
|
make -j"$(nproc)"
|
|
sudo make install
|
|
|
|
- name: Setup PHP
|
|
uses: shivammathur/setup-php@v2
|
|
with:
|
|
php-version: ${{ matrix.php }}
|
|
coverage: none
|
|
tools: none
|
|
|
|
- name: Build php-gnupg
|
|
run: |
|
|
phpize
|
|
./configure --with-gnupg="$GPGME_PREFIX"
|
|
make -j"$(nproc)"
|
|
|
|
- name: Show versions
|
|
run: |
|
|
php -v
|
|
gpg --version | head -n 2
|
|
php -d extension="$PWD/modules/gnupg.so" -r 'echo "gpgme ", GNUPG_GPGME_VERSION, "\n";'
|
|
|
|
- name: Run tests
|
|
run: make test
|
|
|
|
pie-install:
|
|
runs-on: ubuntu-24.04
|
|
env:
|
|
PIE_VERSION: "1.5.0"
|
|
|
|
steps:
|
|
- name: Install dependencies
|
|
run: |
|
|
sudo apt-get update
|
|
sudo apt-get install -y gpg gpgsm libgpgme-dev php-cli php-dev autoconf libtool make gcc
|
|
|
|
- name: Checkout php-gnupg
|
|
uses: actions/checkout@v4
|
|
with:
|
|
submodules: true
|
|
|
|
- name: Download pie.phar
|
|
run: |
|
|
curl -fsSL -o "$RUNNER_TEMP/pie.phar" \
|
|
"https://github.com/php/pie/releases/download/${PIE_VERSION}/pie.phar"
|
|
|
|
- name: Install php-gnupg with PIE
|
|
env:
|
|
INSTALL_ROOT: ${{ runner.temp }}/pie-install
|
|
run: |
|
|
mkdir -p "$INSTALL_ROOT$(php-config --extension-dir)"
|
|
php "$RUNNER_TEMP/pie.phar" repository:add path "$GITHUB_WORKSPACE"
|
|
php "$RUNNER_TEMP/pie.phar" install --no-interaction --skip-enable-extension 'php-gnupg/gnupg:@dev'
|
|
|
|
- name: Verify the extension is loaded
|
|
env:
|
|
INSTALL_ROOT: ${{ runner.temp }}/pie-install
|
|
run: php -n -d "extension=$INSTALL_ROOT$(php-config --extension-dir)/gnupg.so" -m | grep -qx gnupg
|