Skip to content

Instantly share code, notes, and snippets.

@LeeBergstrand
Last active September 29, 2021 09:20
Show Gist options
  • Save LeeBergstrand/bcacea4e76bbf20efbd2efc4bb65e781 to your computer and use it in GitHub Desktop.
Save LeeBergstrand/bcacea4e76bbf20efbd2efc4bb65e781 to your computer and use it in GitHub Desktop.
CircleCi config for homebrew
version: 2
jobs:
build:
working_directory: ~/repo
machine: true
steps:
- checkout
# Install Linuxbrew Dependencies Via Apt
- run:
name: Install Dependencies
command: |
sudo apt-get install build-essential python-dev curl file git python-setuptools ruby
# Install Linuxbrew (Note: Adding linuxbrew to the PATH here won't work since each run command runs in its
# own shell. The parent shell (the one that calls each run command) is not affected. We add `yes |` to
# tell linuxbrew to continue installing. We add `|| true` to override the linuxbrew install returning exit
# code 141. There may be a bug in the install of linuxbrew via a password where it returns 141 on a warning
# rather than on an error.)
- run:
name: Install Linuxbrew
command: |
yes | ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Linuxbrew/install/master/install)" || true
# Install Custom Linuxbrew Formulae (Note: Since the parent shell can't be given the path to linuxbrew we
# have to add it to the path within the same run command (child shell).)
- run:
name: Install Custom Formulae
command: |
export PATH="$HOME/.linuxbrew/bin:$PATH"
brew install ./easel.rb
# Run Linuxbrew Tests
- run:
name: Test Custom Formulae
command: |
export PATH="$HOME/.linuxbrew/bin:$PATH"
brew test ./easel.rb
@jeroenvandijk
Copy link

@LeeBergstrand Thanks for sharing! I've used $BASH_ENV to set $PATH once. E.g. something like the following could work here:

      - run:
          name: Setup PATH
          command: |
            echo 'export PATH=$HOME/.linuxbrew/bin:$PATH' >> $BASH_ENV

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment