mirror of
https://github.com/LdesignMedia/moodle-availability_ipaddress.git
synced 2026-05-16 21:41:28 +02:00
add github workflow moodle-release
This commit is contained in:
123
.github/workflows/ci.yml
vendored
Normal file
123
.github/workflows/ci.yml
vendored
Normal file
@@ -0,0 +1,123 @@
|
||||
name: Moodle Plugin CI
|
||||
|
||||
on: [ push, pull_request ]
|
||||
|
||||
jobs:
|
||||
test:
|
||||
runs-on: ubuntu-18.04
|
||||
|
||||
services:
|
||||
postgres:
|
||||
image: postgres:10
|
||||
env:
|
||||
POSTGRES_USER: 'postgres'
|
||||
POSTGRES_HOST_AUTH_METHOD: 'trust'
|
||||
ports:
|
||||
- 5432:5432
|
||||
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 3
|
||||
mariadb:
|
||||
image: mariadb:10.5
|
||||
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:
|
||||
include:
|
||||
- php: '7.4'
|
||||
moodle-branch: 'MOODLE_311_STABLE'
|
||||
database: pgsql
|
||||
- php: '7.4'
|
||||
moodle-branch: 'MOODLE_310_STABLE'
|
||||
database: mariadb
|
||||
- php: '7.3'
|
||||
moodle-branch: 'MOODLE_39_STABLE'
|
||||
database: pgsql
|
||||
|
||||
steps:
|
||||
- name: Check out repository code
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
path: plugin
|
||||
|
||||
- name: Setup PHP ${{ matrix.php }}
|
||||
uses: shivammathur/setup-php@v2
|
||||
with:
|
||||
php-version: ${{ matrix.php }}
|
||||
extensions: ${{ matrix.extensions }}
|
||||
ini-values: max_input_vars=5000
|
||||
coverage: none
|
||||
|
||||
- name: Initialise moodle-plugin-ci
|
||||
run: |
|
||||
composer create-project -n --no-dev --prefer-dist moodlehq/moodle-plugin-ci ci ^3
|
||||
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
|
||||
run: |
|
||||
moodle-plugin-ci install --plugin ./plugin --db-host=127.0.0.1
|
||||
env:
|
||||
DB: ${{ matrix.database }}
|
||||
MOODLE_BRANCH: ${{ matrix.moodle-branch }}
|
||||
|
||||
- name: PHP Lint
|
||||
if: ${{ always() }}
|
||||
run: moodle-plugin-ci phplint
|
||||
|
||||
- name: PHP Copy/Paste Detector
|
||||
continue-on-error: true # This step will show errors but will not fail
|
||||
if: ${{ always() }}
|
||||
run: moodle-plugin-ci phpcpd
|
||||
|
||||
- name: PHP Mess Detector
|
||||
continue-on-error: true # This step will show errors but will not fail
|
||||
if: ${{ always() }}
|
||||
run: moodle-plugin-ci phpmd
|
||||
|
||||
- name: Moodle Code Checker
|
||||
if: ${{ always() }}
|
||||
run: moodle-plugin-ci codechecker --max-warnings 0
|
||||
|
||||
- name: Moodle PHPDoc Checker
|
||||
if: ${{ always() }}
|
||||
run: moodle-plugin-ci phpdoc
|
||||
|
||||
- name: Validating
|
||||
if: ${{ always() }}
|
||||
run: moodle-plugin-ci validate
|
||||
|
||||
- name: Check upgrade savepoints
|
||||
if: ${{ always() }}
|
||||
run: moodle-plugin-ci savepoints
|
||||
|
||||
- name: Mustache Lint
|
||||
if: ${{ always() }}
|
||||
run: moodle-plugin-ci mustache
|
||||
|
||||
- name: Grunt
|
||||
continue-on-error: true # This step will show errors but will not fail
|
||||
if: ${{ always() }}
|
||||
run: moodle-plugin-ci grunt --max-lint-warnings 0
|
||||
|
||||
- name: PHPUnit tests
|
||||
if: ${{ always() }}
|
||||
run: moodle-plugin-ci phpunit
|
||||
|
||||
- name: Core privacy tests
|
||||
if: ${{ always() }}
|
||||
run: |
|
||||
cd moodle
|
||||
php admin/tool/phpunit/cli/init.php
|
||||
vendor/bin/phpunit --fail-on-risky --disallow-test-output -v --filter tool_dataprivacy_metadata_registry_testcase
|
||||
vendor/bin/phpunit --fail-on-risky --disallow-test-output -v --filter provider_testcase
|
||||
|
||||
- name: Behat features
|
||||
if: ${{ always() }}
|
||||
run: moodle-plugin-ci behat --profile chrome
|
||||
66
.github/workflows/moodle-release.yml
vendored
Normal file
66
.github/workflows/moodle-release.yml
vendored
Normal file
@@ -0,0 +1,66 @@
|
||||
#
|
||||
# Whenever a new tag is pushed, add the tagged version
|
||||
# to the Moodle Plugins directory at https://moodle.org/plugins
|
||||
#
|
||||
# revision: 2021070201
|
||||
#
|
||||
name: Releasing in the Plugins directory
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- '*'
|
||||
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
tag:
|
||||
description: 'Tag to be released'
|
||||
required: true
|
||||
|
||||
defaults:
|
||||
run:
|
||||
shell: bash
|
||||
|
||||
jobs:
|
||||
release-at-moodle-org:
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
PLUGIN: availability_ipaddress
|
||||
CURL: curl -s
|
||||
ENDPOINT: https://moodle.org/webservice/rest/server.php
|
||||
TOKEN: ${{ secrets.MOODLE_ORG_TOKEN }}
|
||||
FUNCTION: local_plugins_add_version
|
||||
|
||||
steps:
|
||||
- name: Call the service function
|
||||
id: add-version
|
||||
run: |
|
||||
if [[ ! -z "${{ github.event.inputs.tag }}" ]]; then
|
||||
TAGNAME="${{ github.event.inputs.tag }}"
|
||||
elif [[ $GITHUB_REF = refs/tags/* ]]; then
|
||||
TAGNAME="${GITHUB_REF##*/}"
|
||||
fi
|
||||
if [[ -z "${TAGNAME}" ]]; then
|
||||
echo "No tag name has been provided!"
|
||||
exit 1
|
||||
fi
|
||||
ZIPURL="https://api.github.com/repos/${{ github.repository }}/zipball/${TAGNAME}"
|
||||
RESPONSE=$(${CURL} ${ENDPOINT} --data-urlencode "wstoken=${TOKEN}" \
|
||||
--data-urlencode "wsfunction=${FUNCTION}" \
|
||||
--data-urlencode "moodlewsrestformat=json" \
|
||||
--data-urlencode "frankenstyle=${PLUGIN}" \
|
||||
--data-urlencode "zipurl=${ZIPURL}" \
|
||||
--data-urlencode "vcssystem=git" \
|
||||
--data-urlencode "vcsrepositoryurl=${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}" \
|
||||
--data-urlencode "vcstag=${TAGNAME}" \
|
||||
--data-urlencode "changelogurl=${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/commits/${TAGNAME}" \
|
||||
--data-urlencode "altdownloadurl=${ZIPURL}")
|
||||
echo "::set-output name=response::${RESPONSE}"
|
||||
|
||||
- name: Evaluate the response
|
||||
id: evaluate-response
|
||||
env:
|
||||
RESPONSE: ${{ steps.add-version.outputs.response }}
|
||||
run: |
|
||||
jq <<< ${RESPONSE}
|
||||
jq --exit-status ".id" <<< ${RESPONSE} > /dev/null
|
||||
50
.travis.yml
50
.travis.yml
@@ -1,50 +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=MOODLE_310_STABLE
|
||||
matrix:
|
||||
- DB=pgsql
|
||||
- DB=mysqli
|
||||
|
||||
before_install:
|
||||
- phpenv config-rm xdebug.ini
|
||||
- nvm install 14 # moodle-plugin-ci still uses 8.9, but Moodle core switched to 14 in MDL-66109.
|
||||
- nvm use 14
|
||||
- cd ../..
|
||||
- composer create-project -n --no-dev --prefer-dist blackboard-open-source/moodle-plugin-ci ci dev-master
|
||||
- export PATH="$(cd ci/bin; pwd):$(cd ci/vendor/bin; pwd):$PATH"
|
||||
#- docker run -d -p 127.0.0.1:4444:4444 --net=host -v /dev/shm:/dev/shm selenium/standalone-chrome:3
|
||||
|
||||
install:
|
||||
- moodle-plugin-ci install
|
||||
|
||||
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 --dump
|
||||
Reference in New Issue
Block a user