Skip to content

Commit

Permalink
staging eosc gocbd
Browse files Browse the repository at this point in the history
Snapshot of the current changes + configuration for the Staging instance of EOSC GOCDB
  • Loading branch information
kkoumantaros committed Apr 11, 2024
1 parent f4f83e3 commit d3389ce
Show file tree
Hide file tree
Showing 37 changed files with 1,225 additions and 0 deletions.
14 changes: 14 additions & 0 deletions .codeclimate.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
version: "2"
plugins:
phpcodesniffer:
enabled: true
# Need the beta channel to enforce PSR12,
# see https://docs.codeclimate.com/docs/phpcodesniffer#standard.
channel: "beta"
config:
standard: "phpcs.xml"
phpmd:
enabled: true
config:
file_extensions: "php"
rulesets: "phpmd.xml"
48 changes: 48 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# This file sets the default file normalisation behavior,
# and is useful in case people don't have 'core.autocrlf' config variable set.
# (When a text file is normalized, its line endings are converted to LF in the repo).
# https://help.github.com/articles/dealing-with-line-endings/#platform-all

# The 'core.autocrlf = true' is a config variable: set to true on Windows, input on *nix.
# Note, this does not force normalization of all text files, but does ensure that NEW
# text files that you introduce to the repo have their line endings normalized to LF
# when they are added, and that files that are already normalized in the repo stay normalized as LF.
# It will NOT normalise files existing in the repo that have CLRF endings !

# To automatically normalize line endings to LF for all text-based files
# and convert to NATIVE endings on checkout, use '* text=auto'
# https://git-scm.com/docs/gitattributes#_end_of_line_conversion

* text=auto

# Refreshing a repo to re-normalise:
# When text=auto normalization is enabled in an already EXISTING repository, any text
# files containing CRLFs in the repo need to be newly normalized! If they are not they will
# be normalized the next time someone tries to change them, causing unfortunate misattribution.
# To force a normalisation of all text files, see recipes at:
# https://git-scm.com/docs/gitattributes#_end_of_line_conversion
# https://help.github.com/articles/dealing-with-line-endings/#platform-all
# Or use a tool like eclipse to change all CRLFs to LFs and commit the file.

# To explicitly declare text files you want to always be normalized and converted
# to NATIVE line endings on checkout:
*.c text
*.h text
*.php text
*.xml text
*.txt text
*.xsd text
*.md text

# The eol attribute sets a specific line-ending style to be used in the WORKING DIRECTORY:

# To normalize line endings to LF on checkin but prevent conversion to CRLF on checkout:
#*.css text eol=lf

# To normalize line endings for this file on checkin and convert them to CRLF on checkout:
#*.sln text eol=crlf

# Denote all files that are truly binary and should not be modified.
*.png binary
*.jpg binary
*.gif binary
27 changes: 27 additions & 0 deletions .github/actions/mysql_bootstrap_doctrine.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?php
// bootstrap_doctrine.php

// See :doc:`Configuration <../reference/configuration>` for up to date autoloading details.
use Doctrine\ORM\Tools\Setup;
use Doctrine\Common\EventManager;
use Doctrine\DBAL\Event\Listeners\OracleSessionInit;

require_once __DIR__."/../../vendor/autoload.php";

// Create a simple "default" Doctrine ORM configuration for XML Mapping
$isDevMode = true;
$config = Setup::createAnnotationMetadataConfiguration(array(__DIR__."/../../lib/Doctrine/entities"), $isDevMode);

$conn = array(
'driver' => 'pdo_mysql',
'user' => 'user',
'password' => 'password',
'host' => '172.18.0.1',
'dbname' => 'doctrine',
'charset' => 'UTF8'
);

$evm = new EventManager();

// obtaining the entity manager
$entityManager = \Doctrine\ORM\EntityManager::create($conn, $config, $evm);
20 changes: 20 additions & 0 deletions .github/actions/mysql_bootstrap_pdo.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?php

/**
* Provides a connection to the test database. Copy this file and rename it
* to 'bootstrap_pdo.php' in the same directory.
* The DBUnit tests then require these methods to get a connection to the
* test db.
*
* @author David Meredith
*/

/**
* Returns the database connection to your test databse.
* Modify as required to return a connection to your test db.
* @return PHPUnit_Extensions_Database_DB_IDatabaseConnection
*/
function getConnectionToTestDB() {
$pdo = new PDO('mysql:host=172.18.0.1;dbname=doctrine;charset=UTF8', 'user', 'password');
return new PHPUnit_Extensions_Database_DB_DefaultDatabaseConnection($pdo);
}
12 changes: 12 additions & 0 deletions .github/actions/run_tests.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/bash

if [[ $GITHUB_ACTIONS ]]; then
# Check modified PHP files with PHP's internal syntax checker
git diff --name-only --diff-filter=ACMRTUXB HEAD^ | grep '\.php$' | xargs -r -n 1 php -l || exit 1

# Run test suite
vendor/bin/phpunit -c tests/phpunit.xml --coverage-clover=coverage.xml tests/DoctrineTestSuite1.php
else
echo 'ABORTED: NOT RUNNING ON GITHUB ACTIONS'
exit 2
fi
17 changes: 17 additions & 0 deletions .github/actions/setup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/bash

doctrine="$PWD/vendor/bin/doctrine"

if [[ -n "$DB" ]]; then
echo "Configuring unit tests for a $DB database"
cp .github/actions/${DB}_bootstrap_doctrine.php tests/doctrine/bootstrap_doctrine.php
cp .github/actions/${DB}_bootstrap_pdo.php tests/doctrine/bootstrap_pdo.php
cd tests/doctrine
$doctrine orm:schema-tool:create
if [[ "$DB" = "mysql" ]]; then
mysql --host '172.18.0.1' -u root -e 'set global max_connections = 200;'
fi
else
echo 'Cannot setup unit tests, $DB is not defined.'
exit 1
fi
22 changes: 22 additions & 0 deletions .github/actions/sqlite_bootstrap_doctrine.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php
// bootstrap_doctrine.php

// See :doc:`Configuration <../reference/configuration>` for up to date autoloading details.
use Doctrine\ORM\Tools\Setup;
use Doctrine\Common\EventManager;
use Doctrine\DBAL\Event\Listeners\OracleSessionInit;

require_once __DIR__."/../../vendor/autoload.php";

// Create a simple "default" Doctrine ORM configuration for XML Mapping
$isDevMode = true;
$config = Setup::createAnnotationMetadataConfiguration(array(__DIR__."/../../lib/Doctrine/entities"), $isDevMode);

$conn = array(
'driver' => 'pdo_sqlite',
'path' => '/tmp/gocdb.sqlite',
);

$evm = new EventManager();

$entityManager = \Doctrine\ORM\EntityManager::create($conn, $config, $evm);
23 changes: 23 additions & 0 deletions .github/actions/sqlite_bootstrap_pdo.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?php

/**
* Provides a connection to the test database. Copy this file and rename it
* to 'bootstrap_pdo.php' in the same directory.
* The DBUnit tests then require these methods to get a connection to the
* test db.
*
* @author David Meredith
*/

/**
* Returns the database connection to your test databse.
* Modify as required to return a connection to your test db.
* @return PHPUnit_Extensions_Database_DB_IDatabaseConnection
*/
function getConnectionToTestDB() {
$sqliteFile = '/tmp/gocdb.sqlite';
$pdo = new PDO("sqlite:" . $sqliteFile);
return new PHPUnit_Extensions_Database_DB_DefaultDatabaseConnection($pdo, 'sqlite');
}

?>
9 changes: 9 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
version: 2
updates:

- package-ecosystem: "github-actions"
# For GitHub Actions, "/" checks for workflow files in .github/workflows.
directory: "/"
schedule:
# By default, this is on Monday.
interval: "weekly"
85 changes: 85 additions & 0 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
name: "Continuous Integration"

on: [push, pull_request]

jobs:

phpunit-mariadb:
name: "PHPUnit with MariaDB: ${{ matrix.mariadb-version }}, PHP: ${{ matrix.php-version }}, extension: ${{ matrix.extension }}"
runs-on: ubuntu-latest
strategy:
# If true, stop jobs if a required job fails:
fail-fast: false
matrix:
# Define jobs for all combinations of php, mariadb and extension, up to "include"
# Tests will be performed for each combination
php-version: ["5.4", "5.5", "5.6", "7.0", "7.1", "7.4"]
mariadb-version: ["10.3"]
extension: ["pdo_mysql"]
include:
- php-version: "5.4"
composer-json: "composer-5.4.json"
- php-version: "5.5"
composer-json: "composer-5.4.json"
- php-version: "5.6"
composer-json: "composer-5.4.json"
- php-version: "7.0"
composer-json: "composer-5.4.json"
- php-version: "7.1"
composer-json: "composer-5.4.json"
- php-version: "7.4"
composer-json: "composer.json"

services:
mariadb:
image: "mariadb:${{ matrix.mariadb-version }}"
env:
MYSQL_ALLOW_EMPTY_PASSWORD: yes
MYSQL_DATABASE: "doctrine"
MYSQL_USER: "user"
MYSQL_PASSWORD: "password"

options: --health-cmd="mysqladmin ping" --health-interval=5s --health-timeout=2s --health-retries=3
ports:
- "3306:3306"

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: "xdebug"
extensions: "${{ matrix.extension }}"

- name: Validate composer.json and composer.lock
run: composer validate

- name: Cache Composer packages
id: composer-cache
uses: actions/cache@v4
with:
path: vendor
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-php-
- name: Install dependencies
env:
COMPOSER: ${{ matrix.composer-json }}
run: composer install --no-progress

- name: Set up unit testing
run: .github/actions/setup.sh
env:
DB: mysql

- name: Run unit tests
run: .github/actions/run_tests.sh

- name: "Upload to Codecov"
uses: "codecov/codecov-action@v4"
97 changes: 97 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@

# Generic
=====================
*~

# Project specific
# ====================
aup.pdf
bootstrap_doctrine.php
bootstrap_pdo.php
bootstrap_doctrine_mysql.php
bootstrap_doctrine_oracle.php
vendor/
compiledEntities/
composer.phar
composer.bat
composer
gocdb.log
tests/coverageReports/
privacy.pdf
/.htaccess

# Eclipse: https://github.com/github/gitignore/blob/master/Global/Eclipse.gitignore
# =====================
.metadata
bin/
tmp/
*.tmp
*.bak
*.swp
*~.nib
local.properties
.settings/
.loadpath

# Eclipse Core
.project

# External tool builders
.externalToolBuilders/

# Locally stored "Eclipse launch configurations"
*.launch

# PyDev specific (Python IDE for Eclipse)
*.pydevproject

# CDT-specific (C/C++ Development Tooling)
.cproject

# JDT-specific (Eclipse Java Development Tools)
.classpath

# Java annotation processor (APT)
.factorypath

# PDT-specific (PHP Development Tools)
.buildpath

# sbteclipse plugin
.target

# Tern plugin
.tern-project

# TeXlipse plugin
.texlipse

# STS (Spring Tool Suite)
.springBeans

# Code Recommenders
.recommenders/



# Netbeans: https://github.com/github/gitignore/blob/master/Global/NetBeans.gitignore
# =====================
nbproject/
nbproject/private/
build/
nbbuild/
dist/
nbdist/
nbactions.xml
nb-configuration.xml

#PhpStorm
#================
*.iml
.idea/

#wamp
#==============
error.log
transfer.log
Composer-Setup.exe
1 change: 1 addition & 0 deletions .gitold/HEAD
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ref: refs/heads/dev
11 changes: 11 additions & 0 deletions .gitold/config
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
[remote "origin"]
url = https://github.com/GOCDB/gocdb.git
fetch = +refs/heads/*:refs/remotes/origin/*
[branch "dev"]
remote = origin
merge = refs/heads/dev
Loading

0 comments on commit d3389ce

Please sign in to comment.