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 45 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
94cd54c
feat: add new endpoint upgrade event
smarcet Aug 13, 2024
ab71a03
feat: promote summit event 2 presentation
smarcet Aug 13, 2024
1bcd05b
feat: promote summit event 2 presentation
smarcet Aug 13, 2024
a5da23b
refactor: update composer packages and PHP version
romanetar Jun 3, 2024
84f495d
refactor: file providers
romanetar Jun 6, 2024
33266c8
chore: docker dev env setup
romanetar Jun 6, 2024
a7b8274
refactor: write exceptions
romanetar Jun 6, 2024
ba7a355
fix: php version tweak
romanetar Jun 6, 2024
5926679
chore: test data insert tweaks
romanetar Jun 6, 2024
0235283
refactor: proxied Message methods
romanetar Jun 6, 2024
7146a6f
refactor: trusted proxy middleware
romanetar Jun 6, 2024
1a18f32
chore: docker dev environment setup
romanetar Jun 6, 2024
9c40db5
fix: review issues
romanetar Jun 7, 2024
81c589f
chore: update sendgrid adapter lib
romanetar Jun 11, 2024
b3f9bd8
Delete package.xml
romanetar Jun 11, 2024
32de879
chore: fix on test
smarcet Jun 18, 2024
2cbf682
chore: updated docker file to php 8.3
smarcet Jun 19, 2024
a4dcadf
fix: migrated int to boolean on criteria query ( we should check on a…
smarcet Jun 19, 2024
e109f21
chore: fixed summit api unit tests
smarcet Jun 20, 2024
585b894
fix: summit lead report settings
smarcet Jun 20, 2024
792f63a
chore: improved memory usage of unit tests
smarcet Jun 20, 2024
c771c04
chore: remove fruitcake/laravel-cors
smarcet Jun 20, 2024
142fca8
chore: add github action to run unit test on push
smarcet Jun 20, 2024
16ae275
chore: added missing config variables to github action
smarcet Jun 20, 2024
f0f0f8c
chore: fixing unit tests
smarcet Jun 20, 2024
b5a9091
fix: removed Fruitcake\\Cors\\HandleCors ref
smarcet Jun 20, 2024
b16960d
fix: api config seed
smarcet Jun 20, 2024
2dd984a
chore: update sql mode on github action
smarcet Jun 20, 2024
ff1bf39
chore: updated redis cache ns
smarcet Jun 20, 2024
7963b1a
refactor: Criteria boolean filter values (#270)
romanetar Jun 24, 2024
89f0214
Delete .env.dev
smarcet Jun 25, 2024
6800391
fix: unit test from main rebase
smarcet Jun 27, 2024
06c8d70
chore: migration to LV 10.x
smarcet Jun 27, 2024
676ff55
chore: Replace doctrine's deprecated fetchAll() with the new methods
smarcet Jun 27, 2024
7cfd363
chore: update doctrine cmd fix
smarcet Jun 28, 2024
7fd65e5
fix: upgrade doctrine queries
smarcet Jun 28, 2024
b9e5d68
chore: update github action
smarcet Jun 28, 2024
87819e9
chore: updated deps for LV 11.x
smarcet Jun 28, 2024
ac0d329
chore: fix unit test for phpunit 11.x
smarcet Jun 28, 2024
e9cfaee
chore: fix github action
smarcet Jun 28, 2024
48f157b
chore: renamed file
smarcet Jun 28, 2024
01243d0
fix: rate limiter param
smarcet Jul 1, 2024
a889dd9
fix: replace doctrine deprecated methods fetchColum by fetchOne
smarcet Aug 6, 2024
759246a
chore: add missing SQL logger
smarcet Aug 13, 2024
3a40760
chore: migrate orm deprecated methods
smarcet Aug 13, 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: smarcet@gmail.com
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/redis-github-action@1.7.0
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://github.com/raw/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