diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml deleted file mode 100644 index 9bb02a2..0000000 --- a/.github/workflows/test.yaml +++ /dev/null @@ -1,32 +0,0 @@ -name: test -on: [push] - -jobs: - coder_cli: - strategy: - matrix: - os: [macos-latest, ubuntu-latest] - runs-on: ${{ matrix.os }} - steps: - - uses: actions/checkout@v1 - - run: | - if [[ "$(uname -s)" == "Linux" ]] - then - echo "/home/linuxbrew/.linuxbrew/bin:/home/linuxbrew/.linuxbrew/sbin" >> $GITHUB_PATH - fi - - run: brew install --build-from-source ./coder-cli.rb - - run: coder --version - coder_cli_nightly: - strategy: - matrix: - os: [macos-latest, ubuntu-latest] - runs-on: ${{ matrix.os }} - steps: - - uses: actions/checkout@v1 - - run: | - if [[ "$(uname -s)" == "Linux" ]] - then - echo "/home/linuxbrew/.linuxbrew/bin:/home/linuxbrew/.linuxbrew/sbin" >> $GITHUB_PATH - fi - - run: brew install --build-from-source ./coder-cli-nightly.rb - - run: coder --version diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..fd392b3 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,46 @@ +name: test + +on: + push: + branches: ["main"] + pull_request: + branches: ["**"] + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: ${{ github.event_name == 'pull_request' }} + +jobs: + test: + strategy: + fail-fast: false + matrix: + os: [ubuntu-22.04, macos-13] + + runs-on: ${{ matrix.os }} + + steps: + - name: Set up Homebrew + id: set-up-homebrew + uses: Homebrew/actions/setup-homebrew@master + + - name: Cache Homebrew Bundler RubyGems + id: cache + uses: actions/cache@v4 + with: + path: ${{ steps.set-up-homebrew.outputs.gems-path }} + key: ${{ runner.os }}-rubygems-${{ steps.set-up-homebrew.outputs.gems-hash }} + restore-keys: ${{ runner.os }}-rubygems- + + - name: Install Homebrew Bundler RubyGems + if: steps.cache.outputs.cache-hit != 'true' + run: brew install-bundler-gems + + - run: brew test-bot --only-cleanup-before + + - run: brew test-bot --only-setup + + - run: brew test-bot --only-tap-syntax + + - run: brew test-bot --only-formulae + if: github.event_name == 'pull_request' diff --git a/Casks/coder-desktop-preview.rb b/Casks/coder-desktop-preview.rb new file mode 100644 index 0000000..ac65ae7 --- /dev/null +++ b/Casks/coder-desktop-preview.rb @@ -0,0 +1,34 @@ +cask "coder-desktop-preview" do + version "0.5.1.6" + sha256 :no_check + + url "https://github.com/coder/coder-desktop-macos/releases/download/preview/Coder-Desktop.pkg" + name "Coder Desktop" + desc "Native desktop client for Coder" + homepage "https://github.com/coder/coder-desktop-macos" + + deprecate! date: "2025-06-02", + because: <<~REASON + preview builds should now be installed via the built-in update mechanism. + We recommend uninstalling this cask, installing the non-preview version, + and then switching to the 'preview' channel in the app settings. + REASON + + conflicts_with cask: "coder/coder/coder-desktop" + depends_on macos: ">= :sonoma" + + pkg "Coder-Desktop.pkg" + + uninstall quit: [ + "com.coder.Coder-Desktop", + "com.coder.Coder-Desktop.VPN", + ], + login_item: "Coder Desktop" + + zap delete: "/var/root/Library/Containers/com.Coder-Desktop.VPN/Data/Documents/coder-vpn.dylib", + trash: [ + "~/Library/Caches/com.coder.Coder-Desktop", + "~/Library/HTTPStorages/com.coder.Coder-Desktop", + "~/Library/Preferences/com.coder.Coder-Desktop.plist", + ] +end diff --git a/Casks/coder-desktop.rb b/Casks/coder-desktop.rb new file mode 100644 index 0000000..2843027 --- /dev/null +++ b/Casks/coder-desktop.rb @@ -0,0 +1,27 @@ +cask "coder-desktop" do + version "0.6.0" + sha256 "3bcbdc3792610e83c67e4dabd8c7b158fe71e8ac0be2aea6b095d20a34f823ea" + + url "https://github.com/coder/coder-desktop-macos/releases/download/v#{version}/Coder-Desktop.pkg" + name "Coder Desktop" + desc "Native desktop client for Coder" + homepage "https://github.com/coder/coder-desktop-macos" + + auto_updates true + depends_on macos: ">= :sonoma" + + pkg "Coder-Desktop.pkg" + + uninstall quit: [ + "com.coder.Coder-Desktop", + "com.coder.Coder-Desktop.VPN", + ], + login_item: "Coder Desktop" + + zap delete: "/var/root/Library/Containers/com.Coder-Desktop.VPN/Data/Documents/coder-vpn.dylib", + trash: [ + "~/Library/Caches/com.coder.Coder-Desktop", + "~/Library/HTTPStorages/com.coder.Coder-Desktop", + "~/Library/Preferences/com.coder.Coder-Desktop.plist", + ] +end diff --git a/Formula/coder.rb b/Formula/coder.rb new file mode 100644 index 0000000..d115128 --- /dev/null +++ b/Formula/coder.rb @@ -0,0 +1,32 @@ +class Coder < Formula + desc "Provisions remote development environments via Terraform" + homepage "https://github.com/coder/coder" + version "2.23.0" + + if OS.mac? + if Hardware::CPU.arm? + url "https://github.com/coder/coder/releases/download/v#{version}/coder_#{version}_darwin_arm64.zip" + sha256 "6868a8d1f86fc9c6a97b6bcf62b0219e28ab7526e34b36d9b5f14876197580d9" + else + url "https://github.com/coder/coder/releases/download/v#{version}/coder_#{version}_darwin_amd64.zip" + sha256 "0080b9001d2b69ee4248355e25adaeaebc61fb87815135fc7e139261ce1f5f9f" + end + else + url "https://github.com/coder/coder/releases/download/v#{version}/coder_#{version}_linux_amd64.tar.gz" + sha256 "ff4672d1c1e871a851acb462ffe2cadbdea03f975910d82e7225fe87d07228c1" + end + + def install + bin.install "coder" + end + + test do + version_output = shell_output("#{bin}/coder version") + assert_match version.to_s, version_output + refute_match "AGPL", version_output + assert_match "Full build", version_output + + assert_match "You are not logged in", shell_output("#{bin}/coder netcheck 2>&1", 1) + assert_match "postgres://", shell_output("#{bin}/coder server postgres-builtin-url") + end +end diff --git a/Formula/coder@1.rb b/Formula/coder@1.rb new file mode 100644 index 0000000..810a170 --- /dev/null +++ b/Formula/coder@1.rb @@ -0,0 +1,27 @@ +class CoderAT1 < Formula + desc "Command-line tool for the Coder remote development platform" + homepage "https://github.com/coder/coder-v1-cli" + version "1.44.6" + + if OS.mac? + url "https://github.com/coder/coder-v1-cli/releases/download/v#{version}/coder-cli-darwin-amd64.zip" + sha256 "25f1520691adc672c8b0d2acd102a9d73c27ac6a7c935d7f45a88b982bbce772" + else + url "https://github.com/coder/coder-v1-cli/releases/download/v#{version}/coder-cli-linux-amd64.tar.gz" + sha256 "40caa4cc57cae3533b3a66bf6ca49e1931c3d265f0bd6fefa39ec927c23d1214" + end + + keg_only :versioned_formula + + def version_suffix + version.major.to_s + end + + def install + bin.install "coder" + end + + test do + system "#{bin}/coder", "--version" + end +end diff --git a/README.md b/README.md index 1a1048a..4c3f907 100644 --- a/README.md +++ b/README.md @@ -1,15 +1,19 @@ # Coder Homebrew Tap -A Homebrew Tap for Coder related utilities and applications. +Provides official formulae for [Coder] products ## Usage -```text -brew tap coder/coder +#### Install [Coder] + +```sh +brew install coder/coder/coder ``` -### Install the [Coder CLI](https://github.com/cdr/coder-cli) +#### Install Coder v1 (legacy) -```text -brew install coder-cli +```sh +brew install coder/coder/coder@1 ``` + +[coder]: https://github.com/coder/coder diff --git a/ci/update.sh b/ci/update.sh deleted file mode 100755 index 56a923c..0000000 --- a/ci/update.sh +++ /dev/null @@ -1,28 +0,0 @@ -#!/bin/bash - -# Updates both the coder-cli and coder-cli-nightly formulae to have the given -# values. -# ./update.sh "" "" "" - -set -euo pipefail -cd "$(dirname "$0")" - -version="$1" -darwin_sha="$(echo "$2" | tr "[:upper:]" "[:lower:]")" -linux_sha="$(echo "$3" | tr "[:upper:]" "[:lower:]")" - -# Get the old version to use in our find/replace. -old_version="$(sed -n "s/.*version \"\(.*\)\".*/\1/p" ../coder-cli.rb)" -if [[ "$old_version" == "" ]]; then - echo "Could not determine the old version of the formula..." >&2 - exit 1 -fi - -# Replace version -sed -i "s/${old_version//./\.}/${version//./\.}/g" ../coder-cli{,-nightly}.rb - -# Darwin amd64 SHA256. This only selects the first match -sed -zi "s/sha256 \"[a-f0-9]*\"/sha256 \"$darwin_sha\"/1" ../coder-cli{,-nightly}.rb - -# Linux amd64 SHA256. This only selects the second match -sed -zi "s/sha256 \"[a-f0-9]*\"/sha256 \"$linux_sha\"/2" ../coder-cli{,-nightly}.rb diff --git a/coder-cli-nightly.rb b/coder-cli-nightly.rb deleted file mode 100644 index 42e0f1d..0000000 --- a/coder-cli-nightly.rb +++ /dev/null @@ -1,20 +0,0 @@ -class CoderCliNightly < Formula - desc "Command-line tool for the Coder remote development platform, nightly release channel" - homepage "https://github.com/cdr/coder-cli" - version "1.39.0" - - if OS.mac? - url "https://github.com/cdr/coder-cli/releases/download/v1.39.0/coder-cli-darwin-amd64.zip" - sha256 "74c3685384dc16cee77e4a6503d2f97d24d73ea61e1b12a5b53fcb307592c57a" - else - url "https://github.com/cdr/coder-cli/releases/download/v1.39.0/coder-cli-linux-amd64.tar.gz" - sha256 "c9d04ba28715bc480de970077a4712165f79be054ddfe79406e1afcce1d16f35" - end - - def install - bin.install "coder" - end - test do - system "#{bin}/coder", "--version" - end -end diff --git a/coder-cli.rb b/coder-cli.rb deleted file mode 100644 index 2d607fd..0000000 --- a/coder-cli.rb +++ /dev/null @@ -1,20 +0,0 @@ -class CoderCli < Formula - desc "Command-line tool for the Coder remote development platform" - homepage "https://github.com/cdr/coder-cli" - version "1.39.0" - - if OS.mac? - url "https://github.com/cdr/coder-cli/releases/download/v1.39.0/coder-cli-darwin-amd64.zip" - sha256 "74c3685384dc16cee77e4a6503d2f97d24d73ea61e1b12a5b53fcb307592c57a" - else - url "https://github.com/cdr/coder-cli/releases/download/v1.39.0/coder-cli-linux-amd64.tar.gz" - sha256 "c9d04ba28715bc480de970077a4712165f79be054ddfe79406e1afcce1d16f35" - end - - def install - bin.install "coder" - end - test do - system "#{bin}/coder", "--version" - end -end diff --git a/formula_renames.json b/formula_renames.json new file mode 100644 index 0000000..ac8adc9 --- /dev/null +++ b/formula_renames.json @@ -0,0 +1,4 @@ +{ + "coder-cli-nightly": "coder@1", + "coder-cli": "coder@1" +} diff --git a/scripts/update-v1.sh b/scripts/update-v1.sh new file mode 100755 index 0000000..f75a705 --- /dev/null +++ b/scripts/update-v1.sh @@ -0,0 +1,20 @@ +#!/bin/bash + +# Updates the coder@1 formula +# ./update.sh "" "" "" + +set -euo pipefail +cd "$(dirname "$0")" + +version="$1" +darwin_sha="$(echo "$2" | tr "[:upper:]" "[:lower:]")" +linux_sha="$(echo "$3" | tr "[:upper:]" "[:lower:]")" + +# Replace version +sed -i "s/version \"[0-9.]*\"/version \"${version}\"/g" "../Formula/coder@1.rb" + +# Update macOS hash +sed -zi "s/sha256 \"[a-f0-9]*\"/sha256 \"${darwin_sha}\"/1" "../Formula/coder@1.rb" + +# Update Linux hash +sed -zi "s/sha256 \"[a-f0-9]*\"/sha256 \"${linux_sha}\"/2" "../Formula/coder@1.rb" diff --git a/scripts/update-v2.sh b/scripts/update-v2.sh new file mode 100755 index 0000000..30784c3 --- /dev/null +++ b/scripts/update-v2.sh @@ -0,0 +1,24 @@ +#!/bin/bash + +# Updates the coder formula +# ./update.sh "" "" "" "" + +set -euo pipefail +cd "$(dirname "$0")" + +version="$1" +darwin_arm_sha="$(echo "$2" | tr "[:upper:]" "[:lower:]")" +darwin_intel_sha="$(echo "$3" | tr "[:upper:]" "[:lower:]")" +linux_sha="$(echo "$4" | tr "[:upper:]" "[:lower:]")" + +# Replace version +sed -i "s/version \"[0-9.]*\"/version \"${version}\"/g" "../Formula/coder.rb" + +# Update macOS ARM hash +sed -zi "s/sha256 \"[a-f0-9]*\"/sha256 \"${darwin_arm_sha}\"/1" "../Formula/coder.rb" + +# Update macOS Intel hash +sed -zi "s/sha256 \"[a-f0-9]*\"/sha256 \"${darwin_intel_sha}\"/2" "../Formula/coder.rb" + +# Update Linux hash +sed -zi "s/sha256 \"[a-f0-9]*\"/sha256 \"${linux_sha}\"/3" "../Formula/coder.rb"