Use sudo for become method (#1624) #697
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Integration | |
| on: | |
| push: | |
| branches: | |
| - master | |
| pull_request: | |
| branches: | |
| - master | |
| workflow_dispatch: | |
| jobs: | |
| test: | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - run: mkdir $HOME/.ssh | |
| - name: Remove and cleanup mysql | |
| run: | | |
| sudo apt-get remove --purge mysql* | |
| sudo apt-get autoremove | |
| sudo apt-get autoclean | |
| sudo rm -rf /etc/apparmor.d/abstractions/mysql /etc/apparmor.d/cache/usr.sbin.mysqld /etc/mysql /var/lib/mysql /var/log/mysql* /var/log/upstart/mysql.log* /var/run/mysqld ~/.mysql_history | |
| - name: Remove and cleanup Nginx | |
| run: | | |
| sudo apt-get remove --purge nginx* | |
| sudo apt-get autoremove | |
| sudo apt-get autoclean | |
| - uses: actions/checkout@v5 | |
| with: | |
| fetch-depth: 0 | |
| - uses: actions/setup-python@v6 | |
| with: | |
| python-version: '3.14' | |
| - uses: ./.github/actions/setup-step-ca | |
| - uses: roots/setup-trellis-cli@v1 | |
| with: | |
| ansible-vault-password: 'fake' | |
| auto-init: false | |
| galaxy-install: false | |
| repo-token: ${{ secrets.GITHUB_TOKEN }} | |
| trellis-directory: '.' | |
| - name: Create new Trellis project | |
| run: trellis new --name example.com --host www.example.com --trellis-version ${{ github.sha }} ./example.com | |
| - name: Update configs | |
| run: | | |
| sudo echo "127.0.0.1 www.example.com example.com www.example-https.com example-https.com www.redis.example.com redis.example.com" | sudo tee -a /etc/hosts | |
| cp ../../.github/files/inventory hosts/production | |
| cp ../../.github/files/wordpress_sites.yml group_vars/production/wordpress_sites.yml | |
| cp ../../.github/files/vault.yml group_vars/production/vault.yml | |
| working-directory: example.com/trellis | |
| - run: trellis exec ansible-playbook --version | |
| working-directory: example.com/trellis | |
| - name: Provision | |
| run: trellis provision --extra-vars "web_user=runner letsencrypt_ca=https://127.0.0.1:8443/acme/acme" production | |
| 539C working-directory: example.com | |
| - name: Deploy non-https site | |
| run: trellis deploy --extra-vars "web_user=runner project_git_repo=https://github.com/roots/bedrock.git" production example.com | |
| working-directory: example.com | |
| - name: Install WordPress | |
| run: | | |
| wp core install --url="http://example.com" --title="Example.com" --admin_user="admin" --admin_password="password" --admin_email="admin@example.com" | |
| working-directory: /srv/www/example.com/current | |
| - name: Verify install | |
| run: curl -s http://example.com | grep "<title>Example" | |
| - name: Deploy previously deployed site | |
| run: trellis deploy --extra-vars "web_user=runner project_git_repo=https://github.com/roots/bedrock.git" production example.com | |
| working-directory: example.com | |
| - name: Deploy https site | |
| run: trellis deploy --extra-vars "web_user=runner project_git_repo=https://github.com/roots/bedrock.git" production example-https.com | |
| working-directory: example.com | |
| - name: Install WordPress | |
| run: | | |
| wp core install --url="http://example-https.com" --title="Example HTTPS" --admin_user="admin" --admin_password="password" --admin_email="admin@example.com" | |
| working-directory: /srv/www/example-https.com/current | |
| - name: Verify install | |
| run: curl -s https://example-https.com | grep "<title>Example HTTPS" | |
| - name: Deploy Redis site | |
| run: trellis deploy --extra-vars "web_user=runner project_git_repo=https://github.com/roots/bedrock.git" production redis.example.com | |
| working-directory: example.com | |
| - name: Install WordPress on Redis site | |
| run: | | |
| wp core install --url="http://redis.example.com" --title="Redis Example" --admin_user="admin" --admin_password="password" --admin_email="admin@example.com" | |
| working-directory: /srv/www/redis.example.com/current | |
| - name: Verify Redis service | |
| run: | | |
| systemctl is-active redis-server | |
| redis-cli ping | |
| - name: Verify PHP Redis extension | |
| run: php -m | grep redis | |
| - name: Test Redis basic functionality | |
| run: | | |
| redis-cli SET test_key "test_value" | |
| redis-cli GET test_key | grep "test_value" | |
| - name: Verify Redis environment variables | |
| run: | | |
| grep "WP_REDIS_HOST" /srv/www/redis.example.com/current/.env | |
| grep "WP_REDIS_PORT" /srv/www/redis.example.com/current/.env | |
| grep "WP_REDIS_DATABASE" /srv/www/redis.example.com/current/.env | |
| - name: Verify Redis site install | |
| run: curl -s http://redis.example.com | grep "<title>Redis Example" | |
| - name: Verify FastCGI cache on example.com | |
| run: | | |
| # First request - check headers | |
| echo "=== First request ===" | |
| curl -I http://example.com | grep -i "fastcgi-cache" | |
| # Second request - check headers | |
| echo "=== Second request ===" | |
| curl -I http://example.com | grep -i "fastcgi-cache" | |
| # Third request - check headers (should be HIT by now) | |
| echo "=== Third request ===" | |
| curl -I http://example.com | grep -iE "fastcgi-cache: (MISS|HIT|STALE)" |