Skip to content

Commit 3046572

Browse files
authored
Dev/v1.2.0 (#11)
- Issue #7 - Instance cache support - Improve test coverage - Improve docs - Support for binding/appending all types - Fix memory leaks binding parameters - Improve CI: - Add coverage - Manual run for nightly build - Add Benchmark regression test with PHPBench - Update duckdblib to v 1.3.0 (release planned for ~~2025-05-14~~ 2025-05-21) - Fix bug: select library fails for some os/architectures - Fix nightly pipeline
1 parent 84bf5c2 commit 3046572

File tree

79 files changed

+3008
-368
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

79 files changed

+3008
-368
lines changed

.gitattributes

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,22 @@
33
*.dylib filter=lfs diff=lfs merge=lfs -text
44
*.csv filter=lfs diff=lfs merge=lfs -text
55
*.dll filter=lfs diff=lfs merge=lfs -text
6+
7+
/.github export-ignore
8+
/.docs export-ignore
9+
./examples export-ignore
10+
./scripts export-ignore
11+
./test export-ignore
12+
13+
.php-cs-fixer.dist.php export-ignore
14+
.readthedocs.yaml export-ignore
15+
Dockerfile export-ignore
16+
mkdocs.yaml export-ignore
17+
PERFORMANCE.md export-ignore
18+
phpbench.json export-ignore
19+
phpstan.neon export-ignore
20+
phpunit.xml.dist export-ignore
21+
preload.php export-ignore
22+
README.md export-ignore
23+
ROADMAP.md export-ignore
24+
sonar-project.properties export-ignore

.github/FUNDING.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
ko_fi: saturio
Lines changed: 67 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,44 @@
1-
name: benchmark-regression.yml
1+
name: Benchmark regression test
22

3-
on: workflow_dispatch
3+
on:
4+
pull_request:
5+
types: [labeled]
6+
branches: [ "main" ]
47

58
jobs:
69
build:
7-
if: ${{ always() }}
10+
if: github.event.label.name == 'run-benchmark-regression'
811
runs-on: ${{ matrix.os }}
912
strategy:
1013
fail-fast: false
1114
matrix:
1215
os: [ubuntu-latest]
1316
php: [8.4]
14-
stability: [prefer-stable]
1517

16-
name: P${{ matrix.php }} - ${{ matrix.stability }} - ${{ matrix.os }}
18+
name: Benchmark php-${{ matrix.php }} - ${{ matrix.os }}
1719

1820
steps:
19-
- uses: actions/checkout@v4
21+
- name: Checkout main to generate baseline
22+
uses: actions/checkout@v4
2023
with:
21-
lfs: false
22-
fetch-depth: 0
23-
ref: ${{ github.head_ref || github.ref_name }}
24+
ref: main
25+
26+
- name: Get last PHPBench tests and settings
27+
uses: actions/checkout@v4
28+
with:
29+
sparse-checkout: |
30+
test/Benchmark
31+
phpbench.json
32+
sparse-checkout-cone-mode: false
33+
path:
34+
current-phpbench-files
35+
36+
- name: Use last PHPBench tests and settings
37+
run: |
38+
rm -rf test/Benchmark
39+
rm -f phpbench.json
40+
cp -R current-phpbench-files/test/Benchmark test/Benchmark
41+
cp current-phpbench-files/phpbench.json phpbench.json
2442
2543
- name: Setup PHP
2644
uses: shivammathur/setup-php@v2
@@ -34,15 +52,51 @@ jobs:
3452
uses: actions/cache@v3
3553
with:
3654
path: vendor
37-
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
55+
key: php-composer-${{ matrix.php }}-${{ matrix.os }}-${{ hashFiles('**/composer.json') }}
3856
restore-keys: |
39-
${{ runner.os }}-php-
57+
php-composer-${{ matrix.php }}-${{ matrix.os }}-
4058
4159
- name: Install dependencies
42-
run: composer update --${{ matrix.stability }} --prefer-dist --no-interaction
60+
run: composer update --prefer-dist --no-interaction
4361

4462
- name: Dump autoload
4563
run: composer dump-autoload --optimize --apcu --no-cache
4664

65+
- run: mkdir -p .phpbench/samples
66+
- name: Cache Benchmark files
67+
uses: actions/cache@v3
68+
with:
69+
path: .phpbench/samples
70+
key: benchmark-samples-${{ hashFiles('/test/Benchmark/bootstrap.php') }}
71+
72+
- name: Run benchmark to generate baseline
73+
run: |
74+
echo '## Main branch baseline' >> $GITHUB_STEP_SUMMARY
75+
echo '' >> $GITHUB_STEP_SUMMARY
76+
echo '```markdown' >> $GITHUB_STEP_SUMMARY
77+
vendor/bin/phpbench run --tag=main --report=duckdb_benchmark_report --progress=none >> $GITHUB_STEP_SUMMARY
78+
echo '```' >> $GITHUB_STEP_SUMMARY
79+
80+
- name: Checkout current PR
81+
uses: actions/checkout@v4
82+
83+
- name: Install dependencies for current PR
84+
run: composer update --prefer-dist --no-interaction
85+
86+
- name: Dump autoload for current PR
87+
run: composer dump-autoload --optimize --apcu --no-cache
88+
89+
- run: mkdir -p .phpbench/samples
90+
- name: Cache Benchmark files
91+
uses: actions/cache@v3
92+
with:
93+
path: .phpbench/samples
94+
key: benchmark-samples-${{ hashFiles('/test/Benchmark/bootstrap.php') }}
95+
4796
- name: Run benchmark regression test
48-
run: composer benchmark-regression
97+
run: |
98+
echo '## Regression results' >> $GITHUB_STEP_SUMMARY
99+
echo '' >> $GITHUB_STEP_SUMMARY
100+
echo '```markdown' >> $GITHUB_STEP_SUMMARY
101+
vendor/bin/phpbench run --ref=main --report=duckdb_benchmark_report --progress=none >> $GITHUB_STEP_SUMMARY
102+
echo '```' >> $GITHUB_STEP_SUMMARY

.github/workflows/php_test.yml

Lines changed: 49 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ on:
66
lib-path:
77
required: false
88
type: string
9+
run-sonar:
10+
required: false
11+
type: boolean
12+
default: false
913

1014
permissions:
1115
contents: read
@@ -18,13 +22,16 @@ jobs:
1822
strategy:
1923
fail-fast: false
2024
matrix:
21-
os: [ubuntu-latest, windows-latest]
25+
os: [ubuntu-latest, windows-latest, ubuntu-24.04-arm, windows-11-arm]
2226
php: [8.5, 8.4, 8.3]
23-
stability: [prefer-lowest, prefer-stable]
2427

25-
name: P${{ matrix.php }} - ${{ matrix.stability }} - ${{ matrix.os }}
28+
name: php-${{ matrix.php }} - ${{ matrix.os }}
2629

2730
steps:
31+
- name: Get current date
32+
id: date
33+
run: echo "::set-output name=date::$(date +'%Y-%m-%d')"
34+
2835
- uses: actions/checkout@v4
2936
with:
3037
lfs: false
@@ -34,40 +41,69 @@ jobs:
3441
uses: actions/cache@v3
3542
with:
3643
path: lib_nightly
37-
key: lib_nightly-${{ steps.get-date.outputs.date }}
38-
restore-keys: |
39-
lib_nightly
44+
key: lib_nightly-${{ steps.date.outputs.date }}
4045
enableCrossOsArchive: true
4146

4247
- name: Setup PHP
4348
uses: shivammathur/setup-php@v2
4449
with:
4550
php-version: ${{ matrix.php }}
4651
extensions: ffi, pcntl
47-
coverage: none
52+
coverage: xdebug
4853

4954
- name: Cache Composer packages
5055
id: composer-cache
5156
uses: actions/cache@v3
5257
with:
5358
path: vendor
54-
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
59+
key: php-composer-${{ matrix.php }}-${{ matrix.os }}-${{ hashFiles('**/composer.json') }}
5560
restore-keys: |
56-
${{ runner.os }}-php-
61+
php-composer-${{ matrix.php }}-${{ matrix.os }}-
5762
5863
- name: Install dependencies
59-
run: composer update --${{ matrix.stability }} --prefer-dist --no-interaction
64+
run: composer update --prefer-dist --no-interaction
6065

6166
- name: Run test suite
6267
env:
6368
DUCKDB_PHP_LIB_DIRECTORY: ${{ inputs.lib-path }}
64-
run: vendor/bin/phpunit test
69+
run: vendor/bin/phpunit test --coverage-clover=coverage-${{ matrix.php }}-${{ matrix.os }}.xml
70+
71+
- name: Archive code coverage results
72+
if: ${{ inputs.run-sonar }}
73+
uses: actions/upload-artifact@v4
74+
with:
75+
name: coverage-${{ matrix.php }}-${{ matrix.os }}
76+
path: coverage-${{ matrix.php }}-${{ matrix.os }}.xml
77+
78+
sonar_scan:
79+
if: ${{ always() && inputs.run-sonar }}
80+
needs: [ build ]
81+
runs-on: ubuntu-latest
82+
steps:
83+
- uses: actions/checkout@v4
84+
with:
85+
lfs: false
86+
87+
- name: Download code-coverage
88+
uses: actions/download-artifact@v4
89+
with:
90+
path: .
91+
merge-multiple: true
92+
93+
- name: SonarQube Scan
94+
uses: SonarSource/sonarqube-scan-action@v4
95+
env:
96+
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
6597

6698
get_nightly_libraries:
6799
if: ${{ inputs.lib-path }}
68100
runs-on: ubuntu-latest
69101

70102
steps:
103+
- name: Get current date
104+
id: date
105+
run: echo "::set-output name=date::$(date +'%Y-%m-%d')"
106+
71107
- uses: actions/checkout@v4
72108
with:
73109
lfs: false
@@ -77,9 +113,10 @@ jobs:
77113
uses: actions/cache@v3
78114
with:
79115
path: lib_nightly
80-
key: lib_nightly-${{ steps.get-date.outputs.date }}
116+
key: lib_nightly-${{ steps.date.outputs.date }}
81117
restore-keys: |
82118
lib_nightly
83119
84120
- name: Get libraries
121+
if: ${{ steps.libraries-cache.outputs.cache-hit != 'true' }}
85122
run: ./scripts/get_libraries_nightly.sh

.github/workflows/php_test_main.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,6 @@ on:
88
jobs:
99
phpunit:
1010
uses: ./.github/workflows/php_test.yml
11+
secrets: inherit
12+
with:
13+
run-sonar: true

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,8 @@ tools
1212
.phpunit.result.cache
1313
out
1414
lib_nightly
15+
my-ui.db
16+
my-network-usage.db
17+
dutch_railway_network.duckdb
18+
oil-and-gas.parquet
19+
.phpbench

.readthedocs.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ build:
1010
tools:
1111
python: "3.13"
1212

13+
python:
14+
install:
15+
- requirements: docs/requirements.txt
16+
1317
# Build documentation with Mkdocs
1418
mkdocs:
1519
configuration: mkdocs.yaml

Dockerfile

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
FROM php:8.4-cli
22

3-
RUN apt-get -y update \
3+
RUN apt -y update \
44
&& DEBIAN_FRONTEND=noninteractive apt-get -y --no-install-recommends install libffi-dev time bc curl unzip \
55
&& docker-php-ext-configure ffi --with-ffi \
66
&& docker-php-ext-install ffi \
7-
&& apt-get clean \
7+
&& docker-php-ext-install bcmath \
8+
&& apt install -y valgrind \
9+
&& apt clean \
810
&& rm -rf /tmp/* /var/lib/apt/lists/* /var/cache/apt/archives/*
911

1012
COPY --from=composer /usr/bin/composer /usr/bin/composer

0 commit comments

Comments
 (0)