CI #186
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: | |
- main | |
schedule: | |
# Sunday 04:30 UTC | |
- cron: "30 4 * * 0" | |
workflow_dispatch: | |
jobs: | |
lint: | |
name: lint | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out the code | |
uses: actions/checkout@v3 | |
- name: Set up Python 3.x | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.x' | |
- name: Install linting dependencies | |
run: pip3 install yamllint ansible ansible-lint | |
- name: Install Galaxy dependencies | |
run: ansible-galaxy install -r requirements.yml | |
- name: lint code | |
run: | | |
yamllint . | |
ansible-lint | |
integration: | |
name: Integration | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: | |
- macos-13 | |
- macos-12 | |
steps: | |
- name: Check out the code | |
uses: actions/checkout@v3 | |
- name: Find Github built-in Python links | |
run: | | |
brew unlink --dry-run python > /tmp/python-links.txt | |
- name: Remove Github runner's built-in Python | |
run: | | |
sudo rm -rf /Library/Frameworks/Python.framework | |
sudo rm -rf "/Applications/Python 2.7" | |
cd /usr/local/bin/ | |
ls -l /usr/local/bin | grep '../Library/Frameworks/Python.framework' | awk '{print $9}' | tr -d @ | xargs rm -f | |
- name: Uninstall GitHub runner's built-in Homebrew | |
run: tests/uninstall-homebrew.sh | |
- name: Uninstall GitHub runner's built-in browser installs | |
run: | | |
sudo rm -rf /Applications/Firefox.app | |
sudo rm -rf /Applications/Google\ Chrome.app | |
- name: Unlink Github Action's built-in Python | |
run: | | |
cat /tmp/python-links.txt | xargs -J % -n1 sudo rm -f % | |
- name: Run bootstrap shell script | |
run: | | |
pwd -P | |
ls -lah | |
./bootstrap.sh | |
- name: Set up the Ansible test environment | |
run: | | |
cp tests/ansible.cfg ./ | |
cp tests/inventory ./ | |
cp tests/config.yml ./ | |
ansible-galaxy install -r requirements.yml | |
- name: Test playbook syntax | |
run: ansible-playbook main.yml --syntax-check | |
- name: Test playbook | |
run: ansible-playbook main.yml --extra-vars "sshkey_passphrase=TEST" | |
env: | |
ANSIBLE_FORCE_COLOR: '1' |