Skip to content

Commit

Permalink
Add GitHub CI.
Browse files Browse the repository at this point in the history
  • Loading branch information
kohler committed Dec 10, 2021
1 parent 418ace0 commit 80a1a9b
Show file tree
Hide file tree
Showing 5 changed files with 82 additions and 6 deletions.
76 changes: 76 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
name: Tests

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

jobs:
build:
runs-on: ubuntu-latest

strategy:
matrix:
php-versions: ['7.0', '7.1', '7.2', '7.3', '7.4', '8.0']

steps:
- name: Checkout
uses: actions/checkout@v2

- name: Start mysql
run: |
(echo '[mysqld]'; echo 'default-authentication-plugin=mysql_native_password') | sudo sh -c "cat > /etc/mysql/conf.d/nativepassword.cnf"
sudo /etc/init.d/mysql start
mysql -V
- name: Prepare the application
run: |
sudo lib/createdb.sh -u root -proot -c test/options.php --batch
sudo lib/createdb.sh -u root -proot -c test/cdb-options.php --no-dbuser --batch
- name: Set up PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
extensions: mbstring, intl, mysqlnd

- name: Install poppler
run: sudo apt-get install poppler-utils

- name: Run tests
run: sh test/check.sh

build-18:
runs-on: ubuntu-18.04

strategy:
matrix:
php-versions: ['7.3', '8.0']

steps:
- name: Checkout
uses: actions/checkout@v2

- name: Start mysql
run: |
(echo '[mysqld]'; echo 'default-authentication-plugin=mysql_native_password') | sudo sh -c "cat > /etc/mysql/conf.d/nativepassword.cnf"
sudo /etc/init.d/mysql start
mysql -V
- name: Prepare the application
run: |
sudo lib/createdb.sh -u root -proot -c test/options.php --batch
sudo lib/createdb.sh -u root -proot -c test/cdb-options.php --no-dbuser --batch
- name: Set up PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
extensions: mbstring, intl, mysqlnd

- name: Install poppler
run: sudo apt-get install poppler-utils

- name: Run tests
run: sh test/check.sh
2 changes: 1 addition & 1 deletion .htaccess
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ AddDefaultCharset UTF-8
DirectoryIndex index.php

# Prevent access to SCM directory, logs, test, README, regardless of case.
RedirectMatch 403 ^.*/(\.[Gg][Ii][Tt].*|\.[Mm][Yy].*|[Rr][Ee][Aa][Dd][Mm][Ee].*|[Ff][Ii][Ll][Ee][Ss][Tt][Oo][Rr][Ee]|[Dd][Oo][Cc][Ss]|[Cc][Oo][Nn][Ff]|[Cc][Oo][Dd][Ee]|[Ll][Oo][Gg][Ss])($|/.*$)
RedirectMatch 403 ^.*/(\..*|[Rr][Ee][Aa][Dd][Mm][Ee].*|[Ff][Ii][Ll][Ee][Ss][Tt][Oo][Rr][Ee]|[Dd][Oo][Cc][Ss]|[Cc][Oo][Nn][Ff]|[Cc][Oo][Dd][Ee]|[Ll][Oo][Gg][Ss])($|/.*$)

# Don't use MultiViews, which can conflict with mod_rewrite suffixless URLs.
Options -MultiViews
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
HotCRP Conference Review Software [![Build Status](https://travis-ci.com/kohler/hotcrp.svg?branch=master)](https://travis-ci.com/kohler/hotcrp)
HotCRP Conference Review Software [![Build Status](https://github.com/kohler/hotcrp/actions/workflows/tests.yml/badge.svg)](https://github.com/kohler/hotcrp/actions/workflows/tests.yml)
=================================

HotCRP is awesome software for managing review processes, especially for
Expand Down
6 changes: 3 additions & 3 deletions lib/dbl.php
Original file line number Diff line number Diff line change
Expand Up @@ -154,14 +154,14 @@ static function connect_dsn($dsn, $noconnect = false) {
global $Opt;

$dbhost = $dbuser = $dbpass = $dbname = $dbport = null;
if ($dsn && preg_match('|^mysql://([^:@/]*)/(.*)|', $dsn, $m)) {
if ($dsn && preg_match('/^mysql:\/\/([^:@\/]*)\/(.*)/', $dsn, $m)) {
$dbhost = urldecode($m[1]);
$dbname = urldecode($m[2]);
} else if ($dsn && preg_match('|^mysql://([^:@/]*)@([^/]*)/(.*)|', $dsn, $m)) {
} else if ($dsn && preg_match('/^mysql:\/\/([^:@\/]*)@([^\/]*)\/(.*)/', $dsn, $m)) {
$dbhost = urldecode($m[2]);
$dbuser = urldecode($m[1]);
$dbname = urldecode($m[3]);
} else if ($dsn && preg_match('|^mysql://([^:@/]*):([^@/]*)@([^/]*)/(.*)|', $dsn, $m)) {
} else if ($dsn && preg_match('/^mysql:\/\/([^:@\/]*):([^@\/]*)@([^\/]*)\/(.*)/', $dsn, $m)) {
$dbhost = urldecode($m[3]);
$dbuser = urldecode($m[1]);
$dbpass = urldecode($m[2]);
Expand Down
2 changes: 1 addition & 1 deletion src/confinvariants.php
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ function exec_main() {

// whitespace is simplified
$regex = Dbl::utf8($this->conf->dblink, "'^ | \$| |[\\n\\r\\t]'");
$any = $this->invariantq("select email from ContactInfo where firstName regexp $regex or lastName regexp $regex or affiliation regexp $regex limit 1");
$any = $this->invariantq("select email from ContactInfo where convert(firstName using utf8mb4) regexp $regex or convert(lastName using utf8mb4) regexp $regex or convert(affiliation using utf8mb4) regexp $regex limit 1");
if ($any) {
$this->invariant_error("user_whitespace", "user whitespace is not simplified");
}
Expand Down

0 comments on commit 80a1a9b

Please sign in to comment.