From 4a87c852dfce2b657c31f1787518d7371e2f69e2 Mon Sep 17 00:00:00 2001 From: Iovesophy <15680172+Iovesophy@users.noreply.github.com> Date: Thu, 10 Nov 2022 16:32:39 +0900 Subject: [PATCH 1/3] ADD: lima install task --- install_playbook.yml | 2 +- roles/homebrew/vars/main.yml | 2 ++ roles/lima/tasks/lima.yml | 26 ++++++++++++++++++++++++++ roles/lima/tasks/main.yml | 6 ++++++ zshrc | 1 + 5 files changed, 36 insertions(+), 1 deletion(-) create mode 100644 roles/lima/tasks/lima.yml create mode 100644 roles/lima/tasks/main.yml diff --git a/install_playbook.yml b/install_playbook.yml index 6548ae1..75602aa 100644 --- a/install_playbook.yml +++ b/install_playbook.yml @@ -6,6 +6,6 @@ gather_facts: no roles: - homebrew - - dmg - vim + - lima diff --git a/roles/homebrew/vars/main.yml b/roles/homebrew/vars/main.yml index 8cda09f..4337f6a 100644 --- a/roles/homebrew/vars/main.yml +++ b/roles/homebrew/vars/main.yml @@ -7,3 +7,5 @@ pkg: - name: vint - name: zsh-git-prompt - name: neovim + - name: lima + - name: docker diff --git a/roles/lima/tasks/lima.yml b/roles/lima/tasks/lima.yml new file mode 100644 index 0000000..716aefb --- /dev/null +++ b/roles/lima/tasks/lima.yml @@ -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 diff --git a/roles/lima/tasks/main.yml b/roles/lima/tasks/main.yml new file mode 100644 index 0000000..e8f5ab8 --- /dev/null +++ b/roles/lima/tasks/main.yml @@ -0,0 +1,6 @@ +--- +- block: + - include_tasks: lima.yml + tags: + - lima + diff --git a/zshrc b/zshrc index 56c4762..dfb393a 100644 --- a/zshrc +++ b/zshrc @@ -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') From ce36255ecbcd00400a10bc4774f1d6165168d8ce Mon Sep 17 00:00:00 2001 From: Iovesophy <15680172+Iovesophy@users.noreply.github.com> Date: Thu, 10 Nov 2022 16:36:03 +0900 Subject: [PATCH 2/3] Refactor- yml indent --- roles/dmg/tasks/check.yml | 1 - roles/dmg/tasks/install.yml | 5 ++--- roles/dmg/tasks/main.yml | 5 ++--- roles/homebrew/tasks/main.yml | 17 ++++++++--------- roles/lima/tasks/main.yml | 3 +-- roles/vim/tasks/main.yml | 3 +-- roles/vim/tasks/vim-plug.yml | 21 ++++++++++----------- 7 files changed, 24 insertions(+), 31 deletions(-) diff --git a/roles/dmg/tasks/check.yml b/roles/dmg/tasks/check.yml index 06037c1..201c3ea 100644 --- a/roles/dmg/tasks/check.yml +++ b/roles/dmg/tasks/check.yml @@ -1,4 +1,3 @@ - name: docker local_action: stat path=/Applications/Docker.app register: docker - diff --git a/roles/dmg/tasks/install.yml b/roles/dmg/tasks/install.yml index fcdd3f6..4d124ce 100644 --- a/roles/dmg/tasks/install.yml +++ b/roles/dmg/tasks/install.yml @@ -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 - diff --git a/roles/dmg/tasks/main.yml b/roles/dmg/tasks/main.yml index 12202c0..b6f137d 100644 --- a/roles/dmg/tasks/main.yml +++ b/roles/dmg/tasks/main.yml @@ -1,7 +1,6 @@ --- - block: - - include_tasks: check.yml - - include_tasks: install.yml + - include_tasks: check.yml + - include_tasks: install.yml tags: - dmg - diff --git a/roles/homebrew/tasks/main.yml b/roles/homebrew/tasks/main.yml index 29d8585..5b79fcd 100644 --- a/roles/homebrew/tasks/main.yml +++ b/roles/homebrew/tasks/main.yml @@ -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 - diff --git a/roles/lima/tasks/main.yml b/roles/lima/tasks/main.yml index e8f5ab8..00f16cf 100644 --- a/roles/lima/tasks/main.yml +++ b/roles/lima/tasks/main.yml @@ -1,6 +1,5 @@ --- - block: - - include_tasks: lima.yml + - include_tasks: lima.yml tags: - lima - diff --git a/roles/vim/tasks/main.yml b/roles/vim/tasks/main.yml index 969d08a..ae0acf9 100644 --- a/roles/vim/tasks/main.yml +++ b/roles/vim/tasks/main.yml @@ -1,6 +1,5 @@ --- - block: - - include_tasks: vim-plug.yml + - include_tasks: vim-plug.yml tags: - vim - diff --git a/roles/vim/tasks/vim-plug.yml b/roles/vim/tasks/vim-plug.yml index 2baea9d..e449a3b 100644 --- a/roles/vim/tasks/vim-plug.yml +++ b/roles/vim/tasks/vim-plug.yml @@ -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 From 30f0ab503be71c1dd097385d232d2d7b860498a3 Mon Sep 17 00:00:00 2001 From: Iovesophy <15680172+Iovesophy@users.noreply.github.com> Date: Thu, 10 Nov 2022 16:38:47 +0900 Subject: [PATCH 3/3] ADD: upgrade actions checkout v2 to v3 --- .github/workflows/macos.yml | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml index 5b1827d..8f27972 100644 --- a/.github/workflows/macos.yml +++ b/.github/workflows/macos.yml @@ -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