Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

devops: Don't auto-install brew deps #3346

Merged
merged 13 commits into from
Aug 19, 2023
1 change: 1 addition & 0 deletions .github/workflows/pull-request.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,7 @@ jobs:
repo-token: ${{ secrets.GITHUB_TOKEN }}
# Required because of https://github.com/cargo-bins/cargo-binstall/issues/1254
- run: brew install bash
- run: task install-brew-dependencies
- run: task setup-dev
# This also encompasses `build-all`
- run: task test-all
Expand Down
81 changes: 59 additions & 22 deletions Taskfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,33 @@ vars:
mitsuhiko.insta
prql-lang.prql-vscode
rust-lang.rust-analyzer
cargo_crates:
bacon cargo-audit cargo-insta cargo-release default-target mdbook
mdbook-admonish mdbook-footnote mdbook-toc wasm-bindgen-cli wasm-opt
cargo_crates: |
bacon
cargo-audit
cargo-insta
cargo-release
default-target
mdbook
mdbook-admonish
mdbook-footnote
mdbook-toc
wasm-bindgen-cli
wasm-opt
wasm-pack
# Excluding `elixir` atm given it's not enabled on Mac and currently unsupported
brew_dependencies: |
brew
hugo
npm
python3

tasks:
# main installer is "setup-dev" which calls other tasks
setup-dev:
preconditions:
- sh: which clang
msg: |

🔴 Can't find `clang`, which is required to install a full development environment (we use `duckdb` in our tests, which requires it).

Please install it. On MacOS, that's
Expand All @@ -46,13 +62,13 @@ tasks:
desc: Install tools for PRQL development.
cmds:
- task: install-cargo-tools
# We only suggest, rather than install; we don't want to intrude (maybe
# we're being too conservative?).
- task: suggest-vscode-extensions
- task: install-brew-dependencies
- task: install-maturin
- task: install-pre-commit
- task: install-npm-dependencies
# We only suggest, rather than install; we don't want to intrude (maybe
# we're being too conservative?).
- task: suggest-vscode-extensions
- pre-commit install-hooks
- cmd: |
echo "
Expand All @@ -69,8 +85,6 @@ tasks:
# CI atm. If the warnings were less alarming, we could use for all
# installs.
#
# `--locked` installs from the underlying lock files (which is not the
# default...)
- |
{{ if .CI }}
task install-cargo-tools-binstall
Expand All @@ -79,21 +93,23 @@ tasks:
{{ end }}

- cmd: |
[ "$(which cargo-insta)" ] || echo "🔴 Can't find a binary that cargo just installed. Is the cargo bin path (generally at ~/.cargo/bin) on the \$PATH?"
[ "$(which cargo-insta)" ] || echo "🔴 Can't find a binary that cargo just installed. Is the cargo bin path (generally at `~/.cargo/bin`) on the \$PATH?"
silent: true

install-cargo-tools-source:
cmds:
- cargo install --locked {{.cargo_crates}}
# `--locked` installs from the underlying lock files (which is not the
# default...)
- 'cargo install --locked {{.cargo_crates | splitLines | join " " }}'

install-cargo-tools-binstall:
cmds:
- cmd:
curl -L --proto '=https' --tlsv1.2 -sSf
https://raw.githubusercontent.com/cargo-bins/cargo-binstall/main/install-from-binstall-release.sh
| bash
| bash || cargo install --locked binstall
platforms: [linux, darwin]
- cargo binstall -y --locked {{.cargo_crates}}
- 'cargo binstall -y --locked {{.cargo_crates | splitLines | join " " }}'

install-maturin:
desc: Install maturin.
Expand Down Expand Up @@ -144,24 +160,45 @@ tasks:
cmds:
- python3 -m pip install -U pre-commit

install-brew-dependencies:
check-brew-dependencies:
status:
- which hugo
- which npm
# Check for a recent npm version
- |
{{ range $dep := (.brew_dependencies | trim | splitLines) -}}
[ -n "$(which {{ $dep }})" ]
{{ end -}}
- "[ $(npm -v | cut -d. -f1) -ge 9 ]"
- which python3
- which elixir
cmds:
- cmd: |
echo "

🟡 It looks like at least one brew dependency is missing from:

{{ .brew_dependencies }}

These aren't required for initial PRQL development, but they are required for some of the tests.

Install them with:

task install-brew-dependencies
"
silent: true

install-brew-dependencies:
status:
- task check-brew-dependencies
preconditions:
- sh: which brew
msg: |


🔴 Can't find `brew`, which we use to install Hugo & npm. Either install brew and re-run this, or install them directly based on:
- https://gohugo.io/getting-started/installing/
- https://docs.npmjs.com/downloading-and-installing-node-js-and-npm
🔴 Can't find `brew`, which we use to install {{ .brew_dependencies | trim | splitLines | join " & " }}.

Either install brew & re-run this, or install the dependencies with a different approach, or use PRQL without them.
Brew installation instructions at:

https://brew.sh/
cmds:
- brew install hugo npm python3 elixir
- brew install {{.brew_dependencies | trim | splitLines | join " " }}

install-npm-dependencies:
cmds:
Expand Down
Loading