Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions .github/actions/codecov-report/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,23 +44,23 @@ runs:

- name: Upload test results (baseline)
if: ${{ github.event_name == 'push' && !cancelled() && inputs.php-version == '8.3' && inputs.dependencies == 'locked' }}
uses: codecov/codecov-action@fb8b3582c8e4def4969c97caa2f19720cb33a72f # v7
uses: codecov/codecov-action@303a32d7a59b442fa8d48b6a1cc6825c09c847a5 # v7.1.1
with:
token: ${{ inputs.token }}
directory: ./var/phpunit/logs
report_type: test_results

- name: Upload code coverage (baseline)
if: ${{ github.event_name == 'push' && !cancelled() && inputs.php-version == '8.3' && inputs.dependencies == 'locked' }}
uses: codecov/codecov-action@fb8b3582c8e4def4969c97caa2f19720cb33a72f # v7
uses: codecov/codecov-action@303a32d7a59b442fa8d48b6a1cc6825c09c847a5 # v7.1.1
with:
token: ${{ inputs.token }}
directory: ./var/phpunit/coverage/clover
flags: tests

- name: Upload code coverage (pull request)
if: ${{ github.event_name == 'pull_request' && !cancelled() && inputs.dependencies == 'locked' && inputs.php-version == '8.3' }}
uses: codecov/codecov-action@fb8b3582c8e4def4969c97caa2f19720cb33a72f # v7
uses: codecov/codecov-action@303a32d7a59b442fa8d48b6a1cc6825c09c847a5 # v7.1.1
with:
token: ${{ inputs.token }}
directory: ./var/phpunit/coverage/clover
Expand All @@ -69,7 +69,7 @@ runs:

- name: Upload test results (pull request)
if: ${{ github.event_name == 'pull_request' && !cancelled() && inputs.dependencies == 'locked' }}
uses: codecov/codecov-action@fb8b3582c8e4def4969c97caa2f19720cb33a72f # v7
uses: codecov/codecov-action@303a32d7a59b442fa8d48b6a1cc6825c09c847a5 # v7.1.1
with:
token: ${{ inputs.token }}
directory: ./var/phpunit/logs
Expand All @@ -96,7 +96,7 @@ runs:

- name: Upload commit SHA as artifact
if: ${{ github.event_name == 'push' && inputs.php-version == '8.3' && inputs.dependencies == 'locked' }}
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: codecov-base-commit-sha-${{ steps.baseline.outputs.branch_name }}
path: codecov-base-commit-sha-${{ steps.baseline.outputs.branch_name }}.txt
Expand Down
57 changes: 57 additions & 0 deletions .github/actions/rust-extension-toolchain/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: "Rust extension toolchain"
description: "Installs the stable Rust toolchain plus the clang/libclang and autotools that ext-php-rs extensions need to build (directly or through PIE)"

outputs:
libclang-path:
description: "Directory holding libclang, for LIBCLANG_PATH"
value: ${{ steps.clang.outputs.libclang-path }}
clang-path:
description: "clang executable from the same llvm as libclang, for CLANG_PATH"
value: ${{ steps.clang.outputs.clang-path }}

runs:
using: "composite"
steps:
- name: "Install Rust toolchain"
uses: dtolnay/rust-toolchain@89b12181fb390509a0842a86cc55eeb8eb928c1d # stable
with:
toolchain: stable

- name: "Install build dependencies (Ubuntu)"
if: runner.os == 'Linux'
shell: bash
run: |
sudo apt-get update
sudo apt-get install -y build-essential autoconf automake libtool clang libclang-dev

- name: "Install build dependencies (macOS)"
if: runner.os == 'macOS'
shell: bash
run: brew install autoconf automake libtool llvm

- name: "Locate clang"
id: clang
shell: bash
run: |
if [ "$RUNNER_OS" = "macOS" ]; then
# Pin the clang executable to the one shipped with the same llvm as
# libclang. Otherwise clang-sys (used by ext-php-rs's bindgen) falls
# back to `xcodebuild -find clang` and mixes Xcode's clang headers
# (e.g. arm_neon.h) with brew's newer libclang, which fails to compile.
echo "libclang-path=$(brew --prefix llvm)/lib" >> "$GITHUB_OUTPUT"
echo "clang-path=$(brew --prefix llvm)/bin/clang" >> "$GITHUB_OUTPUT"
exit 0
fi
# Find the canonical libclang.so shared library, excluding the
# Clang runtime support libraries under llvm-*/lib/clang/*/lib/.
LIBCLANG_SO=$(find /usr/lib \
\( -name 'libclang.so' -o -name 'libclang.so.*' -o -name 'libclang-*.so' -o -name 'libclang-*.so.*' \) \
-not -path '*/clang/*/lib/*' \
2>/dev/null | head -1)
if [ -z "$LIBCLANG_SO" ]; then
echo "Could not locate libclang.so under /usr/lib" >&2
exit 1
fi
echo "Detected libclang at: $LIBCLANG_SO"
echo "libclang-path=$(dirname "$LIBCLANG_SO")" >> "$GITHUB_OUTPUT"
echo "clang-path=$(command -v clang)" >> "$GITHUB_OUTPUT"
18 changes: 18 additions & 0 deletions .github/actions/setup-php-env/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,24 @@ runs:
# Deliberately unquoted: apt-packages is a space-separated list that must word-split.
run: sudo apt-get update && sudo apt-get install -y $APT_PACKAGES

- name: "Setup extensions cache"
id: extensions-cache
uses: shivammathur/cache-extensions@22e24453af1bf3851994136f122ce065ab828a74 # 1.15.2
with:
php-version: ${{ inputs.php-version }}
extensions: "${{ inputs.extensions }}, redis-6.3.0"
key: "php-extensions-${{ runner.os }}-${{ runner.arch }}-v1"
env:
share-cache-across-jobs: true
share-cache-across-workflows: true

- name: "Cache extensions"
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6
with:
path: ${{ steps.extensions-cache.outputs.dir }}
key: ${{ steps.extensions-cache.outputs.key }}
restore-keys: ${{ steps.extensions-cache.outputs.key }}

- name: "Install PHP"
uses: shivammathur/setup-php@eb7c497e18156a6bbabfef1d3a82760b9eda3962 # 2.40.0
with:
Expand Down
2 changes: 0 additions & 2 deletions .github/workflows/baseline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ jobs:
coverage: "none"
extensions: ':psr, bcmath, dom, hash, json, mbstring, xml, xmlwriter, xmlreader, zlib'
cache-key-suffix: "-locked-phar"
apt-packages: "build-essential autoconf automake libtool protobuf-compiler libprotobuf-c-dev"

- name: "Build pg-query-ext from source"
uses: "./.github/actions/pg-query-ext"
Expand Down Expand Up @@ -117,7 +116,6 @@ jobs:
dependencies: "locked"
extensions: ':psr, bcmath, dom, hash, json, mbstring, xml, xmlwriter, xmlreader, zlib'
cache-key-suffix: "-website-phar"
apt-packages: "build-essential autoconf automake libtool protobuf-compiler libprotobuf-c-dev"
extra-working-directory: "web/landing"
extra-cache-key-suffix: "-website"
extra-composer-file: "web/landing/composer.lock"
Expand Down
106 changes: 26 additions & 80 deletions .github/workflows/job-arrow-extension.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@ name: Arrow Extension

on:
workflow_call:
inputs:
full-matrix:
description: "Build macOS on every PHP version and test the macOS PIE install; otherwise macOS builds the newest PHP only"
type: boolean
required: false
default: true
secrets:
CODECOV_TOKEN:
required: false
Expand All @@ -15,6 +21,7 @@ jobs:
matrix:
os: ['blacksmith-2vcpu-ubuntu-2404', 'macos-latest']
php: ['8.3', '8.4', '8.5']
exclude: ${{ fromJSON(inputs.full-matrix && '[]' || '[{"os":"macos-latest","php":"8.3"},{"os":"macos-latest","php":"8.4"}]') }}

steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
Expand All @@ -33,57 +40,23 @@ jobs:
coverage: 'pcov'
install-dependencies: 'false'

- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@89b12181fb390509a0842a86cc55eeb8eb928c1d # stable
with:
toolchain: stable
- name: Setup Rust extension toolchain
id: rust
uses: ./.github/actions/rust-extension-toolchain

- name: Cache cargo registry and build
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6
uses: Swatinem/rust-cache@6323deb102c322ba6fcbdcafc7e3dddab59af2b6 # v2.9.2
with:
path: |
~/.cargo/registry
~/.cargo/git
src/extension/arrow-ext/target
key: ${{ runner.os }}-php${{ matrix.php }}-cargo-${{ hashFiles('src/extension/arrow-ext/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-php${{ matrix.php }}-cargo-

- name: Install build dependencies (Ubuntu)
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y build-essential clang libclang-dev

- name: Install build dependencies (macOS)
if: runner.os == 'macOS'
run: |
brew install llvm
echo "LIBCLANG_PATH=$(brew --prefix llvm)/lib" >> "$GITHUB_ENV"
# Pin the clang executable to the one shipped with the same llvm as
# libclang. Otherwise clang-sys (used by ext-php-rs's bindgen) falls
# back to `xcodebuild -find clang` and mixes Xcode's clang headers
# (e.g. arm_neon.h) with brew's newer libclang, which fails to compile.
echo "CLANG_PATH=$(brew --prefix llvm)/bin/clang" >> "$GITHUB_ENV"

- name: Set LIBCLANG_PATH (Ubuntu)
if: runner.os == 'Linux'
run: |
# Find the canonical libclang.so shared library, excluding the
# Clang runtime support libraries under llvm-*/lib/clang/*/lib/.
LIBCLANG_SO=$(find /usr/lib \
\( -name 'libclang.so' -o -name 'libclang.so.*' -o -name 'libclang-*.so' -o -name 'libclang-*.so.*' \) \
-not -path '*/clang/*/lib/*' \
2>/dev/null | head -1)
if [ -z "$LIBCLANG_SO" ]; then
echo "Could not locate libclang.so under /usr/lib" >&2
exit 1
fi
echo "LIBCLANG_PATH=$(dirname "$LIBCLANG_SO")" >> "$GITHUB_ENV"
echo "Detected libclang at: $LIBCLANG_SO"
# ext-php-rs bindings are generated against the PHP headers, so builds are per PHP version
key: php${{ matrix.php }}
workspaces: |
src/extension/arrow-ext -> target

- name: Build extension
working-directory: src/extension/arrow-ext
env: &rust-env
LIBCLANG_PATH: ${{ steps.rust.outputs.libclang-path }}
CLANG_PATH: ${{ steps.rust.outputs.clang-path }}
run: make build

- name: Install Composer Dependencies
Expand All @@ -94,6 +67,7 @@ jobs:

- name: Run PHPT tests
working-directory: src/extension/arrow-ext
env: *rust-env
run: make test

- name: Install extension and verify
Expand Down Expand Up @@ -124,6 +98,7 @@ jobs:
fail-fast: false
matrix:
os: ['blacksmith-2vcpu-ubuntu-2404', 'macos-latest']
exclude: ${{ fromJSON(inputs.full-matrix && '[]' || '[{"os":"macos-latest"}]') }}

steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
Expand All @@ -140,41 +115,9 @@ jobs:
extensions: ':psr, bcmath, dom, hash, json, mbstring, xml, xmlwriter, xmlreader, zlib'
tools: 'composer:v2, phpize, php-config'

- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@89b12181fb390509a0842a86cc55eeb8eb928c1d # stable
with:
toolchain: stable

- name: Install build dependencies (Ubuntu)
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y build-essential autoconf automake libtool clang libclang-dev

- name: Install build dependencies (macOS)
if: runner.os == 'macOS'
run: |
brew install autoconf automake libtool llvm
echo "LIBCLANG_PATH=$(brew --prefix llvm)/lib" >> "$GITHUB_ENV"
# See the build job: keep clang and libclang from the same llvm so
# bindgen does not mix brew's libclang with Xcode's clang headers.
echo "CLANG_PATH=$(brew --prefix llvm)/bin/clang" >> "$GITHUB_ENV"

- name: Set LIBCLANG_PATH (Ubuntu)
if: runner.os == 'Linux'
run: |
# Find the canonical libclang.so shared library, excluding the
# Clang runtime support libraries under llvm-*/lib/clang/*/lib/.
LIBCLANG_SO=$(find /usr/lib \
\( -name 'libclang.so' -o -name 'libclang.so.*' -o -name 'libclang-*.so' -o -name 'libclang-*.so.*' \) \
-not -path '*/clang/*/lib/*' \
2>/dev/null | head -1)
if [ -z "$LIBCLANG_SO" ]; then
echo "Could not locate libclang.so under /usr/lib" >&2
exit 1
fi
echo "LIBCLANG_PATH=$(dirname "$LIBCLANG_SO")" >> "$GITHUB_ENV"
echo "Detected libclang at: $LIBCLANG_SO"
- name: Setup Rust extension toolchain
id: rust
uses: ./.github/actions/rust-extension-toolchain

- name: Install PIE
run: |
Expand All @@ -191,6 +134,9 @@ jobs:
mv composer.tmp.json composer.json

- name: Install extension via PIE (from local)
env:
LIBCLANG_PATH: ${{ steps.rust.outputs.libclang-path }}
CLANG_PATH: ${{ steps.rust.outputs.clang-path }}
run: |
sudo pie repository:remove packagist.org
sudo pie repository:add path "$RUNNER_TEMP/src/extension/arrow-ext"
Expand Down
Loading
Loading