diff --git a/.github/workflows/ce-deploy-lint.yml b/.github/workflows/ce-deploy-lint.yml new file mode 100644 index 00000000..283cd3b9 --- /dev/null +++ b/.github/workflows/ce-deploy-lint.yml @@ -0,0 +1,28 @@ +name: Linting + +# 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-linting: + # Name the Job + name: Linting + # Set the type of machine to run on + runs-on: ubuntu-20.04 + + steps: + # Checks out a copy of your repository on the ubuntu-latest machine + - name: Checkout code + uses: actions/checkout@v2 + + # Linter checks. + - name: Run linters. + if: ${{ always() }} + run: | + sudo apt-get update + sudo apt-get install -y ansible-lint yamllint shellcheck + find ./roles -name "*.yml" | xargs ansible-lint + yamllint ./roles + cd scripts && shellcheck *.sh diff --git a/.github/workflows/ce-deploy-test.yml b/.github/workflows/ce-deploy-publish-docs.yml similarity index 61% rename from .github/workflows/ce-deploy-test.yml rename to .github/workflows/ce-deploy-publish-docs.yml index b93a6d3e..45148600 100644 --- a/.github/workflows/ce-deploy-test.yml +++ b/.github/workflows/ce-deploy-publish-docs.yml @@ -1,14 +1,18 @@ -name: Run tests and build docs +name: Publish documentation # Run this workflow every time a new commit pushed to your repository -on: pull_request +on: + pull_request: + types: [closed] + branches: + - 1.x jobs: # Set the job key. The key is displayed as the job name # when a job name is not provided - run-tests: + publish-docs: # Name the Job - name: Run tests against Ansible code base + name: Publish ce-deploy documentation # Set the type of machine to run on runs-on: ubuntu-20.04 @@ -17,15 +21,11 @@ jobs: - name: Checkout code uses: actions/checkout@v2 - # Linter checks. - - name: Run linters. - if: ${{ always() }} + # Configures global Git variables for committing + - name: Configure Git run: | - sudo apt-get update - sudo apt-get install -y ansible-lint yamllint shellcheck - find ./roles -name "*.yml" | xargs ansible-lint - yamllint ./roles - cd scripts && shellcheck *.sh + git config --global user.email "sysadm@codeenigma.com" + git config --global user.name "Code Enigma CI" # Installs the ce-dev stack - name: Install ce-dev @@ -41,46 +41,6 @@ jobs: rm -Rf mkcert curl -sL https://raw.githubusercontent.com/codeenigma/ce-dev/1.x/install.sh | /bin/sh -s -- linux - # Configures global Git variables for committing - - name: Configure Git - run: | - git config --global user.email "sysadm@codeenigma.com" - git config --global user.name "Code Enigma CI" - - # Uses the ce-dev stack to run a test Drupal deploy - - name: Run a test ce-dev deploy with Drupal 8 - run: | - ce-dev create -p test -t drupal8 -d ~/test - cd ~/test - ce-dev init - ce-dev start - ce-dev provision - ce-dev deploy - curl https://www.test.local - shell: bash - - - name: Run a test ce-dev deploy with Drupal 9 - run: | - ce-dev create -p testnine -t drupal9 -d ~/testnine - cd ~/testnine - ce-dev init - ce-dev start - ce-dev provision - ce-dev deploy - curl https://www.testnine.local - shell: bash - - - name: Run a test ce-dev deploy with Localgov - run: | - ce-dev create -p testlocalgov -t localgov -d ~/testlocalgov - cd ~/testlocalgov - ce-dev init - ce-dev start - ce-dev provision - ce-dev deploy - curl https://www.testlocalgov.local - shell: bash - # Builds the table of contents for the docs - name: Documentation (build table of contents) if: ${{ github.event.pull_request.base.ref == '1.x' }} diff --git a/.github/workflows/ce-deploy-test-drupal8.yml b/.github/workflows/ce-deploy-test-drupal8.yml new file mode 100644 index 00000000..ec9909a9 --- /dev/null +++ b/.github/workflows/ce-deploy-test-drupal8.yml @@ -0,0 +1,44 @@ +name: Run test for Drupal 8 + +# 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: + # Name the Job + name: Run Drupal 8 test build + # Set the type of machine to run on + runs-on: ubuntu-20.04 + + steps: + # Checks out a copy of your repository on the ubuntu-latest machine + - name: Checkout code + uses: actions/checkout@v2 + + # Installs the ce-dev stack + - name: Install ce-dev + run: | + cd /tmp + wget https://golang.org/dl/go1.16.3.linux-amd64.tar.gz + sudo tar -C /usr/local -xzf go1.16.3.linux-amd64.tar.gz + export PATH=$PATH:/usr/local/go/bin + git clone https://github.com/FiloSottile/mkcert && cd mkcert + go build -ldflags "-X main.Version=$(git describe --tags)" + sudo mv ./mkcert /usr/local/bin && cd ../ + sudo chmod +x /usr/local/bin/mkcert + rm -Rf mkcert + curl -sL https://raw.githubusercontent.com/codeenigma/ce-dev/1.x/install.sh | /bin/sh -s -- linux + + # Uses the ce-dev stack to run a test Drupal deploy + - name: Run a test ce-dev deploy with Drupal 8 + run: | + ce-dev create -p test -t drupal8 -d ~/test + cd ~/test + ce-dev init + ce-dev start + ce-dev provision + ce-dev deploy + curl https://www.test.local + shell: bash diff --git a/.github/workflows/ce-deploy-test-drupal9.yml b/.github/workflows/ce-deploy-test-drupal9.yml new file mode 100644 index 00000000..afaaca7a --- /dev/null +++ b/.github/workflows/ce-deploy-test-drupal9.yml @@ -0,0 +1,44 @@ +name: Run test for Drupal 9 + +# 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: + # Name the Job + name: Run Drupal 9 test build + # Set the type of machine to run on + runs-on: ubuntu-20.04 + + steps: + # Checks out a copy of your repository on the ubuntu-latest machine + - name: Checkout code + uses: actions/checkout@v2 + + # Installs the ce-dev stack + - name: Install ce-dev + run: | + cd /tmp + wget https://golang.org/dl/go1.16.3.linux-amd64.tar.gz + sudo tar -C /usr/local -xzf go1.16.3.linux-amd64.tar.gz + export PATH=$PATH:/usr/local/go/bin + git clone https://github.com/FiloSottile/mkcert && cd mkcert + go build -ldflags "-X main.Version=$(git describe --tags)" + sudo mv ./mkcert /usr/local/bin && cd ../ + sudo chmod +x /usr/local/bin/mkcert + rm -Rf mkcert + curl -sL https://raw.githubusercontent.com/codeenigma/ce-dev/1.x/install.sh | /bin/sh -s -- linux + + # Uses the ce-dev stack to run a test Drupal deploy + - name: Run a test ce-dev deploy with Drupal 9 + run: | + ce-dev create -p test -t drupal9 -d ~/test + cd ~/test + ce-dev init + ce-dev start + ce-dev provision + ce-dev deploy + curl https://www.test.local + shell: bash diff --git a/ce-dev/ansible/common.yml b/ce-dev/ansible/common.yml index 98babe50..2cffc05e 100644 --- a/ce-dev/ansible/common.yml +++ b/ce-dev/ansible/common.yml @@ -1,5 +1,5 @@ # Common vars for local development. -is_local: yes +is_local: true ce_deploy: username: "ce-dev" own_repository: "https://github.com/codeenigma/ce-deploy.git" diff --git a/ce-dev/ansible/examples/drupal8/deploy.yml b/ce-dev/ansible/examples/drupal8/deploy.yml index 87c6efad..7c8def57 100644 --- a/ce-dev/ansible/examples/drupal8/deploy.yml +++ b/ce-dev/ansible/examples/drupal8/deploy.yml @@ -37,14 +37,35 @@ pre_tasks: # You can safely remove these steps once you have a working composer.json. - name: Download composer file. - get_url: - url: https://raw.githubusercontent.com/drupal/recommended-project/8.8.x/composer.json + ansible.builtin.get_url: + url: https://raw.githubusercontent.com/drupal/recommended-project/8.9.x/composer.json dest: "{{ deploy_path }}/composer.json" - force: no + force: false + - name: Adding composer/installers plugin to composer config. + community.general.composer: + command: config + arguments: allow-plugins.composer/installers true + working_dir: "{{ deploy_path }}" + - name: Adding drupal/core-composer-scaffold plugin to composer config. + community.general.composer: + command: config + arguments: allow-plugins.drupal/core-composer-scaffold true + working_dir: "{{ deploy_path }}" + - name: Adding drupal/core-project-message plugin to composer config. + community.general.composer: + command: config + arguments: allow-plugins.drupal/core-project-message true + working_dir: "{{ deploy_path }}" + - name: Adding dealerdirect/phpcodesniffer-composer-installer plugin to composer config. + community.general.composer: + command: config + arguments: allow-plugins.dealerdirect/phpcodesniffer-composer-installer true + working_dir: "{{ deploy_path }}" - name: Install drush. - command: - cmd: composer require drush/drush - chdir: "{{ deploy_path }}" + community.general.composer: + command: require + arguments: drush/drush:10.* + working_dir: "{{ deploy_path }}" roles: - _init # Sets some variables the deploy scripts rely on. - composer # Composer install step. diff --git a/ce-dev/ansible/examples/drupal9/deploy.yml b/ce-dev/ansible/examples/drupal9/deploy.yml index deeef9ee..b7579ac4 100644 --- a/ce-dev/ansible/examples/drupal9/deploy.yml +++ b/ce-dev/ansible/examples/drupal9/deploy.yml @@ -37,14 +37,15 @@ pre_tasks: # You can safely remove these steps once you have a working composer.json. - name: Download composer file. - get_url: - url: https://raw.githubusercontent.com/drupal/recommended-project/9.3.x/composer.json + ansible.builtin.get_url: + url: https://raw.githubusercontent.com/drupal/recommended-project/9.5.x/composer.json dest: "{{ deploy_path }}/composer.json" - force: no + force: false - name: Install drush. - command: - cmd: composer require drush/drush:11.* - chdir: "{{ deploy_path }}" + community.general.composer: + command: require + arguments: drush/drush:11.* + working_dir: "{{ deploy_path }}" roles: - _init # Sets some variables the deploy scripts rely on. - composer # Composer install step. diff --git a/ce-dev/ansible/examples/localgov/deploy.yml b/ce-dev/ansible/examples/localgov/deploy.yml index 9844206b..09db8ead 100644 --- a/ce-dev/ansible/examples/localgov/deploy.yml +++ b/ce-dev/ansible/examples/localgov/deploy.yml @@ -37,18 +37,45 @@ pre_tasks: # You can safely remove these steps once you have a working composer.json. - name: Download composer file. - get_url: - url: https://raw.githubusercontent.com/drupal/recommended-project/9.3.x/composer.json - dest: "{{ deploy_path }}/composer.json" - force: false + ansible.builtin.get_url: + url: https://raw.githubusercontent.com/drupal/recommended-project/9.1.x/composer.json + dest: "{{ deploy_path }}/composer.json" + force: false + - name: Adding composer/installers plugin to composer config. + community.general.composer: + command: config + arguments: allow-plugins.composer/installers true + working_dir: "{{ deploy_path }}" + - name: Adding drupal/core-composer-scaffold plugin to composer config. + community.general.composer: + command: config + arguments: allow-plugins.drupal/core-composer-scaffold true + working_dir: "{{ deploy_path }}" + - name: Adding drupal/core-project-message plugin to composer config. + community.general.composer: + command: config + arguments: allow-plugins.drupal/core-project-message true + working_dir: "{{ deploy_path }}" + - name: Adding dealerdirect/phpcodesniffer-composer-installer plugin to composer config. + community.general.composer: + command: config + arguments: allow-plugins.dealerdirect/phpcodesniffer-composer-installer true + working_dir: "{{ deploy_path }}" + - name: Adding cweagans/composer-patches plugin to composer config. + community.general.composer: + command: config + arguments: allow-plugins.cweagans/composer-patches true + working_dir: "{{ deploy_path }}" - name: Install drush. - command: - cmd: composer require drush/drush:11.* - chdir: "{{ deploy_path }}" + community.general.composer: + command: require + arguments: drush/drush:10.* + working_dir: "{{ deploy_path }}" - name: Install localgov. - command: - cmd: composer require localgovdrupal/localgov - chdir: "{{ deploy_path }}" + community.general.composer: + command: require + arguments: localgovdrupal/localgov + working_dir: "{{ deploy_path }}" roles: - _init # Sets some variables the deploy scripts rely on. - composer # Composer install step. @@ -56,4 +83,4 @@ - config_generate # Generates settings.php # - sync/database_sync # Grab database from a remote server. - database_apply # Run drush updb and config import. - - _exit # Some common housekeeping. \ No newline at end of file + - _exit # Some common housekeeping.