Feature/apply itkdev template #2
Workflow file for this run
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
| # Do not edit this file! Make a pull request on changing | |
| # github/workflows/drupal/site.yaml in | |
| # https://github.com/itk-dev/devops_itkdev-docker if need be. | |
| ### ### Drupal | |
| ### | |
| ### Checks that site can be installed and can be updated (from base branch on | |
| ### pull request). | |
| ### | |
| ### #### Assumptions | |
| ### | |
| ### 1. A docker compose service named `phpfpm` can be run and `composer` can be | |
| ### run inside the `phpfpm` service. | |
| ### 2. The docker setup contains a database container and other the dependent | |
| ### services and the default settings match connection credentials for these | |
| ### services. | |
| ### 3. The Drupal site can be installed from existing config. | |
| name: Drupal | |
| env: | |
| COMPOSE_USER: root | |
| on: | |
| pull_request: | |
| push: | |
| branches: | |
| - main | |
| - develop | |
| jobs: | |
| install-site: | |
| name: Check that site can be installed | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Start docker and install dependencies | |
| run: | | |
| docker network create frontend | |
| docker compose pull | |
| docker compose up --detach | |
| # Important: Use --no-interaction to make https://getcomposer.org/doc/06-config.md#discard-changes have effect. | |
| docker compose exec phpfpm composer install --no-interaction | |
| - name: Install site | |
| run: | | |
| # Add some local settings. | |
| cat > web/sites/default/settings.local.php <<'EOF' | |
| <?php | |
| $settings['hash_salt'] = '${{ github.head_ref }}'; | |
| EOF | |
| # Install the site from config | |
| docker compose exec phpfpm vendor/bin/drush site:install --existing-config --yes | |
| - name: Show site URL | |
| run: | | |
| echo $(docker compose exec phpfpm vendor/bin/drush --uri=http://$(docker compose port nginx 8080) user:login) | |
| update-site: | |
| # Check updating site only on pull request. | |
| if: github.event_name == 'pull_request' | |
| name: Check that site can be updated | |
| runs-on: ubuntu-latest | |
| steps: | |
| # Install site from our base ref | |
| - uses: actions/checkout@v4 | |
| with: | |
| ref: ${{ github.base_ref }} | |
| - name: Start docker and install dependencies | |
| run: | | |
| docker network create frontend | |
| docker compose pull | |
| docker compose up --detach | |
| # Important: Use --no-interaction to make https://getcomposer.org/doc/06-config.md#discard-changes have effect. | |
| docker compose exec phpfpm composer install --no-interaction | |
| - name: Install site | |
| run: | | |
| # Add some local settings. | |
| cat > web/sites/default/settings.local.php <<'EOF' | |
| <?php | |
| $settings['hash_salt'] = '${{ github.head_ref }}'; | |
| EOF | |
| # Install the site from config | |
| docker compose exec phpfpm vendor/bin/drush site:install --existing-config --yes | |
| - name: Show site URL | |
| run: | | |
| echo $(docker compose exec phpfpm vendor/bin/drush --uri=http://$(docker compose port nginx 8080) user:login) | |
| - name: Clean up root stuff | |
| run: | | |
| sudo chown -Rv $USER:$USER vendor/ web/ private-files/ || true | |
| sudo chmod -Rv a+w web/sites/default || true | |
| # Install site with our current ref | |
| - uses: actions/checkout@v4 | |
| with: | |
| ref: ${{ github.head_ref }} | |
| # Keep our local settings (cf. | |
| # https://github.com/actions/checkout?tab=readme-ov-file#usage) | |
| clean: false | |
| - name: Start docker and install dependencies | |
| run: | | |
| docker network create frontend || true | |
| docker compose pull | |
| docker compose up --detach | |
| # Important: Use --no-interaction to make https://getcomposer.org/doc/06-config.md#discard-changes have effect. | |
| docker compose exec phpfpm composer install --no-interaction | |
| - name: Update site | |
| run: | | |
| docker compose exec phpfpm vendor/bin/drush deploy --yes | |
| - name: Show site URL | |
| run: | | |
| echo $(docker compose exec phpfpm vendor/bin/drush --uri=http://$(docker compose port nginx 8080) user:login) |