Skip to content

Commit 92565b6

Browse files
authored
Merge pull request #1 from tyrsson/finish-code-migration-and-repo-setup
Finish code migration and repo setup
2 parents f7403be + de10ad1 commit 92565b6

61 files changed

Lines changed: 5650 additions & 2 deletions

Some content is hidden

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

.ci/pgsql_fixtures.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/usr/bin/env bash
2+
3+
echo "Configure PostgreSQL test database"
4+
5+
psql -U postgres -c 'create database phpdb_test;'
6+
psql -U postgres -c "alter role postgres password 'postgres'"

.gitattributes

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
/.gitattributes export-ignore
2+
/.github/ export-ignore
3+
/.gitignore export-ignore
4+
/phpcs.xml export-ignore
5+
/renovate.json export-ignore
6+
/.laminas-ci.json export-ignore
7+
/.laminas-ci/ export-ignore
8+
/.ci/ export-ignore
9+
/phpunit.xml.dist export-ignore
10+
/test/ export-ignore
11+
/clover.xml export-ignore
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: "Continuous Integration"
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches:
7+
tags:
8+
9+
jobs:
10+
matrix:
11+
name: Generate job matrix
12+
runs-on: ubuntu-latest
13+
outputs:
14+
matrix: ${{ steps.matrix.outputs.matrix }}
15+
steps:
16+
- name: Gather CI configuration
17+
id: matrix
18+
uses: laminas/laminas-ci-matrix-action@v1
19+
20+
qa:
21+
name: QA Checks
22+
needs: [matrix]
23+
runs-on: ${{ matrix.operatingSystem }}
24+
strategy:
25+
fail-fast: false
26+
matrix: ${{ fromJSON(needs.matrix.outputs.matrix) }}
27+
steps:
28+
- name: ${{ matrix.name }}
29+
uses: laminas/laminas-continuous-integration-action@v1
30+
with:
31+
job: ${{ matrix.job }}
32+
services:
33+
postgres:
34+
image: postgres
35+
env:
36+
POSTGRES_USER: 'gha'
37+
POSTGRES_PASSWORD: 'password'
38+
POSTGRES_DB: 'phpdb_test'
39+
options: >-
40+
--health-cmd pg_isready
41+
--health-interval 10s
42+
--health-timeout 5s
43+
--health-retries 3
44+
ports:
45+
- 5432
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
name: "Automatic Releases"
2+
3+
on:
4+
milestone:
5+
types:
6+
- "closed"
7+
8+
jobs:
9+
release:
10+
uses: laminas/workflow-automatic-releases/.github/workflows/release-on-milestone-closed.yml@1.x
11+
secrets:
12+
GIT_AUTHOR_EMAIL: ${{ secrets.GIT_AUTHOR_EMAIL }}
13+
GIT_AUTHOR_NAME: ${{ secrets.GIT_AUTHOR_NAME }}
14+
ORGANIZATION_ADMIN_TOKEN: ${{ secrets.ORGANIZATION_ADMIN_TOKEN }}
15+
SIGNING_SECRET_KEY: ${{ secrets.SIGNING_SECRET_KEY }}

.gitignore

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
/.phpcs-cache
2+
/.phpstan-cache
3+
/phpstan.neon
4+
/.phpunit.cache
5+
/.phpunit.result.cache
6+
/phpunit.xml
7+
/vendor/
8+
/xdebug_filter.php
9+
/clover.xml

.laminas-ci.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"additional_checks": [
3+
{
4+
"name": "PhpStan",
5+
"job": {
6+
"php": "8.2",
7+
"dependencies": "latest",
8+
"command": "composer require --dev phpstan/phpstan && vendor/bin/phpstan analyse"
9+
}
10+
}
11+
]
12+
}

.laminas-ci/phpunit.xml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<phpunit
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
5+
bootstrap="vendor/autoload.php"
6+
requireCoverageMetadata="true"
7+
colors="true">
8+
9+
<extensions>
10+
<bootstrap class="PhpDbIntegrationTest\Adapter\Pgsql\Extension\ListenerExtension" />
11+
</extensions>
12+
<testsuites>
13+
<testsuite name="unit test">
14+
<directory>./test/unit</directory>
15+
</testsuite>
16+
<testsuite name="integration test">
17+
<directory>./test/integration</directory>
18+
</testsuite>
19+
</testsuites>
20+
<php>
21+
<!-- Integration Test Variables -->
22+
<env name="TESTS_PHPDB_ADAPTER_PGSQL" value="true" /><!-- todo: remove this env variable as its no longer needed-->
23+
<env name="TESTS_PHPDB_ADAPTER_PGSQL_HOSTNAME" value="pgsql" />
24+
<env name="TESTS_PHPDB_ADAPTER_PGSQL_USERNAME" value="gha" />
25+
<env name="TESTS_PHPDB_ADAPTER_PGSQL_PASSWORD" value="password" />
26+
<env name="TESTS_PHPDB_ADAPTER_PGSQL_DATABASE" value="phpdb_test" />
27+
</php>
28+
</phpunit>
29+

.laminas-ci/pre-install.sh

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#!/bin/bash
2+
3+
WORKING_DIRECTORY=$2
4+
JOB=$3
5+
PHP_VERSION=$(echo "${JOB}" | jq -r '.php')
6+
7+
8+
if [ ! -z "$GITHUB_BASE_REF" ] && [[ "$GITHUB_BASE_REF" =~ ^[0-9]+\.[0-9] ]]; then
9+
readarray -td. TARGET_BRANCH_VERSION_PARTS <<<"${GITHUB_BASE_REF}.";
10+
unset 'TARGET_BRANCH_VERSION_PARTS[-1]';
11+
declare -a TARGET_BRANCH_VERSION_PARTS
12+
MAJOR_OF_TARGET_BRANCH=${TARGET_BRANCH_VERSION_PARTS[0]}
13+
MINOR_OF_TARGET_BRANCH=${TARGET_BRANCH_VERSION_PARTS[1]}
14+
15+
export COMPOSER_ROOT_VERISON="${MAJOR_OF_TARGET_BRANCH}.${MINOR_OF_TARGET_BRANCH}.99"
16+
echo "Exported COMPOSER_ROOT_VERISON as ${COMPOSER_ROOT_VERISON}"
17+
fi

.laminas-ci/pre-run.sh

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#!/bin/bash
2+
3+
set -e
4+
5+
TEST_USER=$1
6+
WORKSPACE=$2
7+
JOB=$3
8+
9+
COMMAND=$(echo "${JOB}" | jq -r '.command')
10+
11+
if [[ ! ${COMMAND} =~ phpunit ]]; then
12+
exit 0
13+
fi
14+
15+
PHP_VERSION=$(echo "${JOB}" | jq -r '.php')
16+
17+
# Install CI version of phpunit config
18+
cp .laminas-ci/phpunit.xml phpunit.xml
19+
20+
# Install lsof (used in integration tests)
21+
apt update -qq
22+
apt install -yqq lsof

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
1-
# axleus-repo-template
2-
Template repo for starting all new repo's
1+
# phpdb-adapter-pgsql
2+
3+
PostgreSQL Adapter for PHPDb

0 commit comments

Comments
 (0)