diff --git a/.github/workflows/container.yaml b/.github/workflows/container.yaml index 4fa5ea0..9f9a1f2 100644 --- a/.github/workflows/container.yaml +++ b/.github/workflows/container.yaml @@ -132,10 +132,7 @@ jobs: cache-to: type=local,mode=max,dest=/tmp/.buildx-cache-new - name: Run Tests amd64 - run: docker run --rm --platform amd64 localhost:5000/${{ matrix.os }}:latest /home/devcontainer/.local/bin/check-dotfiles - - - name: Run Tests arm64 - run: docker run --rm --platform arm64 localhost:5000/${{ matrix.os }}:latest /home/devcontainer/.local/bin/check-dotfiles + run: docker run --rm --platform amd64 localhost:5000/${{ matrix.os }}:latest /bin/zsh -c 'source /home/devcontainer/.zshenv && /home/devcontainer/.local/bin/check-dotfiles' - name: Generate Image Metadata id: metadata diff --git a/.github/workflows/github.yaml b/.github/workflows/github.yaml index 81d80da..5716017 100644 --- a/.github/workflows/github.yaml +++ b/.github/workflows/github.yaml @@ -76,5 +76,16 @@ jobs: HOMEBREW_NO_INSTALL_CLEANUP: 1 run: ./install.sh - - name: Run tests - run: ~/.local/bin/check-dotfiles + - name: Switch to ZSH + if: runner.os == 'Linux' + shell: /home/linuxbrew/.linuxbrew/bin/zsh {0} + run: | + source ~/.zshenv + ~/.local/bin/check-dotfiles + + - name: Switch to ZSH + if: runner.os == 'macOS' + shell: /usr/local/bin/zsh {0} + run: | + source ~/.zshenv + ~/.local/bin/check-dotfiles diff --git a/containers/debian/Dockerfile b/containers/debian/Dockerfile index 0d75ab7..69b82d5 100644 --- a/containers/debian/Dockerfile +++ b/containers/debian/Dockerfile @@ -15,6 +15,7 @@ RUN set -eux \ && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \ apt-transport-https \ bash \ + build-essential \ ca-certificates \ curl \ dialog \ diff --git a/containers/ubuntu/Dockerfile b/containers/ubuntu/Dockerfile index a0fbfa4..ed6b0d6 100644 --- a/containers/ubuntu/Dockerfile +++ b/containers/ubuntu/Dockerfile @@ -15,6 +15,7 @@ RUN set -eux \ && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \ apt-transport-https \ bash \ + build-essential \ ca-certificates \ curl \ dialog \ diff --git a/home/.chezmoiscripts/darwin/run_onchange_before_10_install-darwin-packages.tmpl b/home/.chezmoiscripts/darwin/run_onchange_before_10_install-darwin-packages.tmpl index a56e1bd..21c6c63 100644 --- a/home/.chezmoiscripts/darwin/run_onchange_before_10_install-darwin-packages.tmpl +++ b/home/.chezmoiscripts/darwin/run_onchange_before_10_install-darwin-packages.tmpl @@ -1,13 +1,23 @@ #!/usr/bin/env bash +# Install XCode xcode-select -p >/dev/null 2>&1 || xcode-select --install +{{- if .host.headless }} +# Install Visual Studio Code +curl -fsSL -o vscode.zip https://code.visualstudio.com/sha/download?build=stable\&os=darwin-universal +unzip -q vscode.zip +rm vscode.zip +mv "Visual Studio Code.app" /Applications/ +ln -s "/Applications/Visual Studio Code.app/Contents/Resources/app/bin/code" /usr/local/bin/code +{{- end }} + if ! command -v brew >/dev/null 2>&1; then echo "Installing Homebrew..." /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" fi -{{ if eq .host.arch "arm64" -}} +{{- if eq .host.arch "arm64" }} eval $(/opt/homebrew/bin/brew shellenv) {{- else }} eval $(/usr/local/bin/brew shellenv) @@ -17,6 +27,7 @@ brew update # Temporary Overrides brew install --overwrite python@3.11 +brew install --overwrite python@3.12 brew install --overwrite go brew bundle --verbose --no-lock --file=/dev/stdin </dev/null 2>&1; then /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" fi -{{ if eq .host.arch "arm64" -}} +{{- if eq .host.arch "arm64" }} eval $(/home/linuxbrew/.linuxbrew/bin/brew shellenv) {{- else }} eval $(/home/linuxbrew/.linuxbrew/bin/brew shellenv) diff --git a/home/.chezmoiscripts/ubuntu/run_onchange_before_10_install-ubuntu-packages.tmpl b/home/.chezmoiscripts/ubuntu/run_onchange_before_10_install-ubuntu-packages.tmpl index 4d27103..01a429d 100644 --- a/home/.chezmoiscripts/ubuntu/run_onchange_before_10_install-ubuntu-packages.tmpl +++ b/home/.chezmoiscripts/ubuntu/run_onchange_before_10_install-ubuntu-packages.tmpl @@ -12,7 +12,7 @@ if ! command -v brew >/dev/null 2>&1; then /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" fi -{{ if eq .host.arch "arm64" -}} +{{- if eq .host.arch "arm64" }} eval $(/home/linuxbrew/.linuxbrew/bin/brew shellenv) {{- else }} eval $(/home/linuxbrew/.linuxbrew/bin/brew shellenv) diff --git a/home/.chezmoitemplates/universal/packages b/home/.chezmoitemplates/universal/packages index 9f45c28..b469911 100644 --- a/home/.chezmoitemplates/universal/packages +++ b/home/.chezmoitemplates/universal/packages @@ -1,6 +1,7 @@ {{- $packages := list "ack" "age" + "awk" "bash" "bat" "cmake" @@ -30,6 +31,7 @@ "watch" "wget" "zplug" + "zsh" "zsh-autosuggestions" "zsh-syntax-highlighting" -}} diff --git a/home/dot_local/share/dotfiles/exact_test/test-packages.bats.tmpl b/home/dot_local/share/dotfiles/exact_test/test-packages.bats.tmpl index 3552086..d21bc07 100644 --- a/home/dot_local/share/dotfiles/exact_test/test-packages.bats.tmpl +++ b/home/dot_local/share/dotfiles/exact_test/test-packages.bats.tmpl @@ -81,13 +81,6 @@ setup() { assert_success } -{{ if eq .host.distro.family "darwin" }} -@test "mas" { - run mas - assert_success -} -{{ end }} - {{ if .toolchains.docker }} @test "docker" { run docker --help diff --git a/home/dot_zshenv b/home/dot_zshenv index 96de268..edd8df0 100644 --- a/home/dot_zshenv +++ b/home/dot_zshenv @@ -1 +1,2 @@ -export ZDOTDIR=$HOME/.config/zsh/ +ZDOTDIR=$HOME/.config/zsh/ +source -- "$ZDOTDIR"/.zshrc diff --git a/home/private_dot_config/shell/dot_bash_exports.tmpl b/home/private_dot_config/shell/dot_bash_exports.tmpl index 72c1600..e563de3 100644 --- a/home/private_dot_config/shell/dot_bash_exports.tmpl +++ b/home/private_dot_config/shell/dot_bash_exports.tmpl @@ -75,15 +75,19 @@ export ZSH_EVALCACHE_DIR="$XDG_CACHE_HOME/zsh-evalcache" # GPG # https://stackoverflow.com/a/42265848/96656 +{{- if not .host.headless }} export GPG_TTY=$(tty); +{{- end }} # Hyper {{- if eq .host.distro.family "darwin" }} +{{- if not .host.headless }} launchctl setenv XDG_CONFIG_HOME "$XDG_CONFIG_HOME" launchctl setenv XDG_DATA_HOME "$XDG_DATA_HOME" launchctl setenv XDG_CACHE_HOME "$XDG_CACHE_HOME" launchctl setenv PATH "$PATH" {{- end }} +{{- end }} # NodeJS export NODE_REPL_HISTORY_SIZE='32768'; diff --git a/home/private_dot_config/zsh/dot_zshrc.tmpl b/home/private_dot_config/zsh/dot_zshrc.tmpl index a0a9c52..2d63a1c 100644 --- a/home/private_dot_config/zsh/dot_zshrc.tmpl +++ b/home/private_dot_config/zsh/dot_zshrc.tmpl @@ -15,12 +15,16 @@ export HOMEBREW_NO_AUTO_UPDATE=1 -{{ if eq .chezmoi.os "linux" -}} +{{- if eq .chezmoi.os "linux" }} eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)" {{- end }} -{{ if eq .chezmoi.os "darwin" -}} +{{- if eq .chezmoi.os "darwin" }} +{{- if eq .host.arch "arm64" }} eval "$(/opt/homebrew/bin/brew shellenv)" +{{- else }} +eval "$(/usr/local/bin/brew shellenv)" +{{- end }} {{- end }} # Powerlevel10k Configuration @@ -131,14 +135,13 @@ setopt rm_star_silent # ----------------------------------------------------------------------------- export NVM_DIR="$HOME/.nvm" -[ -s "/opt/homebrew/opt/nvm/nvm.sh" ] && \. "/opt/homebrew/opt/nvm/nvm.sh" -[ -s "/opt/homebrew/opt/nvm/etc/bash_completion.d/nvm" ] && \. "/opt/homebrew/opt/nvm/etc/bash_completion.d/nvm" # Python Configuration # ----------------------------------------------------------------------------- ln -sf "$(brew --prefix)/bin/python"{3,} + # Includes # ----------------------------------------------------------------------------- @@ -157,6 +160,7 @@ if [ -f "$HOME"/.config/shell/.bash_functions ]; then \. "$HOME"/.config/shell/.bash_functions fi +{{- if eq .chezmoi.os "linux" }} {{- if .toolchains.kubernetes }} # Load cross-compatible Kubernetes alias definitions from separate file. if [ -f "$HOME"/.config/kubernetes/.kube_aliases ]; then @@ -168,3 +172,4 @@ if [ -f "$HOME"/.config/kubernetes/.kube_functions ]; then \. "$HOME"/.config/kubernetes/.kube_functions fi {{- end }} +{{- end }}