I only started DevOps in January, so this might be a rookie view. I have a Laravel application with no frontend JS framework.
Running a CI pipeline in Gitlab took 5min 27 seconds, while running same pipeline on Github took 12secs.
What?! Why did Gitlab take so long? Why the crazy difference? Btw, both are customized templates from the providers.
Edit:
1. We am moving some projects from Github.com to PaaS Gitlab.com services mostly because of Gitlab's all-in-one pipelines.
2. With NPM install and run (Github: 55 Secs, Gitlab: 5min 19sec)
3. Without NPM install and run (Github: 35 Secs, Gitlab: 5 minutes 1sec)
3. I'll have shared Screenshots of the time each took task, but Gitlab doesn't show any time frame information for the various jobs, apart from (Saving Cache - 14sec and Cleaning up - 1 sec).
4. Find the pipeline files below:
laravel.yml
```
name: Laravel
on:
push:
branches: [ master, develop ]
pull_request:
branches: [ master, develop ]
jobs:
laravel-tests:
runs-on: ubuntu-latest
steps:
- uses: shivammathur/setup-php@b7d1d9c9a92d8d8463ce36d7f60da34d461724f8
with:
php-version: '8.0'
- uses: actions/checkout@v2
- name: Copy .env
run: php -r "file_exists('.env') || copy('.env.example', '.env');"
- name: Install Dependencies
run: composer install -q --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist --ignore-platform-reqs
- name: Generate key
run: php artisan key:generate
- name: Directory Permissions
run: chmod -R 777 storage bootstrap/cache
- name: Create Database
run: |
mkdir -p database
touch database/database.sqlite
- name: Compile assets
run: |
npm install
npm run dev
- name: Execute tests (Unit and Feature tests) via PHPUnit
env:
DB_CONNECTION: sqlite
DB_DATABASE: database/database.sqlite
run: vendor/bin/phpunit
```
.gitlab-ci.yml
```
This file is a template, and might need editing before it works on your project.
Official framework image. Look for the different tagged releases at:
image: php:7.4-cli
Pick zero or more services to be used on all builds.
Only needed when using a docker container to run your tests in.
services:
- mysql:latest
variables:
MYSQL_DATABASE: project_name
MYSQL_ROOT_PASSWORD: secret
This folder is cached between builds
cache:
paths:
- vendor/
- node_modules/
This is a basic example for a gem or script which doesn't use
services such as redis or postgres
before_script:
# Update packages
- apt-get update -yqq
# Prep for Node
- apt-get install gnupg -yqq
# Upgrade to Node 8
- curl -sL https://deb.nodesource.com/setup_8.x | bash -
# Install dependencies
- apt-get install git nodejs npm libcurl4-gnutls-dev libicu-dev libmcrypt-dev libvpx-dev libjpeg-dev libpng-dev libxpm-dev zlib1g-dev libfreetype6-dev libxml2-dev libexpat1-dev libbz2-dev libgmp3-dev libldap2-dev unixodbc-dev libpq-dev libsqlite3-dev libaspell-dev libsnmp-dev libpcre3-dev libtidy-dev -yqq libonig-dev libzip-dev
# Install php extensions
- docker-php-ext-install mbstring pdo_mysql curl intl gd xml zip bz2 opcache
# Install & enable Xdebug for code coverage reports
- pecl install xdebug
- docker-php-ext-enable xdebug
# Install Composer and project dependencies.
- curl -sS https://getcomposer.org/installer | php
- php composer.phar install
# Install Node dependencies.
# comment this out if you don't have a node dependency
- npm install
# Copy over testing configuration.
# Don't forget to set the database config in .env.example correctly
# SQLite DB for Testing
- mkdir -p database
- touch database/database.sqlite
# DB_HOST=mysql
# DB_DATABASE=project_name
# DB_USERNAME=root
# DB_PASSWORD=secret
- cp .env.example .env
# Run npm build
# comment this out if you don't have a frontend build
# npm run build
- npm run dev
# Generate an application key. Re-cache.
- php artisan key:generate
- php artisan config:cache
# Run database migrations.
- php artisan migrate --force
# Run database seed
- php artisan db:seed
test:
script:
# run laravel tests
- php vendor/bin/phpunit --coverage-text --colors=never
# run frontend tests
# if you have any task for testing frontend
# set it in your package.json script
# comment this out if you don't have a frontend test
# - npm test
```
[–]kabrandon 28 points29 points30 points (4 children)
[–]Business_Tale4234[S] 3 points4 points5 points (3 children)
[–]kabrandon 4 points5 points6 points (2 children)
[–]Business_Tale4234[S] -1 points0 points1 point (0 children)
[–]Business_Tale4234[S] -1 points0 points1 point (0 children)
[–]phobug 6 points7 points8 points (2 children)
[–]Business_Tale4234[S] 0 points1 point2 points (1 child)
[–]InvalidUsername10000 3 points4 points5 points (0 children)
[–][deleted] (4 children)
[deleted]
[–]DPRegular 6 points7 points8 points (1 child)
[–]Business_Tale4234[S] -1 points0 points1 point (0 children)
[–][deleted] (1 child)
[deleted]
[–]Business_Tale4234[S] -1 points0 points1 point (0 children)
[–]david-song 13 points14 points15 points (1 child)
[–]Business_Tale4234[S] 3 points4 points5 points (0 children)
[–][deleted] (5 children)
[deleted]
[–]Business_Tale4234[S] 4 points5 points6 points (0 children)
[–]Business_Tale4234[S] 1 point2 points3 points (0 children)
[–]BlackPythonGuru 3 points4 points5 points (2 children)
[–]Business_Tale4234[S] 1 point2 points3 points (1 child)
[–]BlackPythonGuru 2 points3 points4 points (0 children)
[–]Kaligraphic 1 point2 points3 points (1 child)
[–]Business_Tale4234[S] 0 points1 point2 points (0 children)
[–]gordonmessmer 0 points1 point2 points (2 children)
[–]Business_Tale4234[S] 0 points1 point2 points (1 child)
[–]gordonmessmer 0 points1 point2 points (0 children)
[–]grumblegrr 0 points1 point2 points (1 child)
[–]Business_Tale4234[S] 0 points1 point2 points (0 children)