cms/.drone.yml

510 lines
15 KiB
YAML

---
kind: pipeline
name: default
clone:
steps:
- name: setup
image: joomlaprojects/docker-images:php8.3
volumes:
- name: certificates
path: /certificates
commands:
- cp -v tests/certs/* /certificates/
- name: composer
image: joomlaprojects/docker-images:php8.3
volumes:
- name: composer-cache
path: /tmp/composer-cache
commands:
- composer validate --no-check-all --strict
- composer install --no-progress --no-suggest
- name: phpcs
image: joomlaprojects/docker-images:php8.1
depends_on: [ composer ]
commands:
- echo $(date)
- ./libraries/vendor/bin/php-cs-fixer fix -vvv --dry-run --diff
- ./libraries/vendor/bin/phpcs --extensions=php -p --standard=ruleset.xml .
- echo $(date)
- name: phan
image: joomlaprojects/docker-images:php7.4-ast
depends_on: [ phpcs ]
failure: ignore
commands:
- ./libraries/vendor/bin/phan
- name: npm
image: node:20-bullseye-slim
depends_on: [ phpcs ]
volumes:
- name: npm-cache
path: /tmp/npm-cache
environment:
npm_config_cache: /tmp/npm-cache
commands:
- npm ci --unsafe-perm
- name: php72-unit
depends_on: [ phpcs ]
image: joomlaprojects/docker-images:php7.2
commands:
- php -v
- ./libraries/vendor/bin/phpunit --testsuite Unit
- name: php73-unit
depends_on: [ phpcs ]
image: joomlaprojects/docker-images:php7.3
commands:
- php -v
- ./libraries/vendor/bin/phpunit --testsuite Unit
- name: php74-unit
depends_on: [ phpcs ]
image: joomlaprojects/docker-images:php7.4
commands:
- php -v
- ./libraries/vendor/bin/phpunit --testsuite Unit
- name: php80-unit
depends_on: [ phpcs ]
image: joomlaprojects/docker-images:php8.0
commands:
- php -v
- ./libraries/vendor/bin/phpunit --testsuite Unit
- name: php81-unit
depends_on: [ phpcs ]
image: joomlaprojects/docker-images:php8.1
commands:
- php -v
- ./libraries/vendor/bin/phpunit --testsuite Unit
- name: php82-unit
depends_on: [ phpcs ]
image: joomlaprojects/docker-images:php8.2
commands:
- php -v
- ./libraries/vendor/bin/phpunit --testsuite Unit
- name: php83-unit
depends_on: [ phpcs ]
image: joomlaprojects/docker-images:php8.3
commands:
- php -v
- ./libraries/vendor/bin/phpunit --testsuite Unit
- name: php72-integration
depends_on: [ npm ]
image: joomlaprojects/docker-images:php7.2
commands:
- php -v
- ./libraries/vendor/bin/phpunit --testsuite Integration
- name: php73-integration
depends_on: [ npm ]
image: joomlaprojects/docker-images:php7.3
commands:
- php -v
- ./libraries/vendor/bin/phpunit --testsuite Integration
- name: php74-integration
depends_on: [ npm ]
image: joomlaprojects/docker-images:php7.4
commands:
- php -v
- ./libraries/vendor/bin/phpunit --testsuite Integration
- name: php80-integration
depends_on: [ npm ]
image: joomlaprojects/docker-images:php8.0
commands:
- php -v
- ./libraries/vendor/bin/phpunit --testsuite Integration
- name: php81-integration
depends_on: [ npm ]
image: joomlaprojects/docker-images:php8.1
commands:
- php -v
- ./libraries/vendor/bin/phpunit --testsuite Integration
- name: php82-integration
depends_on: [ npm ]
image: joomlaprojects/docker-images:php8.2
commands:
- php -v
- ./libraries/vendor/bin/phpunit --testsuite Integration
- name: php83-integration
depends_on: [ npm ]
image: joomlaprojects/docker-images:php8.3
commands:
- php -v
- ./libraries/vendor/bin/phpunit --testsuite Integration
- name: php72-integration-pgsql
depends_on: [ npm ]
image: joomlaprojects/docker-images:php7.2
commands:
- php -v
- ./libraries/vendor/bin/phpunit --testsuite Integration --configuration phpunit-pgsql.xml.dist
- name: php73-integration-pgsql
depends_on: [ npm ]
image: joomlaprojects/docker-images:php7.3
commands:
- php -v
- ./libraries/vendor/bin/phpunit --testsuite Integration --configuration phpunit-pgsql.xml.dist
- name: php74-integration-pgsql
depends_on: [ npm ]
image: joomlaprojects/docker-images:php7.4
commands:
- php -v
- ./libraries/vendor/bin/phpunit --testsuite Integration --configuration phpunit-pgsql.xml.dist
- name: php80-integration-pgsql
depends_on: [ npm ]
image: joomlaprojects/docker-images:php8.0
commands:
- php -v
- ./libraries/vendor/bin/phpunit --testsuite Integration --configuration phpunit-pgsql.xml.dist
- name: php81-integration-pgsql
depends_on: [ npm ]
image: joomlaprojects/docker-images:php8.1
commands:
- php -v
- ./libraries/vendor/bin/phpunit --testsuite Integration --configuration phpunit-pgsql.xml.dist
- name: php82-integration-pgsql
depends_on: [ npm ]
image: joomlaprojects/docker-images:php8.2
commands:
- php -v
- ./libraries/vendor/bin/phpunit --testsuite Integration --configuration phpunit-pgsql.xml.dist
- name: php83-integration-pgsql
depends_on: [ npm ]
image: joomlaprojects/docker-images:php8.3
commands:
- php -v
- ./libraries/vendor/bin/phpunit --testsuite Integration --configuration phpunit-pgsql.xml.dist
- name: scss-cs
depends_on: [ npm ]
image: node:current-alpine
commands:
- npm run lint:css
- name: javascript-cs
depends_on: [ npm ]
image: node:current-alpine
commands:
- npm run lint:js
- npm run lint:testjs
- name: prepare_system_tests
depends_on:
- npm
image: joomlaprojects/docker-images:systemtests
volumes:
- name: cypress-cache
path: /root/.cache/Cypress
environment:
CYPRESS_VERIFY_TIMEOUT: 100000
commands:
- mv cypress.config.dist.js cypress.config.js
- npx cypress install
- npx cypress verify
- name: phpmin-system-mysql
depends_on:
- prepare_system_tests
image: joomlaprojects/docker-images:cypress
volumes:
- name: cypress-cache
path: /root/.cache/Cypress
environment:
JOOMLA_INSTALLATION_DISABLE_LOCALHOST_CHECK: 1
commands:
- bash tests/System/drone-system-run.sh "$(pwd)" cmysql mysqli mysql
- name: phpmin-system-postgres
depends_on:
- prepare_system_tests
image: joomlaprojects/docker-images:cypress
volumes:
- name: cypress-cache
path: /root/.cache/Cypress
environment:
JOOMLA_INSTALLATION_DISABLE_LOCALHOST_CHECK: 1
commands:
- bash tests/System/drone-system-run.sh "$(pwd)" cpostgres pgsql postgres
- name: phpmax-system-mysql
depends_on:
- phpmin-system-mysql
- phpmin-system-postgres
image: joomlaprojects/docker-images:cypress8.3
volumes:
- name: cypress-cache
path: /root/.cache/Cypress
environment:
JOOMLA_INSTALLATION_DISABLE_LOCALHOST_CHECK: 1
commands:
- bash tests/System/drone-system-run.sh "$(pwd)" cmysqlmax mysqli mysql
- name: phpmax-system-postgres
depends_on:
- phpmin-system-mysql
- phpmin-system-postgres
image: joomlaprojects/docker-images:cypress8.3
volumes:
- name: cypress-cache
path: /root/.cache/Cypress
environment:
JOOMLA_INSTALLATION_DISABLE_LOCALHOST_CHECK: 1
commands:
- bash tests/System/drone-system-run.sh "$(pwd)" cpostgresmax pgsql postgres
- name: phpmin-system-mysql8
depends_on:
- phpmax-system-mysql
- phpmax-system-postgres
image: joomlaprojects/docker-images:cypress
volumes:
- name: cypress-cache
path: /root/.cache/Cypress
environment:
JOOMLA_INSTALLATION_DISABLE_LOCALHOST_CHECK: 1
commands:
- bash tests/System/drone-system-run.sh "$(pwd)" cmysql8 mysqli mysql8
- name: phpmax-system-mysql8
depends_on:
- phpmax-system-mysql
- phpmax-system-postgres
image: joomlaprojects/docker-images:cypress8.3
volumes:
- name: cypress-cache
path: /root/.cache/Cypress
environment:
JOOMLA_INSTALLATION_DISABLE_LOCALHOST_CHECK: 1
commands:
- bash tests/System/drone-system-run.sh "$(pwd)" cmysql8max mysqli mysql8
- name: artifacts-system-tests
image: joomlaprojects/docker-images:packager
depends_on:
- phpmax-system-mysql
- phpmax-system-mysql8
- phpmax-system-postgres
- phpmin-system-mysql
- phpmin-system-mysql8
- phpmin-system-postgres
environment:
WEB_SERVER:
from_secret: webserver
FTP_KEY:
from_secret: ftp_key
FTP_USER:
from_secret: ftp_user
FTP_HOST:
from_secret: ftp_host
ARTIFACTS_ROOT:
from_secret: artifacts_root
GITHUB_TOKEN:
from_secret: github_token
commands:
- export PLUGIN_DEST_DIR=$DRONE_REPO/$DRONE_BRANCH/$DRONE_PULL_REQUEST/system-tests/$DRONE_BUILD_NUMBER
- echo https://$WEB_SERVER/drone/$PLUGIN_DEST_DIR
- mkdir -p ~/.ssh
- eval $(ssh-agent -s)
- echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config
- echo "$FTP_KEY" > ~/.ssh/id_rsa
- chmod 600 ~/.ssh/id_rsa
- ssh-add
- rclone config create artifacts sftp host $FTP_HOST user $FTP_USER port 22
- rclone mkdir artifacts:$ARTIFACTS_ROOT/$DRONE_REPO/$DRONE_BRANCH/$DRONE_PULL_REQUEST/system-tests/$DRONE_BUILD_NUMBER
- rclone copy tests/System/output/ artifacts:$ARTIFACTS_ROOT/$DRONE_REPO/$DRONE_BRANCH/$DRONE_PULL_REQUEST/system-tests/$DRONE_BUILD_NUMBER
- 'curl -X POST "https://api.github.com/repos/$DRONE_REPO/statuses/$DRONE_COMMIT" -H "Content-Type: application/json" -H "Authorization: token $GITHUB_TOKEN" -d "{\"state\":\"failure\", \"context\": \"Artifacts from Failure\", \"description\": \"You can find artifacts from the failure of the build here:\", \"target_url\": \"https://$WEB_SERVER/drone/$PLUGIN_DEST_DIR\"}" > /dev/null'
when:
status:
- failure
volumes:
- name: composer-cache
host:
path: /tmp/composer-cache
- name: cypress-cache
host:
path: /tmp/cypress-cache
- name: npm-cache
host:
path: /tmp/npm-cache
- name: certificates
host:
path: /tmp/certificates
services:
- name: mysql
image: mysql:5.7
environment:
MYSQL_USER: joomla_ut
MYSQL_PASSWORD: joomla_ut
MYSQL_ROOT_PASSWORD: joomla_ut
MYSQL_DATABASE: test_joomla
- name: mysql8
image: mysql:8.0
command: ["--default-authentication-plugin=mysql_native_password"]
environment:
MYSQL_USER: joomla_ut
MYSQL_PASSWORD: joomla_ut
MYSQL_ROOT_PASSWORD: joomla_ut
MYSQL_DATABASE: test_joomla
- name: postgres
image: postgres:11-alpine
ports:
- 5432
environment:
POSTGRES_USER: root
POSTGRES_PASSWORD: joomla_ut
POSTGRES_DB: test_joomla
- name: openldap
image: bitnami/openldap:latest
ports:
- 1389
- 1636
volumes:
- name: certificates
path: /certificates
environment:
LDAP_ADMIN_USERNAME: admin
LDAP_ADMIN_PASSWORD: adminpassword
LDAP_USERS: customuser
LDAP_PASSWORDS: custompassword
LDAP_ENABLE_TLS: yes
LDAP_TLS_CERT_FILE: /certificates/openldap.crt
LDAP_TLS_KEY_FILE: /certificates/openldap.key
LDAP_TLS_CA_FILE: /certificates/CA.crt
BITNAMI_DEBUG: true
LDAP_CONFIG_ADMIN_ENABLED: yes
LDAP_CONFIG_ADMIN_USERNAME: admin
LDAP_CONFIG_ADMIN_PASSWORD: configpassword
---
kind: pipeline
name: package
steps:
- name: packager
image: joomlaprojects/docker-images:packager
environment:
HTTP_ROOT: "https://artifacts.joomla.org/drone"
DRONE_PULL_REQUEST: DRONE_PULL_REQUEST
DRONE_COMMIT: DRONE_COMMIT
commands:
- /bin/drone_prepare_package.sh
- name: upload
image: joomlaprojects/docker-images:packager
environment:
package_key:
from_secret: package_key
package_user:
from_secret: package_user
package_host:
from_secret: package_host
package_root:
from_secret: package_root
GITHUB_TOKEN:
from_secret: github_token
commands:
- mkdir -p ~/.ssh
- eval $(ssh-agent -s)
- echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config
- echo "$package_key" > ~/.ssh/id_rsa
- chmod 600 ~/.ssh/id_rsa
- ssh-add
- rclone config create package sftp host $package_host user $package_user port 22
- rclone copy ./upload/ package:$package_root/$DRONE_REPO/$DRONE_BRANCH/$DRONE_PULL_REQUEST/downloads/$DRONE_BUILD_NUMBER
- /bin/add_github_status.sh "Download" "Prebuilt packages are available for download." "https://artifacts.joomla.org/drone/${DRONE_REPO}/${DRONE_BRANCH}/${DRONE_PULL_REQUEST}/downloads/${DRONE_BUILD_NUMBER}"
trigger:
repo:
- joomla/joomla-cms
---
kind: pipeline
name: nightly_build
steps:
- name: prepare
image: joomlaprojects/docker-images:packager
commands:
- export MINORVERSION=${DRONE_BRANCH%-*}
- composer --version
- mkdir -p transfer
- date +%s > transfer/$MINORVERSION-time.txt
- git rev-parse origin/$MINORVERSION-dev > transfer/$MINORVERSION.txt
- php build/build.php --remote=origin/$MINORVERSION-dev --exclude-gzip --exclude-bzip2
- mv build/tmp/packages/* transfer/
- name: upload
image: joomlaprojects/docker-images:packager
environment:
nightly_key:
from_secret: nightly_key
nightly_user:
from_secret: nightly_user
nightly_host:
from_secret: nightly_host
MATTERMOST_NIGHTLY_HOOK:
from_secret: mattermost_nightly_hook
commands:
- export MINORVERSION=${DRONE_BRANCH%-*}
- mkdir -p ~/.ssh
- eval $(ssh-agent -s)
- echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config
- echo "$nightly_key" > ~/.ssh/id_rsa
- chmod 600 ~/.ssh/id_rsa
- ssh-add
- rclone config create nightly sftp host $nightly_host user $nightly_user port 22
- rclone delete nightly:/home/devj/public_html/nightlies/ --include "Joomla_$MINORVERSION.*"
- rclone delete nightly:/home/devj/public_html/cache/com_content/
- rclone copy ./transfer/ nightly:/home/devj/public_html/nightlies/
- curl -i -X POST -H 'Content-Type:application/json' -d '{"text":"Nightly Build for [Joomla 4.4](https://developer.joomla.org/nightly-builds.html) successfully built."}' $MATTERMOST_NIGHTLY_HOOK
- name: buildfailure
image: joomlaprojects/docker-images:packager
environment:
MATTERMOST_NIGHTLY_HOOK:
from_secret: mattermost_nightly_hook
commands:
- curl -i -X POST -H 'Content-Type:application/json' -d '{"text":"Nightly Build for [Joomla 4.4](https://developer.joomla.org/nightly-builds.html) FAILED to built."}' $MATTERMOST_NIGHTLY_HOOK
when:
status:
- failure
trigger:
event:
- cron
- custom
repo:
- joomla/joomla-cms
---
kind: signature
hmac: 4883ca31950b6197886ad6e53fa6ec4bd19152852ea3e016a95a27b7ff27eece
...