Skip to content

Commit

Permalink
Fix
Browse files Browse the repository at this point in the history
Signed-off-by: chez-shanpu <[email protected]>
  • Loading branch information
chez-shanpu committed Jan 2, 2025
1 parent 5acd4de commit ab7285c
Show file tree
Hide file tree
Showing 30 changed files with 195 additions and 194 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ansible-scheduled.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
ANSIBLE_FORCE_COLOR: 1
steps:
- name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@v4
- name: Run make
run: make
- name: Idempotence Test
Expand All @@ -23,7 +23,7 @@ jobs:
|| (echo 'Idempotence test: fail' && exit 1)
- name: Archive Idempotence Test output
if: always()
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
with:
name: idempotence-out
path: idempotence-out.txt
Expand Down
11 changes: 8 additions & 3 deletions .github/workflows/ansible.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,18 @@ jobs:
test:
strategy:
matrix:
platform: [ubuntu-latest, macos-latest]
platform: [
ubuntu-latest,
macos-latest
]
runs-on: ${{ matrix.platform }}
env:
ANSIBLE_FORCE_COLOR: 1
steps:
- name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@v4
- name: Install homebrew
uses: Homebrew/actions/setup-homebrew@master
- name: Run make
run: make
- name: Idempotence Test
Expand All @@ -27,7 +32,7 @@ jobs:
|| (echo 'Idempotence test: fail' && exit 1)
- name: Archive Idempotence Test output
if: always()
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
with:
name: idempotence-out
path: idempotence-out.txt
Expand Down
31 changes: 17 additions & 14 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,21 @@ ANSIBLE_LINT_EXCLUDE="-x indentation,unnamed-task,yaml[indentation]"

brew-Linux:
ifeq (, $(shell which brew))
curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh | /bin/bash
test -d ~/.linuxbrew && eval $(~/.linuxbrew/bin/brew shellenv)
test -d /home/linuxbrew/.linuxbrew && eval $(/home/linuxbrew/.linuxbrew/bin/brew shellenv)
test -r ~/.bash_profile && echo "eval \$($(brew --prefix)/bin/brew shellenv)" >>~/.bash_profile
echo "eval \$($(brew --prefix)/bin/brew shellenv)" >>~/.profile
sudo apt-get update
sudo apt-get install -y \
build-essential \
procps \
curl \
file \
git
./install-linuxbrew.sh
else
@echo "linuxbrew is already exits."
endif

brew-Darwin:
ifeq (, $(shell which brew))
curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh | /bin/bash
NONINTERACTIVE=1 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
else
@echo "homebrew is already exits."
endif
Expand All @@ -31,9 +34,9 @@ age:
brew install age

python-Linux:
sudo apt update
sudo apt install -y python3
sudo apt upgrade -y python3
sudo apt-get update
sudo apt-get install -y python3
sudo apt-get upgrade -y python3

python-Darwin:
brew install python
Expand All @@ -42,11 +45,11 @@ python-Darwin:
python: python-$(UNAME)

ansible-Linux:
sudo apt update
sudo apt install software-properties-common
sudo add-apt-repository --yes --update ppa:ansible/ansible
sudo apt install -y ansible
sudo apt install -y ansible-lint
sudo apt-get update
sudo apt-get install -y software-properties-common
sudo add-get-apt-repository --yes --update ppa:ansible/ansible
sudo apt-get install -y ansible
sudo apt-get install -y ansible-lint

ansible-Darwin:
brew install ansible
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,5 @@ $ vagrant up --provisioning
$ vagrant halt
$ vagrant destroy
```

## Test with Lima
13 changes: 2 additions & 11 deletions dev-provisioning.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
- hosts: localhost
strategy: linear
roles:
- name: common
tags: common
- name: tools
tags: tools

- name: mac
tags: mac
Expand All @@ -15,9 +15,6 @@
- name: fish
tags: fish

- name: anyenv
tags: anyenv

- name: c
tags: c

Expand All @@ -30,18 +27,12 @@
- name: go
tags: go

- name: hyper-terminal
tags: hyper-terminal

- name: kubernetes
tags: kubernetes

- name: neovim
tags: neovim

- name: python
tags: python

- name: tex
tags: tex

Expand Down
3 changes: 1 addition & 2 deletions group_vars/all.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
github_user: chez-shanpu
ghq_root: '{{ lookup("env","HOME") }}/ghq'
repos_root: '{{ ghq_root }}/github.com/{{ github_user }}'
dotfiles_path: '{{ repos_root }}/dotfiles'
repos_root: '{{ ghq_root }}/github.com/{{ github_user }}'
6 changes: 6 additions & 0 deletions install-linuxbrew.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/usr/bin/env bash

NONINTERACTIVE=1 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
test -d ~/.linuxbrew && eval "$(~/.linuxbrew/bin/brew shellenv)"
test -d /home/linuxbrew/.linuxbrew && eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
echo "eval \"\$($(brew --prefix)/bin/brew shellenv)\"" >> ~/.bashrc
30 changes: 30 additions & 0 deletions lima/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
SHELL:=/bin/bash

VM_NAME=dev-provisioning
VM_OPTS=--arch x86_64
VM_WORKDIR=--workdir ~/ghq/github.com/chez-shanpu/dev-provisioning/

.PHONY: lima
lima:
ifeq (, $(shell which limactl))
brew install lima
else
@echo "lima is already exits."
endif

.PHONY: setup
setup: lima
limactl create $(VM_OPTS) --name=$(VM_NAME) template://default
limactl start $(VM_NAME)
limactl shell $(VM_WORKDIR) $(VM_NAME) sudo apt-get update
limactl shell $(VM_WORKDIR) $(VM_NAME) sudo apt-get install -y make

.PHONY: clean
clean:
-limactl stop $(VM_NAME)
limactl delete $(VM_NAME)

.PHONY: all
all: lima setup

.DEFAULT_GOAL=all
16 changes: 0 additions & 16 deletions roles/anyenv/tasks/main.yaml

This file was deleted.

3 changes: 2 additions & 1 deletion roles/c/tasks/main.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
- include_tasks: debian.yaml
- name: Setup C in Debian
ansible.builtin.include_tasks: debian.yaml
when: ansible_os_family == "Debian"
51 changes: 0 additions & 51 deletions roles/common/tasks/debian.yaml

This file was deleted.

6 changes: 0 additions & 6 deletions roles/common/tasks/main.yaml

This file was deleted.

6 changes: 4 additions & 2 deletions roles/docker/tasks/main.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
---
- include_tasks: darwin.yaml
- name: Setup docker in Darwin
ansible.builtin.include_tasks: darwin.yaml
when: ansible_os_family == "Darwin"

- include_tasks: ubuntu.yaml
- name: Setup docker in Ubuntu
ansible.builtin.include_tasks: ubuntu.yaml
when: ansible_distribution == "Ubuntu"
4 changes: 2 additions & 2 deletions roles/dotfiles/tasks/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
name:
- chezmoi

- name: chezmoi init
- name: Init chezmoi
changed_when: false
ansible.builtin.shell: chezmoi init https://github.com/chez-shanpu/dotfiles

- name: chezmoi apply
- name: Apply chezmoi
changed_when: false
ansible.builtin.shell: chezmoi apply -v
ignore_errors: true
2 changes: 1 addition & 1 deletion roles/fish/tasks/darwin.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,6 @@
ansible.builtin.shell: fisher update
changed_when: false

- name: reflect config.fish
- name: Reflect config.fish
ansible.builtin.shell: source ~/.config/fish/config.fish
changed_when: false
16 changes: 8 additions & 8 deletions roles/fish/tasks/debian.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
name:
- 'fish'

- block:
- name: Default to fish
tags: fish_chsh
block:
- name: Obtain path to fish
ansible.builtin.shell: which fish
register: fish_path
Expand All @@ -14,12 +16,12 @@
become: true
ansible.builtin.user:
name: '{{ ansible_user }}'
ansible.builtin.shell: '{{ fish_path.stdout }}'
shell: '{{ fish_path.stdout }}'
system: true

tags: fish_chsh

- block:
- name: Configure fish
tags: fish_config
block:
- name: Create fish config dir
ansible.builtin.file:
path: ~/.config/fish
Expand Down Expand Up @@ -54,8 +56,6 @@
ansible.builtin.shell: fisher update
changed_when: false

- name: reflect config.fish
- name: Reflect config.fish
ansible.builtin.shell: source ~/.config/fish/config.fish
changed_when: false

tags: fish_config
6 changes: 4 additions & 2 deletions roles/fish/tasks/main.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
---
- include_tasks: darwin.yaml
- name: Setup fish in Darwin
ansible.builtin.include_tasks: darwin.yaml
when: ansible_os_family == "Darwin"

- include_tasks: debian.yaml
- name: Setup fish in Debian
ansible.builtin.include_tasks: debian.yaml
when: ansible_os_family == "Debian"
21 changes: 10 additions & 11 deletions roles/font/tasks/darwin.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
---
- block:
- name: brew tap homebrew/cask-fonts
community.general.homebrew_tap: tap=homebrew/cask-fonts state=present
- name: Do brew tap homebrew/cask-fonts
community.general.homebrew_tap:
name: homebrew/cask-fonts
state: present

- name: Install fonts
community.general.homebrew_cask:
name:
- font-ricty-diminished
- font-powerline-symbols
- font-cica

tags: font_install
- name: Install fonts
community.general.homebrew_cask:
name:
- font-ricty-diminished
- font-powerline-symbols
- font-cica
6 changes: 4 additions & 2 deletions roles/font/tasks/main.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
---
- include_tasks: darwin.yaml
- name: Setup font in Darwin
ansible.builtin.include_tasks: darwin.yaml
when: ansible_os_family == "Darwin"

- include_tasks: debian.yaml
- name: Setup font in Debian
ansible.builtin.include_tasks: debian.yaml
when: ansible_os_family == "Debian"
Loading

0 comments on commit ab7285c

Please sign in to comment.