diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000..9d0fdb0 --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,39 @@ +.install-dependencies: + before_script: + - mkdir -p /usr/share/man/man1 + - apt update + - apt install -y git wget libzip-dev sqlite3 libsqlite3-dev + - docker-php-ext-install zip + - docker-php-ext-install pdo pdo_sqlite + - pecl install pcov + - docker-php-ext-enable pcov + - php --version + - php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" + - php composer-setup.php + - php -r "unlink('composer-setup.php');" + - php composer.phar install + +phpstan: + extends: + - .install-dependencies + image: quay.imanuel.dev/dockerhub/library---php:8.1-cli + stage: test + services: + - docker:dind + script: + - ./vendor/bin/phpstan --no-progress analyze ./src ./tests + +phpunit: + extends: + - .install-dependencies + image: quay.imanuel.dev/dockerhub/library---php:8.1-cli + stage: test + script: + - ./vendor/bin/phpunit --log-junit report.xml --configuration ./phpunit.xml + artifacts: + when: always + paths: + - report.xml + reports: + junit: + - report.xml \ No newline at end of file diff --git a/Jenkinsfile b/Jenkinsfile deleted file mode 100755 index 028bfe5..0000000 --- a/Jenkinsfile +++ /dev/null @@ -1,60 +0,0 @@ -// Uses Declarative syntax to run commands inside a container. -pipeline { - triggers { - pollSCM("*/5 * * * *") - } - agent { - kubernetes { - yaml ''' -apiVersion: v1 -kind: Pod -spec: - containers: - - name: php - image: quay.imanuel.dev/dockerhub/library---php:8.1-cli - command: - - sleep - args: - - infinity -''' - defaultContainer 'php' - } - } - stages { - stage('Install dependencies') { - steps { - sh "mkdir -p /usr/share/man/man1" - sh "apt update" - sh "apt install -y git wget libzip-dev sqlite3 libsqlite3-dev" - sh "docker-php-ext-install zip" - sh 'docker-php-ext-install pdo pdo_sqlite' - sh 'pecl install pcov' - sh 'docker-php-ext-enable pcov' - sh "php --version" - sh '''php -r "copy(\'https://getcomposer.org/installer\', \'composer-setup.php\');"''' - sh "php composer-setup.php" - sh '''php -r "unlink(\'composer-setup.php\');"''' - sh 'php composer.phar install' - } - } - stage('Tests and liniting') { - parallel { - stage('Phpstan') { - steps { - sh './vendor/bin/phpstan --no-progress analyze ./src ./tests' - } - } - stage('PHPUnit') { - steps { - sh './vendor/bin/phpunit --log-junit ./report.xml --configuration ./phpunit.xml' - } - } - } - } - } - post { - always { - junit 'report.xml' - } - } -}