CI #125
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
--- | |
name: CI | |
'on': | |
pull_request: | |
push: | |
branches: | |
- master | |
schedule: | |
- cron: "30 4 * * 0" | |
jobs: | |
lint: | |
name: Lint | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out the codebase. | |
uses: actions/checkout@v2 | |
- name: Set up Python 3. | |
uses: actions/setup-python@v2 | |
with: | |
python-version: '3.x' | |
- name: Install test dependencies. | |
run: pip3 install yamllint | |
- name: Lint code. | |
run: | | |
yamllint . | |
ci: | |
name: CI | |
runs-on: ubuntu-latest | |
env: | |
HOSTNAME: www.drupalpi.test | |
MACHINE_NAME: drupalpi | |
PLAYBOOK_DIR: /tmp/drupal-pi | |
steps: | |
- name: Check out the codebase. | |
uses: actions/checkout@v2 | |
- name: Run container in detached state. | |
run: >- | |
docker run --detach --name drupalpi | |
--add-host "${{ env.HOSTNAME }}$(echo -e "\t")${{ env.MACHINE_NAME }}":127.0.0.1 | |
--volume="${PWD}":${{ env.PLAYBOOK_DIR }}/:rw --privileged --volume=/var/lib/docker | |
--volume=/sys/fs/cgroup:/sys/fs/cgroup:rw --cgroupns=host | |
geerlingguy/docker-debian11-ansible:latest /lib/systemd/systemd | |
- name: Copy inventory file into place. | |
run: >- | |
docker exec drupalpi cp ${{ env.PLAYBOOK_DIR }}/example.inventory ${{ env.PLAYBOOK_DIR }}/inventory | |
- name: Install requirements. | |
run: >- | |
docker exec --tty drupalpi ansible-galaxy install -r ${{ env.PLAYBOOK_DIR }}/requirements.yml | |
- name: Ansible syntax check. | |
run: >- | |
docker exec --tty drupalpi ansible-playbook -i ${{ env.PLAYBOOK_DIR }}/inventory ${{ env.PLAYBOOK_DIR }}/main.yml --syntax-check | |
- name: Run the playbook. | |
run: >- | |
docker exec drupalpi | |
env ANSIBLE_FORCE_COLOR=true | |
ansible-playbook -i ${{ env.PLAYBOOK_DIR }}/inventory | |
--connection=local | |
--extra-vars "{ | |
'docker_version':'5:20.10.22~3-0~debian-bullseye', | |
'firewall_enable_ipv6':false | |
}" | |
${{ env.PLAYBOOK_DIR }}/main.yml |