Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 21 additions & 4 deletions .github/plugin/setup/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -91,21 +91,38 @@ runs:
echo "::endgroup::"
shell: bash

- name: Clone Moodle
# Clone to a temporary directory
run: |
echo "::group::Moodle clone output"

git clone https://github.com/moodle/moodle.git --branch $MOODLE_BRANCH $GITHUB_WORKSPACE/moodletemp

echo "::endgroup::"
shell: bash
env:
DB: ${{ matrix.database }}
MOODLE_BRANCH: ${{ matrix.moodle-branch }}

- name: Install Core Patches
if: ${{ always() }}
# We should attempt to install a patch, and pass if there isnt one for the branch.
# Install core patches to moodle in temporary directory
run: |
git config --global user.email "test@test.com"
git config --global user.name "Test"
((test -f plugin/patch/${{ matrix.moodle-branch }}.diff && cd moodle && git am --whitespace=nowarn < ../plugin/patch/${{ matrix.moodle-branch }}.diff) || echo No patch found;)
((test -f plugin/patch/${{ matrix.moodle-branch }}.diff && cd $GITHUB_WORKSPACE/moodletemp && git am --whitespace=nowarn < ../plugin/patch/${{ matrix.moodle-branch }}.diff) || echo No patch found;)
shell: bash

- name: Install Moodle
- name: Install Moodle and Plugin
# Install moodle, but use our temporary directory to include any potential core patches that have been applied.
run: |
# Install moodle commands
echo "::group::Moodle install output"

moodle-plugin-ci install -vvv --plugin ./plugin --db-host=127.0.0.1
# This is a workaround for https://github.com/moodlehq/moodle-plugin-ci/issues/306 - we disable the git repository validation to allow folder cloning.
sed -i '/public function gitUrl($url)/{n; s/{/& return $url;/}' $GITHUB_WORKSPACE/m-ci/src/Validate.php

moodle-plugin-ci install -vvv --plugin ./plugin --db-host=127.0.0.1 --repo $GITHUB_WORKSPACE/moodletemp

echo "::endgroup::"
shell: bash
Expand Down
16 changes: 16 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -173,3 +173,19 @@ To fix this, you'll need to rebundle the relevant files, on the <ins>highest sup
__NOTE:__ This may involve having a clean copy of Moodle and installing the plugin code to run the necessary commands to rebuild the _stale_ files.

Grunt docs: https://docs.moodle.org/dev/Grunt#Running_grunt

### Testing changes
Changes can be tested by using another plugin repository that uses these workflows.

Simply change the repository/branch it pulls from:

```yml
uses: catalyst/catalyst-moodle-workflows/.github/workflows/ci.yml@my-custom-branch
```

and specify the same branch as a `with` parameter:

```yml
with:
internal_workflow_branch: 'my-custom-branch'
```