Machine bootstrapping tool with a focus on sensible defaults, conventions, and avoidance of vendoring - This is a mirror
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge pull request #57 from maxfierke/mf-detect_xcode_git_shim

Detect xcode git shim and handle appropriately

authored by mx4ke.xyz and committed by

GitHub 91dc74bc dda0e8d7

+80 -34
+7 -3
.github/workflows/ci.yml
··· 14 14 15 15 steps: 16 16 - name: Checkout 17 - uses: actions/checkout@v3 17 + uses: actions/checkout@v4 18 18 19 + # TODO: Remove openssl@3 reinstall cmd after 20240422.3 is no longer the latest 20 + # macos-14-arm64 image 19 21 - name: Install crystal and tool dependencies 20 - run: brew install crystal meson openssl@3 22 + run: | 23 + brew install crystal meson openssl@3 24 + brew update && brew reinstall openssl@3 21 25 22 26 - name: Install dependencies 23 27 run: shards install ··· 33 37 34 38 steps: 35 39 - name: Checkout 36 - uses: actions/checkout@v3 40 + uses: actions/checkout@v4 37 41 38 42 - name: Add Crystal repos 39 43 run: curl -sSL https://crystal-lang.org/install.sh | sudo bash
+10 -5
.github/workflows/provision.yml
··· 17 17 18 18 jobs: 19 19 macos-provision: 20 - runs-on: macos-latest 20 + runs-on: macos-14 21 21 22 22 steps: 23 23 - name: Checkout 24 - uses: actions/checkout@v3 24 + uses: actions/checkout@v4 25 25 26 + # TODO: Remove openssl@3 reinstall cmd after 20240422.3 is no longer the latest 27 + # macos-14-arm64 image 26 28 - name: Install crystal and tool dependencies 27 - run: brew install crystal meson openssl@3 29 + run: | 30 + brew install crystal meson openssl@3 31 + brew update && brew reinstall openssl@3 28 32 29 33 - name: Install dependencies 30 34 run: shards install ··· 40 44 - name: Make macOS like new 41 45 run: | 42 46 sudo rm -rf /usr/local/bin/brew /usr/local/.??* \ 43 - /usr/local/Homebrew /usr/local/Caskroom \ 47 + /usr/local/Homebrew /opt/homebrew \ 48 + /usr/local/Caskroom \ 44 49 /Library/Developer/CommandLineTools 45 50 46 51 - name: Run mstrap ··· 77 82 78 83 steps: 79 84 - name: Checkout 80 - uses: actions/checkout@v3 85 + uses: actions/checkout@v4 81 86 82 87 - name: Add Crystal repos 83 88 run: curl -sSL https://crystal-lang.org/install.sh | sudo bash
+28 -21
.github/workflows/release.yml
··· 10 10 runs-on: ubuntu-latest 11 11 steps: 12 12 - name: Checkout 13 - uses: actions/checkout@v3 13 + uses: actions/checkout@v4 14 14 15 15 - name: Add Crystal repos 16 16 run: curl -sSL https://crystal-lang.org/install.sh | sudo bash ··· 41 41 LD_FOR_BUILD: lld 42 42 43 43 - name: Upload release bundle artifact 44 - uses: actions/upload-artifact@v3 44 + uses: actions/upload-artifact@v4 45 45 with: 46 46 name: mstrap_linux_amd64 47 47 path: dist ··· 50 50 runs-on: ubuntu-latest 51 51 steps: 52 52 - name: Checkout 53 - uses: actions/checkout@v3 53 + uses: actions/checkout@v4 54 54 55 55 - name: Add Crystal repos 56 56 run: curl -sSL https://crystal-lang.org/install.sh | sudo bash ··· 77 77 make release RELEASE=1 STATIC=1 TARGET_ARCH=aarch64 TARGET_CABI=musl 78 78 79 79 - name: Upload release bundle artifact 80 - uses: actions/upload-artifact@v3 80 + uses: actions/upload-artifact@v4 81 81 with: 82 82 name: mstrap_linux_aarch64 83 83 path: dist 84 84 85 85 build_macos_amd64: 86 - runs-on: macos-latest 86 + runs-on: macos-14 87 87 steps: 88 88 - name: Checkout 89 - uses: actions/checkout@v3 89 + uses: actions/checkout@v4 90 90 91 + # TODO: Remove openssl@3 reinstall cmd after 20240422.3 is no longer the latest 92 + # macos-14-arm64 image 91 93 - name: Install crystal and tool dependencies 92 - run: brew install crystal meson openssl@3 94 + run: | 95 + brew install crystal meson openssl@3 96 + brew update && brew reinstall openssl@3 93 97 94 98 - name: Install dependencies 95 99 run: shards install ··· 113 117 mstrap 114 118 115 119 - name: Build signed & notorized release bundle 116 - run: make release RELEASE=1 STATIC=1 120 + run: make release RELEASE=1 STATIC=1 TARGET_ARCH=x86_64 117 121 118 122 - name: Smoke test the codesigned release 119 123 run: bin/mstrap --help 120 124 121 125 - name: Upload release bundle artifact 122 - uses: actions/upload-artifact@v3 126 + uses: actions/upload-artifact@v4 123 127 with: 124 128 name: mstrap_macos_amd64 125 129 path: dist 126 130 127 131 build_macos_arm64: 128 - runs-on: macos-latest 132 + runs-on: macos-14 129 133 steps: 130 134 - name: Checkout 131 - uses: actions/checkout@v3 135 + uses: actions/checkout@v4 132 136 137 + # TODO: Remove openssl@3 reinstall cmd after 20240422.3 is no longer the latest 138 + # macos-14-arm64 image 133 139 - name: Install crystal and tool dependencies 134 - run: brew install crystal meson openssl@3 140 + run: | 141 + brew install crystal meson openssl@3 142 + brew update && brew reinstall openssl@3 135 143 136 144 - name: Install dependencies 137 145 run: shards install ··· 157 165 - name: Build signed & notorized release bundle 158 166 run: make release RELEASE=1 STATIC=1 TARGET_ARCH=arm64 159 167 160 - # Re-enable after macos-latest is on Apple Silicon 161 - # - name: Smoke test the codesigned release 162 - # run: bin/mstrap --help 168 + - name: Smoke test the codesigned release 169 + run: bin/mstrap --help 163 170 164 171 - name: Upload release bundle artifact 165 - uses: actions/upload-artifact@v3 172 + uses: actions/upload-artifact@v4 166 173 with: 167 174 name: mstrap_macos_arm64 168 175 path: dist ··· 179 186 180 187 - name: Download mstrap_linux_amd64 artifacts 181 188 id: download_linux_amd64 182 - uses: actions/download-artifact@v2 189 + uses: actions/download-artifact@v4 183 190 with: 184 191 name: mstrap_linux_amd64 185 192 path: dist-linux-amd64 186 193 187 194 - name: Download mstrap_linux_aarch64 artifacts 188 195 id: download_linux_aarch64 189 - uses: actions/download-artifact@v2 196 + uses: actions/download-artifact@v4 190 197 with: 191 198 name: mstrap_linux_aarch64 192 199 path: dist-linux-aarch64 193 200 194 201 - name: Download mstrap_macos_amd64 artifacts 195 202 id: download_macos_amd64 196 - uses: actions/download-artifact@v2 203 + uses: actions/download-artifact@v4 197 204 with: 198 205 name: mstrap_macos_amd64 199 206 path: dist-macos-amd64 200 207 201 208 - name: Download mstrap_macos_arm64 artifacts 202 209 id: download_macos_arm64 203 - uses: actions/download-artifact@v2 210 + uses: actions/download-artifact@v4 204 211 with: 205 212 name: mstrap_macos_arm64 206 213 path: dist-macos-arm64 207 214 208 215 - name: Create release 209 216 id: create_release 210 - uses: softprops/action-gh-release@v1 217 + uses: softprops/action-gh-release@v2 211 218 with: 212 219 token: ${{ secrets.GITHUB_TOKEN }} 213 220 draft: false
-5
src/mstrap/platform.cr
··· 10 10 11 11 @@found_commands = Hash(String, String).new 12 12 13 - # Indicates whether the host platform has Git installed 14 - def self.has_git? 15 - ENV["MSTRAP_IGNORE_GIT"]? != "true" && has_command?("git") 16 - end 17 - 18 13 # Indicates whether the host platform has a given command available 19 14 # 20 15 # Lookups are cached by default, but cached info can be skipped by passing
+4
src/mstrap/platform/darwin.cr
··· 6 6 module Darwin 7 7 extend self 8 8 9 + def has_git? 10 + ENV["MSTRAP_IGNORE_GIT"]? != "true" && platform.has_git? 11 + end 12 + 9 13 # :nodoc: 10 14 def platform 11 15 Darwin::MacOS
+26
src/mstrap/platform/darwin/macos.cr
··· 3 3 module MacOS 4 4 extend DSL 5 5 6 + XCODE_CLT_GIT_PATH = "/Library/Developer/CommandLineTools/usr/bin/git" 7 + 8 + @@git_path : String = "" 9 + 10 + # Indicates whether the host platform has Git installed 11 + # 12 + # NOTE: On macOS, there's a few tricks involved due to Xcode shims, so 13 + # we'll only consider it installed if it's from Homebrew (or elsewhere), 14 + # or installed via Xcode Command Line Tools 15 + def self.has_git? 16 + git_path = @@git_path 17 + return true if git_path != "" 18 + 19 + git_path = Process.find_executable("git") 20 + 21 + # Ignore the Xcode CLT shim trickery! 22 + if git_path && git_path == "/usr/bin/git" 23 + git_path = Process.find_executable(XCODE_CLT_GIT_PATH) 24 + end 25 + 26 + return false if git_path.nil? 27 + 28 + @@git_path = git_path 29 + true 30 + end 31 + 6 32 def self.install_packages!(packages : Array(String)) 7 33 cmd("brew", ["install"] + packages) 8 34 end
+5
src/mstrap/platform/linux.cr
··· 118 118 distro_family == DISTRO_UNKNOWN 119 119 end 120 120 121 + # Indicates whether the host platform has Git installed 122 + def has_git? 123 + ENV["MSTRAP_IGNORE_GIT"]? != "true" && has_command?("git") 124 + end 125 + 121 126 # :nodoc: 122 127 def platform 123 128 if arch_distro?