Skip to content

Commit

Permalink
Merge pull request #35 from Iovesophy/add-lima
Browse files Browse the repository at this point in the history
ADD: lima install task
  • Loading branch information
Iovesophy authored Nov 10, 2022
2 parents d62072a + 30f0ab5 commit caa7daf
Show file tree
Hide file tree
Showing 12 changed files with 67 additions and 40 deletions.
19 changes: 9 additions & 10 deletions .github/workflows/macos.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
name: CI to MacOS
on:
push:
branches: [ main ]
branches: [main]
pull_request:
branches: [ main ]
branches: [main]

jobs:
build:
runs-on: macos-latest
steps:
- name: Checkout Repo
uses: actions/checkout@v2
- name: Run
run: make

build:
runs-on: macos-latest
steps:
- name: Checkout Repo
uses: actions/checkout@v3
- name: Run
run: make
2 changes: 1 addition & 1 deletion install_playbook.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@
gather_facts: no
roles:
- homebrew
- dmg
- vim
- lima

1 change: 0 additions & 1 deletion roles/dmg/tasks/check.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
- name: docker
local_action: stat path=/Applications/Docker.app
register: docker

5 changes: 2 additions & 3 deletions roles/dmg/tasks/install.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
- name: install
shell: |
shell: |
curl -O "{{ item.url }}"
hdiutil attach ./{{ item.name }}.dmg -nobrowse -mountpoint ./{{ item.name }}
cp -aR ./{{ item.name }}/*.app /Applications/{{ item.name }}.app
hdiutil detach ./{{ item.name }}/
rm -R ./{{ item.name }}.dmg
with_items: "{{ dmg }}"
when:
when:
- docker.stat.exists == False

5 changes: 2 additions & 3 deletions roles/dmg/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
---
- block:
- include_tasks: check.yml
- include_tasks: install.yml
- include_tasks: check.yml
- include_tasks: install.yml
tags:
- dmg

17 changes: 8 additions & 9 deletions roles/homebrew/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
---
- block:
- name: homebrew update/upgrade
homebrew:
update_homebrew: true
upgrade_all: yes
- name: homebrew install
homebrew:
name: "{{ item.name }}"
with_items: "{{ pkg }}"
- name: homebrew update/upgrade
homebrew:
update_homebrew: true
upgrade_all: yes
- name: homebrew install
homebrew:
name: "{{ item.name }}"
with_items: "{{ pkg }}"
tags:
- homebrew

2 changes: 2 additions & 0 deletions roles/homebrew/vars/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,5 @@ pkg:
- name: vint
- name: zsh-git-prompt
- name: neovim
- name: lima
- name: docker
26 changes: 26 additions & 0 deletions roles/lima/tasks/lima.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
- block:
- name: checklima
local_action: stat path=~/.lima/docker/docker.yaml
register: limadocker
- name: checkdocker
local_action: stat path=~/.docker/cli-plugins/docker-compose
register: dockercompose

- name: limadocker
shell: |
cd ~/.lima/docker
curl -O https://raw.githubusercontent.com/lima-vm/lima/master/examples/docker.yaml
limactl start ./docker.yaml
when:
- limadocker.stat.exists == False

- name: compose
shell: |
mkdir -p ~/.docker/cli-plugins/
DOCKER_CONFIG=${DOCKER_CONFIG:-$HOME/.docker}
mkdir -p $DOCKER_CONFIG/cli-plugins
curl -SL https://github.com/docker/compose/releases/download/v2.12.2/docker-compose-darwin-x86_64 -o $DOCKER_CONFIG/cli-plugins/docker-compose
chmod +x ~/.docker/cli-plugins/docker-compose
when:
- dockercompose.stat.exists == False
5 changes: 5 additions & 0 deletions roles/lima/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
- block:
- include_tasks: lima.yml
tags:
- lima
3 changes: 1 addition & 2 deletions roles/vim/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
---
- block:
- include_tasks: vim-plug.yml
- include_tasks: vim-plug.yml
tags:
- vim

21 changes: 10 additions & 11 deletions roles/vim/tasks/vim-plug.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
- block:
- name: check
local_action: stat path=~/.vim/autoload/plug.vim
register: vimplug
- name: vim-plug
shell: |
mkdir -p ~/.vim/autoload
cd ~/.vim/autoload
curl -O https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
when:
- vimplug.stat.exists == False

- name: check
local_action: stat path=~/.vim/autoload/plug.vim
register: vimplug
- name: vim-plug
shell: |
mkdir -p ~/.vim/autoload
cd ~/.vim/autoload
curl -O https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
when:
- vimplug.stat.exists == False
1 change: 1 addition & 0 deletions zshrc
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,4 @@ function peco-select-history() {
}
bindkey '^r' peco-select-history

export DOCKER_HOST=$(limactl list docker --format 'unix://{{.Dir}}/sock/docker.sock')

0 comments on commit caa7daf

Please sign in to comment.