Improve Ansible config #46
Workflow file for this run
This file contains 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
on: | |
pull_request: | |
branches: | |
- main | |
push: | |
branches: | |
- main | |
name: CI | |
jobs: | |
tests: | |
name: Tests | |
runs-on: ubuntu-latest | |
env: | |
PHP_EXTENSIONS: dom, json, libxml, mbstring, pdo_sqlite, soap, xml, xmlwriter | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
show-progress: false | |
- uses: php-actions/composer@v6 | |
- name: Install docker-compose | |
uses: KengoTODA/actions-setup-docker-compose@v1 | |
with: | |
version: '2.24.0' | |
- name: Information | |
run: | | |
docker-compose --version | |
# github.ref_name is the branch name on branch builds. | |
# On PRs ref_name is `PR#/merge`. | |
- name: Set runner name | |
if: github.event_name != 'pull_request' | |
run: | | |
echo "ASH_NAME=${{ github.ref_name }}" >> "$GITHUB_ENV" | |
echo "ASH_ENVIRONMENT_NAME=ash.${{ github.ref_name }}.local.computer" >> "$GITHUB_ENV" | |
- name: Set runner name | |
if: github.event_name == 'pull_request' | |
run: | | |
echo "ASH_NAME=pr${{ github.event.number }}" >> "$GITHUB_ENV" | |
echo "ASH_ENVIRONMENT_NAME=ash.pr${{ github.event.number }}.local.computer" >> "$GITHUB_ENV" | |
- name: Set variables | |
run: | | |
echo -e '[local]\n${{ env.ASH_ENVIRONMENT_NAME }} ansible_connection=local' > /etc/ansible/hosts | |
echo "DOCKER_HOSTNAME=${{ env.ASH_ENVIRONMENT_NAME }}" > .env | |
echo "# CI variables set! | |
ansible_host: ${{ env.ASH_ENVIRONMENT_NAME }} | |
ash_github_runners: | |
- repo_url: ${{ github.server_url }}/${{ github.repository }} | |
runner_token: ${{ secrets.RUNNER_TOKEN }} | |
runner_name: ${{ env.ASH_ENVIRONMENT_NAME }} | |
runner_labels: ci | |
user: platform | |
" > ansible/host_vars/${{ env.ASH_ENVIRONMENT_NAME }}.yml | |
cat ansible/host_vars/${{ env.ASH_ENVIRONMENT_NAME }}.yml | |
- name: Build Platform | |
run: composer dev:start |