You can not select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
					
					
						
							224 lines
						
					
					
						
							10 KiB
						
					
					
				
			
		
		
	
	
							224 lines
						
					
					
						
							10 KiB
						
					
					
				name: PHP Composer
 | 
						|
 | 
						|
on: [push, pull_request]
 | 
						|
 | 
						|
jobs:
 | 
						|
    build:
 | 
						|
        name: PHP ${{ matrix.php-versions }} Test on ${{ matrix.operating-system }}
 | 
						|
        runs-on: ubuntu-18.04
 | 
						|
 | 
						|
        strategy:
 | 
						|
            fail-fast: false
 | 
						|
            matrix:
 | 
						|
                operating-system: [ubuntu-latest]
 | 
						|
                php-versions: ['7.4']
 | 
						|
 | 
						|
#        services:
 | 
						|
#            mysql:
 | 
						|
#                image: mysql:5.7
 | 
						|
#                env:
 | 
						|
#                    MYSQL_ALLOW_EMPTY_PASSWORD: false
 | 
						|
#                    MYSQL_ROOT_PASSWORD: chamilo
 | 
						|
#                    MYSQL_DATABASE: chamilo
 | 
						|
#                ports:
 | 
						|
#                    - 3306/tcp
 | 
						|
#                options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
 | 
						|
        steps:
 | 
						|
            - name: Checkout
 | 
						|
              uses: actions/checkout@v2
 | 
						|
 | 
						|
            - name: Setup apache
 | 
						|
              run: |
 | 
						|
                sudo apt update
 | 
						|
                sudo apt install nodejs npm apache2 php${{ matrix.php-versions }} php${{ matrix.php-versions }}-common php${{ matrix.php-versions }}-cli libapache2-mod-php${{ matrix.php-versions }}
 | 
						|
                sudo a2enmod rewrite actions
 | 
						|
                sudo cp -f tests/travis/gh-apache /etc/apache2/sites-available/000-default.conf
 | 
						|
                sudo chmod 777 -R $HOME
 | 
						|
                cat /etc/apache2/sites-available/000-default.conf
 | 
						|
                sudo service apache2 restart
 | 
						|
                sudo systemctl restart apache2                
 | 
						|
 | 
						|
            - name: Setup PHP, with composer and extensions
 | 
						|
              uses: shivammathur/setup-php@v2
 | 
						|
              with:
 | 
						|
                  php-version: ${{ matrix.php-versions }}
 | 
						|
                  extensions: mbstring, xml, ctype, iconv, intl, pdo, pdo_mysql, dom, gd, json, soap, zip, bcmath
 | 
						|
                  ini-values: post_max_size=256M, max_execution_time=600, memory_limit=4096M
 | 
						|
 | 
						|
            - name: Get composer cache directory
 | 
						|
              id: composer-cache
 | 
						|
              run: echo "::set-output name=dir::$(composer config cache-files-dir)"
 | 
						|
 | 
						|
            - name: Cache composer dependencies
 | 
						|
              uses: actions/cache@v2
 | 
						|
              with:
 | 
						|
                  path: ${{ steps.composer-cache.outputs.dir }}
 | 
						|
                  # Use composer.json for key, if composer.lock is not committed.
 | 
						|
                  # key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
 | 
						|
                  key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
 | 
						|
                  restore-keys: ${{ runner.os }}-composer-
 | 
						|
 | 
						|
            - name: Install dependencies with composer
 | 
						|
              run: composer install --prefer-dist --no-progress --optimize-autoloader
 | 
						|
 | 
						|
            - name: Install assets
 | 
						|
              run: php bin/console assets:install
 | 
						|
 | 
						|
            - name: Generate fos_js_routes.json
 | 
						|
              run: php bin/console fos:js-routing:dump --format=json --target=public/js/fos_js_routes.json
 | 
						|
 | 
						|
            - name: Install Yarn
 | 
						|
              run: |
 | 
						|
                  sudo npm install -g yarn
 | 
						|
                  yarn set version berry
 | 
						|
                  yarn --version                  
 | 
						|
 | 
						|
            - name: Get yarn cache directory
 | 
						|
              id: yarn-cache
 | 
						|
              run: echo "::set-output name=dir::$(yarn config get cacheFolder)"
 | 
						|
 | 
						|
            - name: Cache yarn dependencies
 | 
						|
              uses: actions/cache@v2
 | 
						|
              with:
 | 
						|
                  path: ${{ steps.yarn-cache.outputs.dir }}
 | 
						|
                  # Use composer.json for key, if composer.lock is not committed.
 | 
						|
                  # key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
 | 
						|
                  key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
 | 
						|
                  restore-keys: ${{ runner.os }}-yarn-
 | 
						|
 | 
						|
            - name: Install JS dependencies
 | 
						|
              run: |
 | 
						|
                                    yarn install
 | 
						|
 | 
						|
            - name: Yarn run encore
 | 
						|
              run: |
 | 
						|
                                    yarn run encore production
 | 
						|
 | 
						|
            - name: Start chrome
 | 
						|
              run: |
 | 
						|
                sudo apt install google-chrome-stable
 | 
						|
                google-chrome --version
 | 
						|
                google-chrome-stable --version
 | 
						|
                google-chrome-stable --headless --disable-gpu --remote-debugging-port=9222 http://localhost &
 | 
						|
                whereis google-chrome-stable                
 | 
						|
 | 
						|
            # https://github.com/marketplace/actions/setup-chromedriver
 | 
						|
            - name: Start chromedriver
 | 
						|
              uses: nanasess/setup-chromedriver@master
 | 
						|
              with:
 | 
						|
                  # Optional: do not specify to match Chrome's version
 | 
						|
                  chromedriver-version: '88.0.4324.96'
 | 
						|
 | 
						|
            - run: |
 | 
						|
                export DISPLAY=:99
 | 
						|
                chromedriver --url-base=/wd/hub &
 | 
						|
                sudo Xvfb -ac :99 -screen 0 1280x1024x24 > /dev/null 2>&1 & # optional                
 | 
						|
 | 
						|
#                wget https://chromedriver.storage.googleapis.com/88.0.4324.96/chromedriver_linux64.zip --quiet && unzip chromedriver_linux64.zip
 | 
						|
#                sudo mv chromedriver /usr/bin
 | 
						|
#                sudo chmod +x /usr/bin/chromedriver
 | 
						|
#                chromedriver --version
 | 
						|
 | 
						|
#            - run: |
 | 
						|
#                export DISPLAY=:99
 | 
						|
#                chromedriver --url-base=/wd/hub &
 | 
						|
#                sudo Xvfb -ac :99 -screen 0 1280x1024x24 > /dev/null 2>&1 & # optional
 | 
						|
#                chromedriver --version
 | 
						|
 | 
						|
            - name: Set up JDK 1.8
 | 
						|
              uses: actions/setup-java@v1
 | 
						|
              with:
 | 
						|
                  java-version: 1.8
 | 
						|
 | 
						|
            - name: Get Selenium
 | 
						|
              run: |
 | 
						|
                                wget http://selenium-release.storage.googleapis.com/3.141/selenium-server-standalone-3.141.59.jar --quiet
 | 
						|
 | 
						|
            - name: Run Selenium
 | 
						|
              run: |
 | 
						|
                java -version
 | 
						|
                export DISPLAY=:99.0
 | 
						|
                sudo xvfb -ac :99 -screen 0 1280x1024x24 > /dev/null 2>&1 &
 | 
						|
                java -Dwebdriver.chrome.driver=/usr/bin/chromedriver -jar selenium-server-standalone-3.141.59.jar  -log selenium.log > /dev/null &                
 | 
						|
 | 
						|
            - name: Start mysql service
 | 
						|
              run: |
 | 
						|
                sudo /etc/init.d/mysql start
 | 
						|
                sudo systemctl restart apache2                
 | 
						|
#
 | 
						|
            - name: Install database
 | 
						|
              run: |
 | 
						|
                                    bin/console doctrine:database:create || echo "Error while creating the DB"
 | 
						|
              env:
 | 
						|
                  DATABASE_URL: mysql://root:root@127.0.0.1:${{ job.services.mysql.ports['3306'] }}/chamilo
 | 
						|
                  DATABASE_HOST: 127.0.0.1
 | 
						|
                  DATABASE_PORT: ${{ job.services.mysql.ports['3306'] }}
 | 
						|
                  DATABASE_NAME: chamilo
 | 
						|
                  DATABASE_USER: root
 | 
						|
                  DATABASE_PASSWORD: root
 | 
						|
                  APP_INSTALLED: 1
 | 
						|
 | 
						|
            - name: Check settings
 | 
						|
              run: |
 | 
						|
                  php vendor/bin/requirements-checker
 | 
						|
                  php -ini
 | 
						|
                  php -v
 | 
						|
                  php -m                  
 | 
						|
 | 
						|
            - name: Check chamilo
 | 
						|
              run: |
 | 
						|
                 sudo chmod 777 -R ${{ github.workspace }}
 | 
						|
                 curl http://localhost/main/install/index.php                 
 | 
						|
 | 
						|
            - name: Install chamilo
 | 
						|
              run: |
 | 
						|
                  cd tests/behat
 | 
						|
                  ../../vendor/behat/behat/bin/behat features/actionInstall.feature -vvv
 | 
						|
                  cd ..
 | 
						|
                  cd ..
 | 
						|
                  sed -i "s/APP_ENV='dev'/APP_ENV='prod'/g" .env.local
 | 
						|
                  sed -i "s/APP_DEBUG='1'/APP_DEBUG='0'/g" .env.local
 | 
						|
                  sudo php bin/console cache:clear
 | 
						|
                  sudo chmod -R 777 var public                  
 | 
						|
 | 
						|
            - name: Composer analyse
 | 
						|
              id: analyse
 | 
						|
              run: composer analyse
 | 
						|
 | 
						|
            - name: Behat tests
 | 
						|
              if: (${{ success() }} || ${{ steps.analyse.outcome }} == 'failure')
 | 
						|
              run: |
 | 
						|
                  cd ${{ github.workspace }}/tests/behat
 | 
						|
                  ../../vendor/behat/behat/bin/behat features/actionUserLogin.feature -vvv
 | 
						|
                  ../../vendor/behat/behat/bin/behat features/adminFillUsers.feature -vvv
 | 
						|
                  ../../vendor/behat/behat/bin/behat features/adminSettings.feature -vv
 | 
						|
                  ../../vendor/behat/behat/bin/behat features/career.feature -vvv
 | 
						|
                  ../../vendor/behat/behat/bin/behat features/class.feature -vvv
 | 
						|
                  #../../vendor/behat/behat/bin/behat features/companyReports.feature -vvv
 | 
						|
                  ../../vendor/behat/behat/bin/behat features/course.feature -vvv
 | 
						|
                  ../../vendor/behat/behat/bin/behat features/course_user_registration.feature -vv
 | 
						|
                  ../../vendor/behat/behat/bin/behat features/createUser.feature -vvv
 | 
						|
                  ../../vendor/behat/behat/bin/behat features/createUserViaCSV.feature -vv
 | 
						|
                  ../../vendor/behat/behat/bin/behat features/extraFieldUser.feature -vv
 | 
						|
                  ../../vendor/behat/behat/bin/behat features/profile.feature -vv
 | 
						|
                  ../../vendor/behat/behat/bin/behat features/promotion.feature -vv
 | 
						|
                  # ../../vendor/behat/behat/bin/behat features/registration.feature -vv
 | 
						|
                  ../../vendor/behat/behat/bin/behat features/sessionAccess.feature -vv
 | 
						|
                  ../../vendor/behat/behat/bin/behat features/sessionManagement.feature -vv
 | 
						|
                  ../../vendor/behat/behat/bin/behat features/socialGroup.feature -vv
 | 
						|
                  ../../vendor/behat/behat/bin/behat features/systemAnnouncements.feature -vv
 | 
						|
                  ../../vendor/behat/behat/bin/behat features/ticket.feature -vv
 | 
						|
                  ../../vendor/behat/behat/bin/behat features/toolAgenda.feature -vv
 | 
						|
                  ../../vendor/behat/behat/bin/behat features/toolAnnouncement.feature -vv
 | 
						|
                  ../../vendor/behat/behat/bin/behat features/toolDocument.feature -vv
 | 
						|
                  # ../../vendor/behat/behat/bin/behat features/toolExercise.feature -v
 | 
						|
                  ../../vendor/behat/behat/bin/behat features/toolForum.feature -vv
 | 
						|
                  ../../vendor/behat/behat/bin/behat features/toolGroup.feature -vv
 | 
						|
                  ../../vendor/behat/behat/bin/behat features/toolLink.feature -vv
 | 
						|
                  ../../vendor/behat/behat/bin/behat features/toolLp.feature -vvv
 | 
						|
                  ../../vendor/behat/behat/bin/behat features/toolWork.feature -vvv                  
 | 
						|
 | 
						|
            - name: The job has failed
 | 
						|
              if: ${{ failure() }}
 | 
						|
              run: |
 | 
						|
                                    cat selenium.log
 | 
						|
 |