Feature/site hosts #113
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 | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
show-progress: false | |
- 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 "OPERATIONS_NAME=${{ github.ref_name }}" >> "$GITHUB_ENV" | |
echo "OPERATIONS_ENVIRONMENT_NAME=operations.${{ github.ref_name }}.local.computer" >> "$GITHUB_ENV" | |
- name: Set runner name | |
if: github.event_name == 'pull_request' | |
run: | | |
echo "OPERATIONS_NAME=pr${{ github.event.number }}" >> "$GITHUB_ENV" | |
echo "OPERATIONS_ENVIRONMENT_NAME=operations.pr${{ github.event.number }}.local.computer" >> "$GITHUB_ENV" | |
- name: Set ansible inventory hostname | |
run: | | |
echo "[operations_host_ddev] | |
${{ env.OPERATIONS_ENVIRONMENT_NAME }} ansible_connection=local" > ./ansible/hosts | |
- name: Set variables | |
run: | | |
echo "DOCKER_HOSTNAME=${{ env.OPERATIONS_ENVIRONMENT_NAME }}" > .env | |
echo "# CI variables set! | |
operations_github_api_token: ${{ secrets.OPERATIONS_GITHUB_API_TOKEN }} | |
operations_admin_users: | |
- jonpugh | |
operations_github_runners: | |
- repo_name: ${{ github.repository }} | |
runner_name: ${{ env.OPERATIONS_ENVIRONMENT_NAME }} | |
runner_labels: github-ci,delete-me,${{ env.OPERATIONS_ENVIRONMENT_NAME }} | |
" > ./ansible/host_vars/${{ env.OPERATIONS_ENVIRONMENT_NAME }}.yml | |
cat ./ansible/host_vars/${{ env.OPERATIONS_ENVIRONMENT_NAME }}.yml | |
- name: Install task CLI | |
run: ./scripts/install-task.sh | |
- name: Build Platform | |
run: bin/task start | |
- name: Test Platform | |
run: | | |
docker-compose exec -u platform operations whoami | |
docker-compose exec -u platform operations hostname | |
docker-compose exec -u platform operations ddev |