Skip to content

Working on Drupal 10 test deploy. #390

Working on Drupal 10 test deploy.

Working on Drupal 10 test deploy. #390

name: Run test for Drupal 10
# Run this workflow every time a new commit pushed to your repository
on: pull_request
jobs:
# Set the job key. The key is displayed as the job name
# when a job name is not provided
run-tests:
if: ${{ github.event.pull_request.head.ref != 'documentation' }}
# Name the Job
name: Run Drupal 10 test build
# Set the type of machine to run on
runs-on: ubuntu-latest
# Use our ce-dev Debian base container
container:
image: codeenigma/ce-dev-controller:2.x
volumes:
- ${{ github.workspace }}:/home/controller
steps:
# Checks out a copy of your repository on the ubuntu-latest machine
- name: Checkout code
uses: actions/checkout@v4
# Configure environment
- name: Prepare Debian packages necessary
run: |
/usr/bin/apt-get update
/usr/bin/apt-get dist-upgrade -y -o Dpkg::Options::="--force-confnew"
/usr/bin/apt-get install -y -o Dpkg::Options::="--force-confnew" \
git ca-certificates git-lfs \
openssh-client nfs-common stunnel4 \
python3-venv python3-debian \
acl zip unzip gzip tar dnsutils net-tools \
mariadb-server mariadb-client php8.2 composer npm
- name: Prepare Git and installed CE tools
run: |
/usr/bin/git config --global user.email "[email protected]"
/usr/bin/git config --global user.name "Code Enigma CI"
/usr/bin/git config --global pull.rebase false
/usr/bin/git config --global --add safe.directory /__w/ce-provision/ce-provision
/usr/bin/su - ce-dev -c "cd /home/ce-dev/ce-deploy && /usr/bin/git fetch --all"
/usr/bin/su - ce-dev -c "cd /home/ce-dev/ce-provision && /usr/bin/git pull origin 2.x"
/usr/bin/su - ce-dev -c "cd /home/ce-dev/ce-deploy && /usr/bin/git checkout origin/${{ github.event.pull_request.head.ref }}"
/usr/bin/su - ce-dev -c "cd /home/ce-dev/ce-deploy && /usr/bin/git pull origin ${{ github.event.pull_request.head.ref }}"
/usr/bin/mv /etc/profile.d/gawk.csh /root/
- name: Set up Ansible and SSH
run: |
echo "deploy-web ansible_host=127.0.0.1" > /home/ce-dev/ce-deploy/config/hosts/hosts
echo "StrictHostKeyChecking=no" > /home/ce-dev/.ssh/config
cat /home/ce-dev/.ssh/id_rsa.pub > /home/ce-dev/.ssh/authorized_keys
chown ce-dev:ce-dev /home/ce-dev/.ssh/config
chmod 700 /home/ce-dev/.ssh/config
chown ce-dev:ce-dev /home/ce-dev/.ssh/authorized_keys
chmod 700 /home/ce-dev/.ssh/authorized_keys
/usr/sbin/sshd&
# @TODO install required packages for a basic web server - MySQL server and client, PHP, composer, etc.
# Run a test Drupal deploy
- name: Prepare yaml files for ce-deploy
run: |
/usr/bin/su - ce-dev -c "/usr/bin/mkdir -p /home/ce-dev/ce-deploy/build"
/bin/cat >"/home/ce-dev/ce-deploy/build/deploy.yml" << EOL
---
- hosts: deploy-web
become: true
vars_files:
- vars.yml
tasks:
- ansible.builtin.import_role:
name: _init
- ansible.builtin.import_role:
name: _meta/deploy-drupal10
- ansible.builtin.import_role:
name: _exit
EOL
/bin/cat >"/home/ce-dev/ce-deploy/build/vars.yml" << EOL
---
project_name: test
project_type: drupal8
build_type: test
maintenance_mode:
mode: drupal-core
drupal:
sites:
- folder: default
public_files: sites/default/files
config_import_command: cim
config_sync_directory: config/sync
sanitize_command: sql-sanitize
install_command: "-y si"
cron:
- minute: "{{ 59 | random }}"
job: "cron"
drush:
use_vendor: true
EOL
- name: Run a test ce-dev deploy with Drupal 8
run: /usr/bin/su - ce-dev -c "cd /home/ce-dev/ce-deploy && ./scripts/deploy.sh --build-number 0 --build-id test --workspace /home/ce-dev/ce-deploy/build --own-branch ${{ github.event.pull_request.base.ref }} --playbook deploy.yml"