CI #1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# src: https://moodlehq.github.io/moodle-plugin-ci | |
name: CI | |
on: | |
workflow_call: | |
inputs: | |
accessibility-branch: | |
description: Branch of accessibility plugin | |
type: string | |
default: master | |
widget-backgroundcolour-branch: | |
description: Branch of background colour widget, latest release will be used if not provided | |
type: string | |
default: '' | |
widget-fontface-branch: | |
description: Branch of font face widget, latest release will be used if not provided | |
type: string | |
default: '' | |
widget-fontsize-branch: | |
description: Branch of font size widget, latest release will be used if not provided | |
type: string | |
default: '' | |
widget-textcolour-branch: | |
description: Branch of text colour widget, latest release will be used if not provided | |
type: string | |
default: '' | |
outputs: | |
widget-backgroundcolour-branch: | |
description: Branch of background colour widget | |
value: ${{ jobs.set-widget-versions.outputs.widget-backgroundcolour-branch }} | |
widget-fontface-branch: | |
description: Branch of font face widget | |
value: ${{ jobs.set-widget-versions.outputs.widget-fontface-branch }} | |
widget-fontsize-branch: | |
description: Branch of font size widget | |
value: ${{ jobs.set-widget-versions.outputs.widget-fontsize-branch }} | |
widget-textcolour-branch: | |
description: Branch of text colour widget | |
value: ${{ jobs.set-widget-versions.outputs.widget-textcolour-branch }} | |
workflow_dispatch: | |
inputs: | |
accessibility-branch: | |
description: Branch of accessibility plugin | |
type: string | |
default: master | |
widget-backgroundcolour-branch: | |
description: Branch of background colour widget, latest release will be used if not provided | |
type: string | |
default: '' | |
widget-fontface-branch: | |
description: Branch of font face widget, latest release will be used if not provided | |
type: string | |
default: '' | |
widget-fontsize-branch: | |
description: Branch of font size widget, latest release will be used if not provided | |
type: string | |
default: '' | |
widget-textcolour-branch: | |
description: Branch of text colour widget, latest release will be used if not provided | |
type: string | |
default: '' | |
jobs: | |
default-widget-versions: | |
name: Get default widget versions | |
uses: ./.github/workflows/default-widget-versions.yml | |
set-widget-versions: | |
name: Set widget versions | |
needs: default-widget-versions | |
runs-on: ubuntu-latest | |
outputs: | |
widget-backgroundcolour-branch: ${{ steps.get-widgets.outputs.WIDGET-BACKGROUNDCOLOUR-BRANCH }} | |
widget-fontface-branch: ${{ steps.get-widgets.outputs.WIDGET-FONTFACE-BRANCH }} | |
widget-fontsize-branch: ${{ steps.get-widgets.outputs.WIDGET-FONTSIZE-BRANCH }} | |
widget-textcolour-branch: ${{ steps.get-widgets.outputs.WIDGET-TEXTCOLOUR-BRANCH }} | |
steps: | |
- id: get-widgets | |
run: | | |
echo WIDGET-BACKGROUNDCOLOUR-BRANCH="${{ inputs.widget-backgroundcolour-branch || needs.default-widget-versions.outputs.widget-backgroundcolour-branch }}" | |
echo WIDGET-FONTFACE-BRANCH="${{ inputs.widget-fontface-branch || needs.default-widget-versions.outputs.widget-fontface-branch }}" | |
echo WIDGET-FONTSIZE-BRANCH="${{ inputs.widget-fontsize-branch || needs.default-widget-versions.outputs.widget-fontsize-branch }}" | |
echo WIDGET-TEXTCOLOUR-BRANCH="${{ inputs.widget-textcolour-branch || needs.default-widget-versions.outputs.widget-textcolour-branch }}" | |
echo WIDGET-BACKGROUNDCOLOUR-BRANCH="${{ inputs.widget-backgroundcolour-branch || needs.default-widget-versions.outputs.widget-backgroundcolour-branch }}" >> $GITHUB_OUTPUT | |
echo WIDGET-FONTFACE-BRANCH="${{ inputs.widget-fontface-branch || needs.default-widget-versions.outputs.widget-fontface-branch }}" >> $GITHUB_OUTPUT | |
echo WIDGET-FONTSIZE-BRANCH="${{ inputs.widget-fontsize-branch || needs.default-widget-versions.outputs.widget-fontsize-branch }}" >> $GITHUB_OUTPUT | |
echo WIDGET-TEXTCOLOUR-BRANCH="${{ inputs.widget-textcolour-branch || needs.default-widget-versions.outputs.widget-textcolour-branch }}" >> $GITHUB_OUTPUT | |
matrix-test: | |
name: Test ${{ (matrix.moodle == 'MOODLE_400_STABLE' && 'M4.0') || (matrix.moodle == 'MOODLE_401_STABLE' && 'M4.1') || (matrix.moodle == 'MOODLE_402_STABLE' && 'M4.2') || (matrix.moodle == 'MOODLE_403_STABLE' && 'M4.3') || matrix.moodle }} P${{ matrix.php }} ${{ matrix.db }} | |
runs-on: ubuntu-latest | |
needs: set-widget-versions | |
strategy: | |
fail-fast: true | |
matrix: | |
include: | |
- moodle: MOODLE_400_STABLE | |
php: 7.4 | |
db: mysqli | |
- moodle: MOODLE_400_STABLE | |
php: 7.4 | |
db: pgsql | |
- moodle: MOODLE_401_STABLE | |
php: 7.4 | |
db: mysqli | |
- moodle: MOODLE_401_STABLE | |
php: 7.4 | |
db: pgsql | |
- moodle: MOODLE_402_STABLE | |
php: 8.0 | |
db: mysqli | |
- moodle: MOODLE_402_STABLE | |
php: 8.0 | |
db: pgsql | |
- moodle: MOODLE_403_STABLE | |
php: 8.1 | |
db: mysqli | |
- moodle: MOODLE_403_STABLE | |
php: 8.1 | |
db: pgsql | |
services: | |
mysql: | |
image: ${{ (matrix.db == 'mysqli' && 'mysql') || '' }} | |
env: | |
MYSQL_ALLOW_EMPTY_PASSWORD: true | |
MYSQL_CHARACTER_SET_SERVER: utf8mb4 | |
MYSQL_COLLATION_SERVER: utf8mb4_unicode_ci | |
ports: | |
- 3306:3306 | |
options: ${{ (matrix.db == 'mysqli' && '--health-cmd="mysqladmin ping" --health-interval 10s --health-timeout 5s --health-retries 3') || '-e SKIP=1' }} | |
postgres: | |
image: ${{ (matrix.db == 'pgsql' && 'postgres') || '' }} | |
env: | |
POSTGRES_USER: postgres | |
POSTGRES_HOST_AUTH_METHOD: trust | |
ports: | |
- 5432:5432 | |
options: ${{ (matrix.db == 'pgsql' && '--health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 3') || '-e SKIP=1' }} | |
steps: | |
- name: Checkout for Composite Actions | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.ref }} | |
sparse-checkout: .github | |
- name: Setup PHP ${{ matrix.php }} | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: ${{ matrix.php }} | |
extensions: | |
ini-values: max_input_vars=5000 | |
# If you are not using code coverage, keep "none". Otherwise, use "pcov" (Moodle 3.10 and up) or "xdebug". | |
# If you try to use code coverage with "none", it will fallback to phpdbg (which has known problems). | |
coverage: none | |
- name: Checkout Accessibility Plugin | |
uses: actions/checkout@v4 | |
with: | |
repository: ponlawat-w/moodle-local_accessibility | |
path: plugin | |
ref: ${{ inputs.accessibility-branch }} | |
- name: 'Checkout Widget: backgroundcolour' | |
uses: actions/checkout@v4 | |
with: | |
repository: ponlawat-w/moodle-accessibility_backgroundcolour | |
path: plugin/widgets/backgroundcolour | |
ref: ${{ inputs.widget-backgroundcolour-branch }} | |
- name: 'Checkout Widget: fontface' | |
uses: actions/checkout@v4 | |
with: | |
repository: ponlawat-w/moodle-accessibility_fontface | |
path: plugin/widgets/fontface | |
ref: ${{ inputs.widget-fontface-branch }} | |
- name: 'Checkout Widget: fontsize' | |
uses: actions/checkout@v4 | |
with: | |
repository: ponlawat-w/moodle-accessibility_fontsize | |
path: plugin/widgets/fontsize | |
ref: ${{ inputs.widget-fontsize-branch }} | |
- name: 'Checkout Widget: textcolour' | |
uses: actions/checkout@v4 | |
with: | |
repository: ponlawat-w/moodle-accessibility_textcolour | |
path: plugin/widgets/textcolour | |
ref: ${{ inputs.widget-textcolour-branch }} | |
- name: Initialise moodle-plugin-ci | |
shell: bash | |
run: | | |
composer create-project -n --no-dev --prefer-dist moodlehq/moodle-plugin-ci ci ^4 | |
echo $(cd ci/bin; pwd) >> $GITHUB_PATH | |
echo $(cd ci/vendor/bin; pwd) >> $GITHUB_PATH | |
sudo locale-gen en_AU.UTF-8 | |
echo "NVM_DIR=$HOME/.nvm" >> $GITHUB_ENV | |
- name: Install moodle-plugin-ci | |
shell: bash | |
run: moodle-plugin-ci install --plugin ./plugin --db-host 127.0.0.1 | |
env: | |
DB: ${{ matrix.db }} | |
MOODLE_BRANCH: ${{ matrix.moodle }} | |
- name: PHP Lint | |
if: ${{ !cancelled() }} | |
shell: bash | |
run: moodle-plugin-ci phplint -- ./moodle/local/accessibility | |
- name: PHP Copy/Paste Detector | |
continue-on-error: true # This step will show errors but will not fail | |
if: ${{ !cancelled() }} | |
shell: bash | |
run: moodle-plugin-ci phpcpd -- ./moodle/local/accessibility | |
- name: PHP Mess Detector | |
continue-on-error: true # This step will show errors but will not fail | |
if: ${{ !cancelled() }} | |
shell: bash | |
run: moodle-plugin-ci phpmd -- ./moodle/local/accessibility | |
- name: Moodle Code Checker | |
if: ${{ !cancelled() }} | |
shell: bash | |
run: moodle-plugin-ci phpcs --max-warnings 0 -- ./moodle/local/accessibility | |
- name: Moodle PHPDoc Checker | |
if: ${{ !cancelled() }} | |
shell: bash | |
run: moodle-plugin-ci phpdoc --max-warnings 0 -- ./moodle/local/accessibility | |
- name: Validating | |
if: ${{ !cancelled() }} | |
shell: bash | |
run: moodle-plugin-ci validate -- ./moodle/local/accessibility | |
- name: Check upgrade savepoints | |
if: ${{ !cancelled() }} | |
shell: bash | |
run: moodle-plugin-ci savepoints -- ./moodle/local/accessibility | |
- name: Mustache Lint | |
if: ${{ !cancelled() }} | |
shell: bash | |
run: moodle-plugin-ci mustache -- ./moodle/local/accessibility | |
- name: Grunt | |
if: ${{ !cancelled() }} | |
shell: bash | |
run: moodle-plugin-ci grunt --max-lint-warnings 0 -- ./moodle/local/accessibility | |
- name: PHPUnit tests | |
if: ${{ !cancelled() }} | |
shell: bash | |
run: moodle-plugin-ci phpunit --fail-on-warning -- ./moodle/local/accessibility | |
- name: Behat features | |
if: ${{ !cancelled() }} | |
shell: bash | |
run: moodle-plugin-ci behat --profile chrome -- ./moodle/local/accessibility | |
- name: Mark cancelled jobs as failed. | |
if: ${{ cancelled() }} | |
shell: bash | |
run: exit 1 |