Skip to content

Commit

Permalink
fix(ci): added back integration test (#28)
Browse files Browse the repository at this point in the history
* ci(test): disable dock configuration in integration test workflow

* ci(test): enable ansible syntax highlighting in github actions

* refactor: refactored user script
  • Loading branch information
AlexNabokikh authored May 19, 2023
1 parent 8541e66 commit bce341e
Show file tree
Hide file tree
Showing 8 changed files with 122 additions and 107 deletions.
9 changes: 8 additions & 1 deletion .github/workflows/ci.yml → .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
name: CI
name: Test
on:
push:
branches:
Expand Down Expand Up @@ -56,3 +56,10 @@ jobs:
- name: Test the playbook's syntax
run: ansible-playbook main.yml --syntax-check
env:
ANSIBLE_FORCE_COLOR: "1"

- name: Test the playbook.
run: ansible-playbook main.yml
env:
ANSIBLE_FORCE_COLOR: "1"
64 changes: 9 additions & 55 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,20 +25,22 @@ This playbook installs and configures most of the software I use on my OSX machi
- **Dotfiles**
- Install a set of dotfiles from a given Git repository.
- **System Settings**
- **Dock**
- Arrange items in your macOS Dock as you want.
- **Fonts**
- Install chosen custom fonts.
- **directories**
- **User Settings**
- **Directories**
- Create custom user directories.
- **Terminal Settings**
- **Dock**
- Arrange items in your macOS Dock as you want.
- **Sudoers**
- Configure custom sudoers.
- **Zsh**
- Install and configure [ohmyzsh](https://github.com/ohmyzsh/ohmyzsh).
- Install custom OMZ plugins and themes.
- **TMUX**
- Install and configure tmux with TPM (plugin manager)
- Install and configure tmux with TPM (plugin manager).
- **User Script**
- Execute arbitrary user script.

## Installation

Expand All @@ -61,55 +63,7 @@ ansible-playbook main.yml -K --tags "dotfiles, homebrew"

## Overriding Defaults

You can override any of the defaults configured in `default.config.yml` by creating a `config.yml` file and setting the overrides in that file. For example, you can customize the installed packages and enable/disable specific tasks with something like:

```yaml
---
create_directories: true
directories:
- $HOME/Documents/repositories

pip_executable: pip
pip_packages:
- name: mkdocs

npm_packages:
- name: prettier
state: latest

configure_dock: true
dockitems_remove:
- TV

dockitems_persist:
- name: Firefox
path: /Applications/Firefox.app/
pos: 1
- name: Terminal
path: /System/Applications/Utilities/Terminal.app
pos: 2
- name: Visual Studio Code
path: /Applications/Visual Studio Code.app/
pos: 3

install_fonts: true
installed_nerdfonts:
- Meslo

homebrew_installed_packages:
- git

homebrew_cask_appdir: /Applications
homebrew_cask_apps:
- firefox
- visual-studio-code

mas_installed_apps:
- { id: 937984704, name: Amphetamine }
- { id: 984968384, name: Redacted }
mas_email: ""
mas_password: ""
```
You can override any of the defaults configured in `example.config.yml` by creating a `config.yml` file and setting the overrides in that file.

## Author

Expand All @@ -121,6 +75,6 @@ This software is available under the following licenses:

- **[MIT](https://github.com/AlexNabokikh/mac-playbook/blob/master/LICENSE)**

[badge-gh-tests]: https://github.com/AlexNabokikh/mac-playbook/actions/workflows/ci.yml/badge.svg
[badge-gh-tests]: https://github.com/AlexNabokikh/mac-playbook/actions/workflows/test.yml/badge.svg
[badge-gh-release]: https://github.com/AlexNabokikh/mac-playbook/actions/workflows/release.yaml/badge.svg
[badge-license]: https://img.shields.io/badge/License-MIT-informational
37 changes: 0 additions & 37 deletions default.config.yml

This file was deleted.

78 changes: 78 additions & 0 deletions example.config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
---
# System settings

# Install Nerd Fonts
install_fonts: true
installed_nerdfonts:
- Meslo

# User settings

# Create custom directories
create_directories: true
directories:
- $HOME/Documents/repositories/

# Clone your dotfiles and link them to the home directory
configure_dotfiles: true
dotfiles_repo: https://github.com/AlexNabokikh/dotfiles
dotfiles_repo_accept_hostkey: true
dotfiles_repo_local_destination: ~/Documents/repositories/dotfiles
dotfiles_files:
- .p10k.zsh
- .zshrc
- .osx

# Execute dotfiles script
user_script: ~/.osx --no-restart

# Configure zsh
configure_zsh: true
# Plugin names have to be in the format github_user/plugin_name

zsh_plugins:
- zsh-users/zsh-syntax-highlighting
- zsh-users/zsh-history-substring-search

# Theme names have to be in the format github_user/theme_name
zsh_themes:
- romkatv/powerlevel10k

# Install and configure tmux
configure_tmux: true
tmux_dir: $HOME/.tmux

# Configure the Dock via dockutil.
configure_dock: true
dockitems_remove:
- TV
- Music
- Podcasts
- Freeform
dockitems_persist:
- name: Firefox
path: /Applications/Firefox.app/
pos: 1

# Install homebrew and listed packages
install_homebrew: true
homebrew_packages:
- name: firefox
- name: npm

# Install Apple Store applications
mas_installed_apps:
- {id: 1528890965, name: TextSniper - OCR simplified}
mas_email: ""
mas_password: ""

# Install PIP packages
install_extra_packages: true
pip_packages:
- name: pip
state: latest

# Install NPM packages
npm_packages:
- name: neovim
state: latest
10 changes: 5 additions & 5 deletions main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
hosts: all

vars_files:
- default.config.yml
- example.config.yml

pre_tasks:
- name: Include playbook user configuration.
Expand Down Expand Up @@ -51,11 +51,11 @@
when: configure_zsh
tags: ["zsh"]

- name: Include osx task configuration.
- name: Include user script task configuration.
ansible.builtin.import_tasks:
file: tasks/osx.yml
when: configure_osx
tags: ["osx"]
file: tasks/user_script.yml
when: execute_script
tags: ["script"]

- name: Include sudoers task configuration.
ansible.builtin.import_tasks:
Expand Down
4 changes: 0 additions & 4 deletions tasks/osx.yml

This file was deleted.

4 changes: 4 additions & 0 deletions tasks/user_script.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
- name: Execute arbitrary user script.
ansible.builtin.command: "{{ user_script }}"
changed_when: false
23 changes: 18 additions & 5 deletions tests/test_config.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,16 @@
---
username: "{{ lookup('env', 'USER') }}"

configure_dotfiles: false
mas_installed_apps: false
mas_installed_app_ids: false
configure_dock: false
execute_script: true
user_script: ~/.osx --no-restart

configure_dotfiles: true
dotfiles_repo: https://github.com/AlexNabokikh/dotfiles
dotfiles_repo_accept_hostkey: true
dotfiles_repo_local_destination: ~/Documents/repositories/dotfiles
dotfiles_files:
- .osx

create_directories: true
directories:
Expand All @@ -17,8 +26,9 @@ installed_nerdfonts:
- Meslo

homebrew_installed_packages:
- name: hello
- name: npm

install_extra_packages: true
pip_packages:
- name: pip
state: latest
Expand All @@ -29,7 +39,10 @@ npm_packages:

configure_zsh: true
zsh_plugins:
- zsh-syntax-highlighting
- zsh-users/zsh-syntax-highlighting

zsh_themes:
- romkatv/powerlevel10k

configure_tmux: true
tmux_dir: $HOME/.tmux

0 comments on commit bce341e

Please sign in to comment.