Dan Marsden
4 years ago
2 changed files with 83 additions and 51 deletions
@ -0,0 +1,83 @@ |
|||
name: Run all tests |
|||
|
|||
# Run this workflow every time a new commit pushed to your repository |
|||
on: push |
|||
|
|||
jobs: |
|||
setup: |
|||
runs-on: ubuntu-latest |
|||
services: |
|||
postgres: |
|||
image: postgres:9.6 |
|||
env: |
|||
POSTGRES_USER: 'postgres' |
|||
POSTGRES_HOST_AUTH_METHOD: 'trust' |
|||
# Health check to wait for postgres to start. |
|||
ports: |
|||
- 5432:5432 |
|||
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 3 |
|||
mariadb: |
|||
image: mariadb:10 |
|||
env: |
|||
MYSQL_USER: 'root' |
|||
MYSQL_ALLOW_EMPTY_PASSWORD: "true" |
|||
ports: |
|||
- 3306:3306 |
|||
options: --health-cmd="mysqladmin ping" --health-interval 10s --health-timeout 5s --health-retries 3 |
|||
strategy: |
|||
fail-fast: false |
|||
matrix: |
|||
php-versions: ['7.3', '7.4'] |
|||
database: ['pgsql', 'mariadb'] |
|||
steps: |
|||
- name: Check out repository code |
|||
uses: actions/checkout@v2 |
|||
with: |
|||
# Clone in plugin subdir, so we can setup CI in default directory. |
|||
path: plugin |
|||
|
|||
- name: Install node |
|||
uses: actions/setup-node@v1 |
|||
with: |
|||
# TODO: Check if we can support .nvmrc |
|||
node-version: '14.15.0' |
|||
|
|||
- name: Setup PHP environment |
|||
uses: shivammathur/setup-php@v2 #https://github.com/shivammathur/setup-php |
|||
with: |
|||
php-version: ${{ matrix.php-versions }} |
|||
extensions: mbstring, pgsql, mysqli |
|||
tools: phpunit |
|||
|
|||
- name: Deploy moodle-plugin-ci |
|||
run: | |
|||
composer create-project -n --no-dev --prefer-dist moodlehq/moodle-plugin-ci ci ^3 |
|||
# Add dirs to $PATH |
|||
echo $(cd ci/bin; pwd) >> $GITHUB_PATH |
|||
echo $(cd ci/vendor/bin; pwd) >> $GITHUB_PATH |
|||
# PHPUnit depends on en_AU.UTF-8 locale |
|||
sudo locale-gen en_AU.UTF-8 |
|||
- name: Install moodle-plugin-ci |
|||
# Need explicit IP to stop mysql client fail on attempt to use unix socket. |
|||
run: moodle-plugin-ci install -vvv --plugin ./plugin --db-host=127.0.0.1 |
|||
env: |
|||
DB: ${{ matrix.database }} |
|||
# TODO: Omitted MOODLE_BRANCH results in regex failure, investigate. |
|||
MOODLE_BRANCH: 'master' |
|||
|
|||
- name: Run Integration tests |
|||
run: | |
|||
# Currently it stops if any command return non 0 exit status, needs a |
|||
# wrapper to collect exit statuses and list result and the end. |
|||
# For testing purposes at this stage, just assume each command succeeds. |
|||
moodle-plugin-ci phplint || true |
|||
moodle-plugin-ci phpcpd || true |
|||
moodle-plugin-ci phpmd || true |
|||
moodle-plugin-ci codechecker || true |
|||
moodle-plugin-ci validate || true |
|||
moodle-plugin-ci savepoints || true |
|||
moodle-plugin-ci mustache || true |
|||
moodle-plugin-ci grunt || true |
|||
moodle-plugin-ci phpdoc || true |
|||
moodle-plugin-ci phpunit || true |
|||
moodle-plugin-ci behat || true |
@ -1,51 +0,0 @@ |
|||
language: php |
|||
|
|||
addons: |
|||
postgresql: "9.6" |
|||
|
|||
services: |
|||
- mysql |
|||
- postgresql |
|||
- docker |
|||
|
|||
cache: |
|||
directories: |
|||
- $HOME/.composer/cache |
|||
- $HOME/.npm |
|||
|
|||
php: |
|||
- 7.2 |
|||
- 7.4 |
|||
|
|||
env: |
|||
global: |
|||
- MOODLE_BRANCH=master |
|||
- MUSTACHE_IGNORE_NAMES=mobile_teacher_form.mustache |
|||
matrix: |
|||
- DB=pgsql |
|||
- DB=mysqli |
|||
|
|||
before_install: |
|||
- phpenv config-rm xdebug.ini |
|||
- nvm install 14.0.0 |
|||
- nvm use 14.0.0 |
|||
- cd ../.. |
|||
- composer create-project -n --no-dev --prefer-dist moodlehq/moodle-plugin-ci ci ^3 |
|||
- export PATH="$(cd ci/bin; pwd):$(cd ci/vendor/bin; pwd):$PATH" |
|||
|
|||
install: |
|||
- moodle-plugin-ci install |
|||
- docker run -d -p 127.0.0.1:4444:4444 --net=host --shm-size=2g -v $HOME/build/moodle:$HOME/build/moodle selenium/standalone-chrome:3 |
|||
|
|||
script: |
|||
- moodle-plugin-ci phplint |
|||
- moodle-plugin-ci phpcpd |
|||
- moodle-plugin-ci phpmd |
|||
- moodle-plugin-ci codechecker |
|||
- moodle-plugin-ci validate |
|||
- moodle-plugin-ci savepoints |
|||
- moodle-plugin-ci mustache |
|||
- moodle-plugin-ci grunt |
|||
- moodle-plugin-ci phpdoc |
|||
- moodle-plugin-ci phpunit |
|||
- moodle-plugin-ci behat --profile chrome |
Loading…
Reference in new issue