diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 00000000..bb22a1a4 --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,73 @@ +name: test suite + +on: [push, pull_request] + +jobs: + tests: + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + php-versions: ['5.6', '7.4', '8.0'] +# php-versions: ['7.4'] + services: + mysql: + image: mysql:5.7 + env: + MYSQL_ALLOW_EMPTY_PASSWORD: false + MYSQL_ROOT_PASSWORD: 123 + MYSQL_DATABASE: gallery3_test + ports: + - 3306/tcp + options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Install OS packages + run: sudo apt-get install imagemagick graphicsmagick dcraw ffmpeg git + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php-versions }} + extensions: mbstring, gd, mysql, xml + ini-values: post_max_size=256M, max_execution_time=180 + tools: composer:v2 + + - name: Get composer cache directory + id: composer-cache + run: echo "::set-output name=dir::$(composer config cache-files-dir)" + + - name: Cache dependencies + uses: actions/cache@v2 + with: + path: ${{ steps.composer-cache.outputs.dir }} + key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} + restore-keys: ${{ runner.os }}-composer- + + - name: Install dependencies + run: composer install + + - name: create gallery3 db + run: mysql -h 127.0.0.1 --port ${{ job.services.mysql.ports['3306'] }} -u root -p123 -e 'create database gallery3;' + +# - name: Setup tmate session +# uses: mxschmitt/action-tmate@v3 + + - name: linter + run: bin/linter.sh + + - name: phpcs + run: bin/phpcs.sh + continue-on-error: true + + - name: install db + run: php ./installer/index.php + env: + MYSQL_HOST: 127.0.0.1:${{ job.services.mysql.ports['3306'] }} + MYSQL_USER: root + MYSQL_PASSWORD: 123 + + - name: tests + run: php index.php test diff --git a/installer/cli.php b/installer/cli.php index 23e22290..456d2b92 100644 --- a/installer/cli.php +++ b/installer/cli.php @@ -78,8 +78,7 @@ function oops($message) { print "==> " . $message; print "\n"; print "For help you can try:\n"; - print " * The Gallery 3 FAQ - http://codex.galleryproject.org/Gallery3:FAQ\n"; - print " * The Gallery Forums - http://galleryproject.org/forum\n"; + print " * The Gallery Group - https://groups.google.com/forum/#!forum/gallery-3-users\n"; print "\n\n** INSTALLATION FAILED **\n"; exit(1); } diff --git a/installer/installer.php b/installer/installer.php index e4d2e936..f2e513e0 100644 --- a/installer/installer.php +++ b/installer/installer.php @@ -77,7 +77,6 @@ class installer { // counterparts. if (!function_exists("mysql_query")) { function mysql_connect($host, $user, $pass) { - list ($host, $port) = explode(":", $host . ":"); installer::$mysqli = new mysqli($host, $user, $pass, $port); // http://php.net/manual/en/mysqli.connect.php says to use mysqli_connect_error() instead of // $mysqli->connect_error because of bugs before PHP 5.2.9