Fix lint issues and dump Travis CI. Try out GitHub Actions instead.

This commit is contained in:
Jeff Geerling 2020-11-09 17:04:42 -06:00
parent 98c11909e0
commit c14f0dd9a3
13 changed files with 133 additions and 24 deletions

2
.github/FUNDING.yml vendored
View file

@ -1,4 +1,4 @@
# These are supported funding model platforms
---
github: geerlingguy
patreon: geerlingguy

77
.github/workflows/ci.yml vendored Normal file
View file

@ -0,0 +1,77 @@
---
name: CI
'on':
pull_request:
push:
branches:
- master
schedule:
- cron: "0 5 * * 4"
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 ansible-lint
- name: Lint code.
run: |
yamllint .
ansible-lint
integration:
name: Integration
runs-on: ${{ matrix.os }}
strategy:
matrix:
os:
- macos-10.15
steps:
- name: Check out the codebase.
uses: actions/checkout@v2
- name: Uninstall GitHub Actions' built-in Homebrew.
run: tests/uninstall-homebrew.sh
- name: Uninstall GitHub Actions' built-in browser installs.
run: |
sudo rm -rf /Applications/Firefox.app
sudo rm -rf /Applications/Google\ Chrome.app
- name: Install test dependencies.
run: sudo pip3 install ansible
- name: Set up the test environment.
run: |
cp tests/ansible.cfg ./ansible.cfg
cp tests/inventory ./inventory
cp tests/config.yml ./config.yml
ansible-galaxy install -r requirements.yml -p ./roles
- name: Test the playbook's syntax.
run: ansible-playbook tests/test.yml --syntax-check
- name: Test the playbook.
run: ansible-playbook tests/test.yml
env:
ANSIBLE_FORCE_COLOR: '1'
- name: Idempotence check.
run: |
idempotence=$(mktemp)
ansible-playbook tests/test.yml | tee -a ${idempotence}
tail ${idempotence} | grep -q 'changed=0.*failed=0' && (echo 'Idempotence test: pass' && exit 0) || (echo 'Idempotence test: fail' && exit 1)
env:
ANSIBLE_FORCE_COLOR: '1'

10
.yamllint Normal file
View file

@ -0,0 +1,10 @@
---
extends: default
rules:
line-length:
max: 180
level: warning
ignore: |
.github/stale.yml

View file

@ -2,7 +2,7 @@
# Mac Development Ansible Playbook
[![Build Status](https://travis-ci.org/geerlingguy/mac-dev-playbook.svg?branch=master)](https://travis-ci.org/geerlingguy/mac-dev-playbook)
[![CI][badge-gh-actions]][link-gh-actions]
This playbook installs and configures most of the software I use on my Mac for web and software development. Some things in macOS are slightly difficult to automate, so I still have some manual installation steps, but at least it's all documented here.
@ -177,3 +177,6 @@ Check out [Ansible for DevOps](https://www.ansiblefordevops.com/), which teaches
## Author
[Jeff Geerling](https://www.jeffgeerling.com/), 2014 (originally inspired by [MWGriffin/ansible-playbooks](https://github.com/MWGriffin/ansible-playbooks)).
[badge-gh-actions]: https://github.com/geerlingguy/mac-dev-playbook/workflows/CI/badge.svg?event=push
[link-gh-actions]: https://github.com/geerlingguy/mac-dev-playbook/actions?query=workflow%3ACI

View file

@ -1,11 +1,11 @@
---
downloads: ~/.ansible-downloads/
configure_dotfiles: yes
configure_terminal: yes
configure_osx: yes
configure_dotfiles: true
configure_terminal: true
configure_osx: true
configure_sudoers: no
configure_sudoers: false
sudoers_custom_config: ''
# Example:
# sudoers_custom_config: |
@ -13,7 +13,7 @@ sudoers_custom_config: ''
# %admin ALL=(ALL) NOPASSWD: ALL
dotfiles_repo: https://github.com/geerlingguy/dotfiles.git
dotfiles_repo_accept_hostkey: yes
dotfiles_repo_accept_hostkey: true
dotfiles_repo_local_destination: ~/Development/GitHub/dotfiles
dotfiles_files:
- .zshrc
@ -80,21 +80,21 @@ osx_script: "~/.osx --no-restart"
# Note: You are responsible for making sure the required package managers are
# installed, eg. through homebrew.
composer_packages: []
# - name: drush
# state: present # present/absent, default: present
# version: "^8.1" # default: N/A
# - name: drush
# state: present # present/absent, default: present
# version: "^8.1" # default: N/A
gem_packages: []
# - name: bundler
# state: present # present/absent/latest, default: present
# version: "~> 1.15.1" # default: N/A
# - name: bundler
# state: present # present/absent/latest, default: present
# version: "~> 1.15.1" # default: N/A
npm_packages: []
# - name: webpack
# state: present # present/absent/latest, default: present
# version: "^2.6" # default: N/A
# - name: webpack
# state: present # present/absent/latest, default: present
# version: "^2.6" # default: N/A
pip_packages: []
# - name: mkdocs
# state: present # present/absent/latest, default: present
# version: "0.16.3" # default: N/A
# - name: mkdocs
# state: present # present/absent/latest, default: present
# version: "0.16.3" # default: N/A
# Glob pattern to ansible task files to run after all other tasks are finished.
post_provision_tasks: []

View file

@ -8,7 +8,7 @@
file:
path: /etc/ansible
state: directory
become: yes
become: true
- name: Symlink /usr/local/etc/ansible to /etc/ansible.
file:

View file

@ -12,7 +12,7 @@
name: "{{ item.name | default(item) }}"
state: "{{ item.state | default('present') }}"
version: "{{ item.version | default(omit) }}"
global: yes
global: true
executable: "{{ item.executable | default(omit) }}"
with_items: "{{ npm_packages }}"
@ -29,6 +29,6 @@
name: "{{ item.name | default(item) }}"
state: "{{ item.state | default('present') }}"
version: "{{ item.version | default(omit) }}"
user_install: no
user_install: false
executable: "{{ item.executable | default(omit) }}"
with_items: "{{ gem_packages }}"

View file

@ -18,4 +18,4 @@
dest: /private/etc/sudoers.d/custom
mode: 0440
validate: 'visudo -cf %s'
become: yes
become: true

View file

@ -4,7 +4,7 @@
shell: defaults read com.apple.terminal 'Default Window Settings'
register: terminal_theme
changed_when: false
check_mode: no
check_mode: false
- name: Ensure custom Terminal profile is added.
shell: open files/terminal/JJG-Term.terminal

3
tests/ansible.cfg Normal file
View file

@ -0,0 +1,3 @@
[defaults]
inventory = inventory
roles_path = ../:../roles:./roles

View file

@ -1,3 +1,4 @@
---
homebrew_installed_packages:
- autoconf
- bash-completion

2
tests/inventory Normal file
View file

@ -0,0 +1,2 @@
[local]
localhost ansible_connection=local

13
tests/uninstall-homebrew.sh Executable file
View file

@ -0,0 +1,13 @@
#!/bin/bash
#
# Uninstalls Homebrew using the official uninstall script.
# Download and run the uninstall script.
curl -sLO https://raw.githubusercontent.com/Homebrew/install/master/uninstall.sh
chmod +x ./uninstall.sh
sudo ./uninstall.sh --force
# Clean up Homebrew directories.
sudo rm -rf /usr/local/Homebrew
sudo rm -rf /usr/local/Caskroom
sudo rm -rf /usr/local/bin/brew