Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: update LV from 10.X to 11.X #276

Open
wants to merge 48 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
8041e70
feat: add new endpoint upgrade event
smarcet Aug 13, 2024
0d3bfbb
feat: promote summit event 2 presentation
smarcet Aug 13, 2024
5a4eca8
feat: promote summit event 2 presentation
smarcet Aug 13, 2024
c78e44e
refactor: update composer packages and PHP version
romanetar Jun 3, 2024
c61a82d
refactor: file providers
romanetar Jun 6, 2024
52701a8
chore: docker dev env setup
romanetar Jun 6, 2024
12ab6a5
refactor: write exceptions
romanetar Jun 6, 2024
2bc651a
fix: php version tweak
romanetar Jun 6, 2024
438f9c4
chore: test data insert tweaks
romanetar Jun 6, 2024
2545695
refactor: trusted proxy middleware
romanetar Jun 6, 2024
d7f3836
chore: docker dev environment setup
romanetar Jun 6, 2024
13576fe
fix: review issues
romanetar Jun 7, 2024
4e6c96a
chore: update sendgrid adapter lib
romanetar Jun 11, 2024
b27385c
Delete package.xml
romanetar Jun 11, 2024
ffe366b
chore: fix on test
smarcet Jun 18, 2024
74057da
chore: updated docker file to php 8.3
smarcet Jun 19, 2024
f5fedd0
fix: migrated int to boolean on criteria query ( we should check on a…
smarcet Jun 19, 2024
3a3149e
chore: fixed summit api unit tests
smarcet Jun 20, 2024
6d3a163
fix: summit lead report settings
smarcet Jun 20, 2024
d07184d
chore: improved memory usage of unit tests
smarcet Jun 20, 2024
bc3b8e9
chore: remove fruitcake/laravel-cors
smarcet Jun 20, 2024
3ffc8c1
chore: add github action to run unit test on push
smarcet Jun 20, 2024
c8dabff
chore: added missing config variables to github action
smarcet Jun 20, 2024
e0ad2d0
chore: fixing unit tests
smarcet Jun 20, 2024
3dcd6d7
fix: removed Fruitcake\\Cors\\HandleCors ref
smarcet Jun 20, 2024
750fc1e
fix: api config seed
smarcet Jun 20, 2024
c223ae4
chore: update sql mode on github action
smarcet Jun 20, 2024
4f963ab
chore: updated redis cache ns
smarcet Jun 20, 2024
8e1f77b
refactor: Criteria boolean filter values (#270)
romanetar Jun 24, 2024
8af1a92
Delete .env.dev
smarcet Jun 25, 2024
ed56861
fix: unit test from main rebase
smarcet Jun 27, 2024
1b791aa
chore: migration to LV 10.x
smarcet Jun 27, 2024
e2355f4
chore: Replace doctrine's deprecated fetchAll() with the new methods
smarcet Jun 27, 2024
d51654a
chore: update doctrine cmd fix
smarcet Jun 28, 2024
d2e2864
fix: upgrade doctrine queries
smarcet Jun 28, 2024
c63dc67
chore: update github action
smarcet Jun 28, 2024
16c84ae
chore: updated deps for LV 11.x
smarcet Jun 28, 2024
141cc71
chore: fix unit test for phpunit 11.x
smarcet Jun 28, 2024
8cff7d4
chore: fix github action
smarcet Jun 28, 2024
94cc167
chore: renamed file
smarcet Jun 28, 2024
670cc98
fix: rate limiter param
smarcet Jul 1, 2024
56f17dc
fix: replace doctrine deprecated methods fetchColum by fetchOne
smarcet Aug 6, 2024
640c965
chore: add missing SQL logger
smarcet Aug 13, 2024
e978eb0
chore: migrate orm deprecated methods
smarcet Aug 13, 2024
98dfc79
fix: unit test white line
smarcet Nov 20, 2024
9a854de
chore: update initial schema
smarcet Nov 20, 2024
9e54b7c
chore: refactor doctrine worker
smarcet Nov 25, 2024
4a8664b
chore: fix for DB replication config
smarcet Nov 25, 2024
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
128 changes: 128 additions & 0 deletions .github/workflows/push.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
# This is a basic workflow to help you get started with Actions

name: Unit Tests On Push

# Controls when the workflow will run
on: push

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "unit-tests"
unit-tests:
# The type of runner that the job will run on
runs-on: ubuntu-latest
env:
APP_ENV: testing
APP_DEBUG: true
APP_KEY: base64:4vh0op/S1dAsXKQ2bbdCfWRyCI9r8NNIdPXyZWt9PX4=
DEV_EMAIL_TO: [email protected]
APP_URL: http://localhost
DB_CONNECTION: model
DB_HOST: 127.0.0.1
DB_PORT: 3306
DB_DATABASE: api_config
DB_USERNAME: root
DB_PASSWORD: 1qaz2wsx
SS_DB_HOST: 127.0.0.1
SS_DB_PORT: 3310
SS_DATABASE: api_model
SS_DB_USERNAME: root
SS_DB_PASSWORD: 1qaz2wsx
REDIS_HOST: 127.0.0.1
REDIS_PORT: 6379
REDIS_DB: 0
REDIS_PASSWORD: 1qaz2wsx
REDIS_DATABASES: 16
SSL_ENABLED: false
SESSION_DRIVER: redis
PHP_VERSION: 8.3
CACHE_DRIVER: redis
SESSION_COOKIE_DOMAIN: localhost
SESSION_COOKIE_SECURE: false
QUEUE_DRIVER: redis
REGISTRATION_DEFAULT_PAYMENT_PROVIDER: Stripe
REGISTRATION_DEFAULT_STRIPE_TEST_MODE: true
REGISTRATION_DEFAULT_LIVE_STRIPE_PRIVATE_KEY:
REGISTRATION_DEFAULT_LIVE_STRIPE_PUBLISHABLE_KEY:
REGISTRATION_DEFAULT_LIVE_WEBHOOK_SECRET:
REGISTRATION_DEFAULT_TEST_STRIPE_PRIVATE_KEY: sk_test_12345
REGISTRATION_DEFAULT_TEST_STRIPE_PUBLISHABLE_KEY: pk_12345
REGISTRATION_DEFAULT_TEST_WEBHOOK_SECRET: whsec_12345
BOOKABLE_ROOMS_DEFAULT_PAYMENT_PROVIDER: Stripe
BOOKABLE_ROOMS_DEFAULT_STRIPE_TEST_MODE: true
BOOKABLE_ROOMS_DEFAULT_LIVE_STRIPE_PRIVATE_KEY:
BOOKABLE_ROOMS_DEFAULT_LIVE_STRIPE_PUBLISHABLE_KEY:
BOOKABLE_ROOMS_DEFAULT_LIVE_WEBHOOK_SECRET:
BOOKABLE_ROOMS_DEFAULT_TEST_STRIPE_PRIVATE_KEY: sk_test_12345
BOOKABLE_ROOMS_DEFAULT_TEST_STRIPE_PUBLISHABLE_KEY: pk_12345
BOOKABLE_ROOMS_DEFAULT_TEST_WEBHOOK_SECRET: whsec_12345
REGISTRATION_VALIDATE_TICKET_TYPE_REMOVAL: false
services:
mysql_api_model:
image: mysql:8.0
env:
MYSQL_ROOT_PASSWORD: ${{env.SS_DB_PASSWORD}}
MYSQL_DATABASE: ${{env.SS_DATABASE}}
ports:
- 3310:3306
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=10 --name=mysql_api_model
mysql_api_config:
image: mysql:8.0
env:
MYSQL_ROOT_PASSWORD: ${{env.DB_PASSWORD}}
MYSQL_DATABASE: ${{env.DB_DATABASE}}
ports:
- 3306:3306
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=10

steps:
- name: Create Redis
uses: supercharge/[email protected]
with:
redis-port: ${{env.REDIS_PORT}}
redis-password: ${{env.REDIS_PASSWORD}}
# Downloads a copy of the code in your repository before running CI tests
- name: Check out repository code
uses: actions/checkout@v4
- name: Change MYSQL sql_mode
run: >
docker exec mysql_api_model mysql -u root --password=${{env.SS_DB_PASSWORD}} -e "SET GLOBAL sql_mode = 'NO_ENGINE_SUBSTITUTION';"
- name: Install PHP
uses: "shivammathur/setup-php@v2"
with:
php-version: ${{env.PHP_VERSION}}
extensions: pdo_mysql, mbstring, exif, pcntl, bcmath, sockets, gettext
- name: Install dependencies
uses: "ramsey/composer-install@v3"
env:
COMPOSER_AUTH: '{"github-oauth": {"github.com": "${{ secrets.COMPOSER_AUTH_TOKEN }}"} }'
- name: 'Run Tests'
run: |
./update_doctrine.sh
php artisan db:create_test_db --schema=config
php artisan db:create_test_db --schema=model
php artisan doctrine:migrations:migrate --no-interaction --em model
echo "running OAuth2SummitApiTest"
vendor/bin/phpunit --filter "OAuth2SummitApiTest" --log-junit results_summit_api_test.xml
echo "running OAuth2SummitEventsApiTest"
vendor/bin/phpunit --filter "OAuth2SummitEventsApiTest" --log-junit results_events_api_test.xml
echo "running OAuth2PresentationSubmissionTest"
vendor/bin/phpunit --filter "OAuth2PresentationSubmissionTest" --log-junit results_presentation_submissions_api_test.xml
- name: 'Upload Unit Test Output For OAuth2SummitApiTest'
uses: actions/upload-artifact@v4
with:
name: results_summit_api_test
path: results_summit_api_test.xml
retention-days: 5
- name: 'Upload Unit Test Output For OAuth2SummitEventsApiTest'
uses: actions/upload-artifact@v4
with:
name: results_events_api_test
path: results_events_api_test.xml
retention-days: 5
- name: 'Upload Unit Test Output For OAuth2PresentationSubmissionTest'
uses: actions/upload-artifact@v4
with:
name: results_presentation_submissions_api_test
path: results_presentation_submissions_api_test.xml
retention-days: 5
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,6 @@ routes.txt
/ss.sql
phpunit.xml
.phpunit.result.cache
.phpunit.cache/
.phpunit.cache/
package.xml
.env.dev
24 changes: 20 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
FROM php:7.4-fpm
FROM php:8.3-fpm

ARG DEBIAN_FRONTEND=noninteractive
ARG GITHUB_OAUTH_TOKEN
ARG XDEBUG_VERSION="xdebug-3.1.6"
ARG XDEBUG_VERSION="xdebug-3.3.2"

ENV COMPOSER_ALLOW_SUPERUSER=1
ENV GITHUB_OAUTH_TOKEN=$GITHUB_OAUTH_TOKEN
ENV PHP_DIR /usr/local/etc/php

ARG NVM_VERSION="v0.39.7"
ARG NODE_VERSION="18.20.2"
# base packages
RUN apt-get update
RUN apt-get install -y \
Expand All @@ -29,11 +31,25 @@ RUN apt-get install -y \
gettext \
libmagickwand-dev

# node / npm
RUN apt install -y nodejs npm

# nvm
RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/$NVM_VERSION/install.sh | bash
RUN \. ~/.nvm/nvm.sh && nvm install $NODE_VERSION

# yarn
RUN curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add -
RUN echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list
RUN apt update && apt install -y yarn

ENV NVM_DIR=/root/.nvm

RUN apt clean && rm -rf /var/lib/apt/lists/*

ADD --chmod=0755 https://github.com/mlocati/docker-php-extension-installer/releases/latest/download/install-php-extensions /usr/local/bin/

RUN install-php-extensions bcmath exif gettext gd imagick mbstring openssl pcntl pdo pdo_mysql sockets ${XDEBUG_VERSION} zip json
RUN install-php-extensions bcmath exif gettext gd imagick mbstring openssl pcntl pdo pdo_mysql sockets ${XDEBUG_VERSION} zip

# XDEBUG
COPY docker-compose/php/docker-php-ext-xdebug.ini $PHP_DIR/conf.d/docker-php-ext-xdebug.ini
Expand All @@ -44,6 +60,6 @@ RUN echo 'memory_limit = 1024M' >> $PHP_INI_DIR/php.ini;
WORKDIR /var/www
COPY . /var/www
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer

RUN git config --global --add safe.directory /var/www
RUN composer config -g github-oauth.github.com $GITHUB_OAUTH_TOKEN
RUN chmod 777 -R storage
48 changes: 48 additions & 0 deletions Libs/Utils/Doctrine/DoctrineStatementValueBinder.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<?php namespace Libs\Utils\Doctrine;
/*
* Copyright 2024 OpenStack Foundation
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
**/
use Doctrine\DBAL\ParameterType;
use Doctrine\DBAL\Statement;
/**
* Class DoctrineStatementValueBinder
* @package Libs\Utils\Doctrine
*/
final class DoctrineStatementValueBinder
{
/**
* @param $param
* @return int
*/
public static function inferParamType($param):int
{
if(is_int($param)) return ParameterType::INTEGER;
if(is_bool($param)) return ParameterType::BOOLEAN;
if(is_string($param)) return ParameterType::STRING;
if(is_array($param)) return ParameterType::INTEGER;
return ParameterType::STRING;
}

/**
* @param Statement $stmt
* @param array $params
* @return Statement
* @throws \Doctrine\DBAL\Exception
*/
public static function bind(Statement $stmt, array $params):Statement
{
foreach ($params as $key => $value) {
$stmt->bindValue($key, $value, self::inferParamType($value));
}
return $stmt;
}
}
2 changes: 1 addition & 1 deletion Libs/Utils/Doctrine/EscapingQuoteStrategy.php
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,6 @@ public function getColumnAlias($columnName, $counter, AbstractPlatform $platform
$columnName = preg_replace('/[^A-Za-z0-9_]/', '', $columnName);
$columnName = is_numeric($columnName) ? '_'.$columnName : $columnName;

return $platform->getSQLResultCasing($columnName);
return $columnName;
}
}
Loading