|
| 1 | +name: Arrow Extension |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_call: |
| 5 | + secrets: |
| 6 | + CODECOV_TOKEN: |
| 7 | + required: false |
| 8 | + |
| 9 | +jobs: |
| 10 | + build: |
| 11 | + name: Build and Test Extension |
| 12 | + runs-on: ${{ matrix.os }} |
| 13 | + strategy: |
| 14 | + fail-fast: false |
| 15 | + matrix: |
| 16 | + os: ['ubuntu-latest', 'macos-latest'] |
| 17 | + php: ['8.3', '8.4', '8.5'] |
| 18 | + |
| 19 | + steps: |
| 20 | + - uses: actions/checkout@v5 |
| 21 | + |
| 22 | + - name: Setup PHP Environment |
| 23 | + uses: ./.github/actions/setup-php-env |
| 24 | + with: |
| 25 | + php-version: ${{ matrix.php }} |
| 26 | + dependencies: locked |
| 27 | + extensions: ':psr, bcmath, dom, hash, json, mbstring, xml, xmlwriter, xmlreader, zlib, zstd' |
| 28 | + tools: 'composer:v2, php-config' |
| 29 | + coverage: 'pcov' |
| 30 | + install-dependencies: 'false' |
| 31 | + |
| 32 | + - name: Install Rust toolchain |
| 33 | + uses: dtolnay/rust-toolchain@stable |
| 34 | + |
| 35 | + - name: Cache cargo registry and build |
| 36 | + uses: actions/cache@v4 |
| 37 | + with: |
| 38 | + path: | |
| 39 | + ~/.cargo/registry |
| 40 | + ~/.cargo/git |
| 41 | + src/extension/arrow-ext/target |
| 42 | + key: ${{ runner.os }}-php${{ matrix.php }}-cargo-${{ hashFiles('src/extension/arrow-ext/Cargo.lock') }} |
| 43 | + restore-keys: | |
| 44 | + ${{ runner.os }}-php${{ matrix.php }}-cargo- |
| 45 | +
|
| 46 | + - name: Install build dependencies (Ubuntu) |
| 47 | + if: runner.os == 'Linux' |
| 48 | + run: | |
| 49 | + sudo apt-get update |
| 50 | + sudo apt-get install -y build-essential clang libclang-dev |
| 51 | +
|
| 52 | + - name: Install build dependencies (macOS) |
| 53 | + if: runner.os == 'macOS' |
| 54 | + run: | |
| 55 | + brew install llvm |
| 56 | + echo "LIBCLANG_PATH=$(brew --prefix llvm)/lib" >> $GITHUB_ENV |
| 57 | +
|
| 58 | + - name: Set LIBCLANG_PATH (Ubuntu) |
| 59 | + if: runner.os == 'Linux' |
| 60 | + run: | |
| 61 | + LIBCLANG_SO=$(find /usr/lib -name 'libclang*.so' -o -name 'libclang*.so.*' 2>/dev/null | head -1) |
| 62 | + echo "LIBCLANG_PATH=$(dirname "$LIBCLANG_SO")" >> $GITHUB_ENV |
| 63 | +
|
| 64 | + - name: Build extension |
| 65 | + working-directory: src/extension/arrow-ext |
| 66 | + run: make build |
| 67 | + |
| 68 | + - name: Run PHPT tests |
| 69 | + working-directory: src/extension/arrow-ext |
| 70 | + run: make test |
| 71 | + |
| 72 | + - name: Install extension and verify |
| 73 | + working-directory: src/extension/arrow-ext |
| 74 | + run: | |
| 75 | + EXT_DIR=$(php -r 'echo ini_get("extension_dir");') |
| 76 | + sudo cp ext/modules/arrow.so "$EXT_DIR/" |
| 77 | + echo "extension=arrow.so" | sudo tee -a "$(php -r 'echo php_ini_loaded_file();')" |
| 78 | + php -m | grep arrow |
| 79 | +
|
| 80 | + - name: Install Composer Dependencies |
| 81 | + run: composer install --no-interaction --no-progress |
| 82 | + |
| 83 | + - name: Run Parquet Integration Tests with Arrow |
| 84 | + run: composer test:lib:parquet |
| 85 | + |
| 86 | + - name: Upload to Codecov |
| 87 | + if: ${{ !cancelled() && matrix.php == '8.3' && matrix.os == 'ubuntu-latest' }} |
| 88 | + uses: codecov/codecov-action@v5 |
| 89 | + with: |
| 90 | + token: ${{ secrets.CODECOV_TOKEN }} |
| 91 | + directory: ./var/phpunit/coverage/clover |
| 92 | + flags: arrow-extension |
0 commit comments