Skip to content

Commit

Permalink
CI - update Continuous integration & co docker image
Browse files Browse the repository at this point in the history
  • Loading branch information
SimonMellerin committed Nov 28, 2023
1 parent ec576bd commit 4d6e2ea
Show file tree
Hide file tree
Showing 5 changed files with 71 additions and 167 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build-and-publish-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
- "main"
paths:
- .github/workflows/build-and-publish-image.yml
- docker/php-ci/Dockerfile
- docker/ci-image/Dockerfile

env:
REGISTRY: ghcr.io
Expand Down
223 changes: 59 additions & 164 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,6 @@ jobs:
php-version:
- "8.1"
mariadb-version:
- "10.6" # LTS (Jul 2026)
- "10.11" # LTS (Feb 2028)
- "11.0" # STS (Jun 2024)
- "11.1" # STS (Aug 2024)
Expand Down Expand Up @@ -253,7 +252,6 @@ jobs:
uses: "shivammathur/setup-php@v2"
with:
php-version: "${{ matrix.php-version }}"
coverage: "pcov"
ini-values: "zend.assertions=1"
extensions: "${{ matrix.extension }}"

Expand Down Expand Up @@ -284,24 +282,26 @@ jobs:

strategy:
matrix:
php-version:
- "8.1"
extension:
- "sqlsrv"
- "pdo_sqlsrv"
collation:
- "Latin1_General_100_CI_AS_SC_UTF8"
include:
- php-version: "8.1"
extension: "sqlsrv"
collation: "Latin1_General_100_CI_AS_SC_UTF8"
schema: "sqlsrv"
- php-version: "8.1"
extension: "pdo_sqlsrv"
collation: "Latin1_General_100_CI_AS_SC_UTF8"
schema: "mssql"

services:
mssql:
image: "mcr.microsoft.com/mssql/server:2019-latest"
env:
ACCEPT_EULA: "Y"
SA_PASSWORD: "password"
SA_PASSWORD: "P@ssword123"
MSSQL_COLLATION: "${{ matrix.collation }}"

options: >-
--health-cmd "echo quit | /opt/mssql-tools/bin/sqlcmd -S 127.0.0.1 -l 1 -U sa -P test_db"
--health-cmd "echo quit | /opt/mssql-tools/bin/sqlcmd -S 127.0.0.1 -l 1 -U sa -P P@ssword123"
ports:
- "1433:1433"
Expand All @@ -316,10 +316,8 @@ jobs:
uses: "shivammathur/setup-php@v2"
with:
php-version: "${{ matrix.php-version }}"
coverage: "pcov"
ini-values: "zend.assertions=1"
tools: "pecl"
extensions: "${{ matrix.extension }}-5.10.0beta1"
extensions: "${{ matrix.extension }}-5.10.0"

- name: "Install dependencies with Composer"
uses: "ramsey/composer-install@v2"
Expand All @@ -331,158 +329,55 @@ jobs:
DBAL_DRIVER: "${{ matrix.extension }}"
DBAL_DBNAME: "test_db"
DBAL_HOST: "mssql"
DBAL_PASSWORD: "password"
DBAL_PORT: "3306"
DBAL_ROOT_PASSWORD: "password"
DBAL_PASSWORD: "P@ssword123"
DBAL_PORT: "1433"
DBAL_ROOT_PASSWORD: "P@ssword123"
DBAL_ROOT_USER: "sa"
DBAL_USER: "sa"
DATABASE_URL: "pdo-sqlsrv://sa:P%40ssword123@sqlsrv2019:1433/test_db?serverVersion=2019&charset=utf8&driverOptions[TrustServerCertificate]=true"
DATABASE_URL: "${{ matrix.schema }}://sa:P%40ssword123@mssql:1433/test_db?serverVersion=2019&driverOptions[TrustServerCertificate]=true"

run: "vendor/bin/phpunit"

# phpunit-sqlite:
# name: "PHPUnit with SQLite"
# runs-on: "${{ matrix.os }}"

# strategy:
# matrix:
# os:
# - "ubuntu-22.04"
# php-version:
# - "8.1"
# - "8.2"
# - "8.3"
# dependencies:
# - "highest"
# extension:
# - "pdo_sqlite"
# - "sqlite3"

# steps:
# - name: "Checkout"
# uses: "actions/checkout@v4"
# with:
# fetch-depth: 2

# - name: "Install PHP"
# uses: "shivammathur/setup-php@v2"
# with:
# php-version: "${{ matrix.php-version }}"
# coverage: "pcov"
# ini-values: "zend.assertions=1"

# - name: "Install dependencies with Composer"
# uses: "ramsey/composer-install@v2"
# with:
# composer-options: "--ignore-platform-req=php+"
# dependency-versions: "${{ matrix.dependencies }}"

# - name: "Print SQLite version"
# run: >
# php -r 'printf("Testing with libsqlite version %s\n", (new PDO("sqlite::memory:"))->query("select sqlite_version()")->fetch()[0]);'
# if: "${{ matrix.extension == 'pdo_sqlite' }}"

# - name: "Print SQLite version"
# run: >
# php -r 'printf("Testing with libsqlite version %s\n", SQLite3::version()["versionString"]);'
# if: "${{ matrix.extension == 'sqlite3' }}"

# - name: "Run PHPUnit"
# run: "vendor/bin/phpunit -c ci/github/phpunit/${{ matrix.extension }}.xml --coverage-clover=coverage.xml"
# phpunit-oci8:
# name: "PHPUnit on OCI8"
# runs-on: "ubuntu-22.04"

# strategy:
# matrix:
# php-version:
# - "8.1"
# - "8.2"
# - "8.3"
# oracle-version:
# - "21"
# - "23"

# services:
# oracle:
# image: gvenzl/oracle-${{ matrix.oracle-version < 23 && 'xe' || 'free' }}:${{ matrix.oracle-version }}
# env:
# ORACLE_PASSWORD: oracle
# ports:
# - "1521:1521"
# options: >-
# --health-cmd healthcheck.sh
# --health-interval 20s
# --health-timeout 10s
# --health-retries 10

# steps:
# - name: "Checkout"
# uses: "actions/checkout@v4"
# with:
# fetch-depth: 2

# - name: "Install PHP"
# uses: "shivammathur/setup-php@v2"
# with:
# php-version: "${{ matrix.php-version }}"
# extensions: "oci8"
# coverage: "pcov"
# ini-values: "zend.assertions=1"

# - name: "Install dependencies with Composer"
# uses: "ramsey/composer-install@v2"
# with:
# composer-options: "--ignore-platform-req=php+"

# - name: "Run PHPUnit"
# run: "vendor/bin/phpunit -c ci/github/phpunit/oci8${{ matrix.oracle-version < 23 && '-21' || '' }}.xml --coverage-clover=coverage.xml"

# phpunit-pdo-oci:
# name: "PHPUnit on PDO_OCI"
# runs-on: "ubuntu-22.04"

# strategy:
# matrix:
# php-version:
# - "8.1"
# - "8.2"
# - "8.3"
# oracle-version:
# - "21"
# - "23"

# services:
# oracle:
# image: gvenzl/oracle-${{ matrix.oracle-version < 23 && 'xe' || 'free' }}:${{ matrix.oracle-version }}
# env:
# ORACLE_PASSWORD: oracle
# ports:
# - "1521:1521"
# options: >-
# --health-cmd healthcheck.sh
# --health-interval 20s
# --health-timeout 10s
# --health-retries 10

# steps:
# - name: "Checkout"
# uses: "actions/checkout@v4"
# with:
# fetch-depth: 2

# - name: "Install PHP"
# uses: "shivammathur/setup-php@v2"
# with:
# php-version: "${{ matrix.php-version }}"
# extensions: "pdo_oci"
# coverage: "pcov"
# ini-values: "zend.assertions=1"

# - name: "Install dependencies with Composer"
# uses: "ramsey/composer-install@v2"
# with:
# composer-options: "--ignore-platform-req=php+"

# - name: "Run PHPUnit"
# run: "vendor/bin/phpunit -c ci/github/phpunit/pdo_oci${{ matrix.oracle-version < 23 && '-21' || '' }}.xml --coverage-clover=coverage.xml"
phpunit-sqlite:
name: "PHPUnit with SQLite"
runs-on: ubuntu-latest
container:
image: ghcr.io/makinacorpus/dbtoolsbundle-ci:main
needs: "phpunit-smoke-tests"

strategy:
matrix:
os:
- "ubuntu-22.04"
php-version:
- "8.1"
extension:
- "pdo_sqlite"
- "sqlite3"

steps:
- name: "Checkout"
uses: "actions/checkout@v4"
with:
fetch-depth: 2

- name: "Install PHP"
uses: "shivammathur/setup-php@v2"
with:
php-version: "${{ matrix.php-version }}"
extensions: "${{ matrix.extension }}"
ini-values: "zend.assertions=1"

- name: "Install dependencies with Composer"
uses: "ramsey/composer-install@v2"
with:
composer-options: "--ignore-platform-req=php+"

- name: "Run PHPUnit"
env:
DBAL_DRIVER: "${{ matrix.extension }}"
DBAL_DBNAME: "test_db"
DBAL_HOST: "127.0.0.1"
DBAL_PATH: ":memory:"
DATABASE_URL: "sqlite:///:memory:"
run: "vendor/bin/phpunit"
8 changes: 8 additions & 0 deletions docker/ci-image/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,14 @@ RUN sh -c 'echo "deb https://apt.postgresql.org/pub/repos/apt jammy-pgdg main" >
RUN curl -fsSL https://www.postgresql.org/media/keys/ACCC4CF8.asc|gpg --dearmor -o /etc/apt/trusted.gpg.d/postgresql.gpg
RUN apt-get update && apt-get install -y postgresql-client-16

# SQL Server support
ENV ACCEPT_EULA=Y
RUN curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add -
RUN curl https://packages.microsoft.com/config/ubuntu/20.04/prod.list > /etc/apt/sources.list.d/mssql-release.list
RUN apt-get update
RUN apt-get -y --no-install-recommends --allow-downgrades install msodbcsql18 odbcinst=2.3.7 odbcinst1debian2=2.3.7 \
unixodbc-dev=2.3.7 unixodbc=2.3.7

# Cleanup.
RUN apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*

Expand Down
4 changes: 2 additions & 2 deletions tests/Functional/Anonymizer/FrFR/AddressAnonymizerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ protected function createTestData(): void
'my_street_address' => 'Rue Jean Jaures',
'my_secondary_address' => 'Au dernier étage',
'my_postal_code' => '44000',
'my_locality' => 'Nantes',
'my_locality' => 'Toto-les-bains',
'my_region' => 'Pays de loire',
'my_country' => 'FRANCE',
],
Expand Down Expand Up @@ -95,7 +95,7 @@ public function testAnonymize(): void
$this->assertNotSame('Rue Jean Jaures', $datas[1]['my_street_address']);
$this->assertNotSame('Au dernier étage', $datas[1]['my_secondary_address']);
$this->assertNotSame('44000', $datas[1]['my_postal_code']);
$this->assertNotSame('Nantes', $datas[1]['my_locality']);
$this->assertNotSame('Toto-les-bains', $datas[1]['my_locality']);
$this->assertNotSame('Pays de loire', $datas[1]['my_region']);
/*
$this->assertNull($datas[2]['my_street_address']);
Expand Down
1 change: 1 addition & 0 deletions tests/FunctionalTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,7 @@ private function getConnectionParameters(): array
'password' => \getenv('DBAL_PASSWORD'),
'port' => \getenv('DBAL_PORT'),
'user' => \getenv('DBAL_USER'),
'path' => \getenv('DBAL_PATH'),
]);

return $params;
Expand Down

0 comments on commit 4d6e2ea

Please sign in to comment.