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

Upgrading bazel and ruby #134

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .bazelversion
Original file line number Diff line number Diff line change
@@ -1 +1 @@
4.1.0
5.2.0
4 changes: 2 additions & 2 deletions .circleci/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#
# rules_ruby circleci Docker file.
#
FROM ruby:3.0.2
FROM ruby:3.1.2

# make Apt non-interactive
RUN echo 'APT::Get::Assume-Yes "true";' > /etc/apt/apt.conf.d/90circleci \
Expand Down Expand Up @@ -92,7 +92,7 @@ RUN apt-get update && apt-get upgrade

RUN apt-get install -y openjdk-11-jdk python2.7 python3 golang-go

RUN curl -L -o /usr/bin/bazel https://github.com/bazelbuild/bazelisk/releases/download/v1.3.0/bazelisk-linux-amd64 \
RUN curl -L -o /usr/bin/bazel https://github.com/bazelbuild/bazelisk/releases/download/v1.12.0/bazelisk-linux-amd64 \
&& sudo chmod +x /usr/bin/bazel

RUN cd /usr/bin && ln -s python3 python
Expand Down
14 changes: 14 additions & 0 deletions .circleci/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
## `build.sh`

Anytime you change the Ruby version you must push a new image to Docker Hub.

Email kigster@gmail.com to be added to bazelruby org on hub.docker.com.

### To Upgrade

Change the ruby version in the `Dockerfile` and run:

```bash
cd .circleci
./build.sh
```
2 changes: 1 addition & 1 deletion .circleci/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ echo

set -x

docker build . -t bazelruby/ruby-$RUBY_VERSION
docker build --platform linux/x86_64 . -t bazelruby/ruby-$RUBY_VERSION

docker push bazelruby/ruby-$RUBY_VERSION

2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ jobs:
working_directory: /home/circleci/repo
resource_class: medium
docker:
- image: bazelruby/ruby-3.0.2
- image: bazelruby/ruby-3.1.2
environment:
PATH: "/usr/local/bin:/usr/bin:/sbin:/opt/bin:/home/circleci/repo/bin:/bin:/sbin:/usr/sbin"
BUNDLE_PATH: /home/circleci/.bundle_cache
Expand Down
2 changes: 1 addition & 1 deletion .ruby-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.0.2
3.1.2
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
# Changelog

## [Unreleased](https://github.com/bazelruby/rules_ruby/tree/HEAD)

[Full Changelog](https://github.com/bazelruby/rules_ruby/compare/v0.6.0...HEAD)

**Merged pull requests:**

- Bump nokogiri from 1.13.3 to 1.13.4 in /examples/simple\_rails\_api [\#130](https://github.com/bazelruby/rules_ruby/pull/130) ([dependabot[bot]](https://github.com/apps/dependabot))
- Bump puma from 4.3.11 to 4.3.12 in /examples/simple\_rails\_api [\#126](https://github.com/bazelruby/rules_ruby/pull/126) ([dependabot[bot]](https://github.com/apps/dependabot))
- Add SDK versions: 2.6.9,2.7.5,3.0.3,3.1.0,3.1.0 [\#123](https://github.com/bazelruby/rules_ruby/pull/123) ([matsubara0507](https://github.com/matsubara0507))
- Bump nokogiri from 1.12.5 to 1.13.3 in /examples/simple\_rails\_api [\#122](https://github.com/bazelruby/rules_ruby/pull/122) ([dependabot[bot]](https://github.com/apps/dependabot))
- Bump puma from 4.3.9 to 4.3.11 in /examples/simple\_rails\_api [\#121](https://github.com/bazelruby/rules_ruby/pull/121) ([dependabot[bot]](https://github.com/apps/dependabot))

## [v0.6.0](https://github.com/bazelruby/rules_ruby/tree/v0.6.0) (2021-11-09)

[Full Changelog](https://github.com/bazelruby/rules_ruby/compare/v0.5.2...v0.6.0)
Expand Down
Binary file modified README.pdf
Binary file not shown.
2 changes: 1 addition & 1 deletion WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ load("@bazel_skylib//lib:versions.bzl", "versions")

versions.check("3.4.1")

rules_ruby_select_sdk("3.0.2")
rules_ruby_select_sdk("3.1.2")

local_repository(
name = "bazelruby_rules_ruby_ruby_tests_testdata_another_workspace",
Expand Down
21 changes: 18 additions & 3 deletions bin/setup
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@

source "bin/deps"

export ruby_version="$(cat .ruby-version | tr -d '\n')"

#—————————————————————————————————————————————————————————————————————————————————————————————————————————————
# Private Functions
#—————————————————————————————————————————————————————————————————————————————————————————————————————————————
Expand All @@ -30,8 +32,19 @@ __setup.actions() {
#—————————————————————————————————————————————————————————————————————————————————————————————————————————————

setup.rbenv() {
command -v rbenv >/dev/null || {
if [[ $(uname -s) == "Darwin" ]]; then
command -v brew>/dev/null || /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
brew.install.packages rbenv ruby-build
brew.upgrade.packages rbenv ruby-build
else
setup.local-rbenv
fi
}
}

setup.local-rbenv() {
local rbenv_home="${HOME}/.rbenv"
local ruby_version="$(cat .ruby-version | tr -d '\n')"

if [[ -n $(command -v ruby) ]]; then
local installed_version="$(ruby -e 'puts RUBY_VERSION' | tr -d '\n')"
Expand Down Expand Up @@ -65,9 +78,10 @@ setup.rbenv() {
error "PATH: ${PATH}"
return 1
}
}

# Set our current ruby version to the desired one, even if it's not yet there.
# This allows the next block to auto-detect it and skip the remainder.
setup.ruby() {
run "rbenv install -s ${ruby_version}"
run "rbenv global ${ruby_version} || true"
# see if we even need to install anything:
local ruby_sdk_marker="$(rbenv versions | grep "${ruby_version}" | cut -d ' ' -f 1)"
Expand Down Expand Up @@ -171,6 +185,7 @@ setup.main() {
set +e
h2 "Installing required development dependencies for working with rules_ruby and Bazel."
setup.rbenv
setup.ruby
setup.gems
[[ -z ${CI} ]] && setup.git-hook
setup.os-specific "$@"
Expand Down
12 changes: 5 additions & 7 deletions bin/setup-darwin
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/usr/bin/env bash
# vim: ft=bash
# —————————————————————————————————————————————————————————————————————————————————————
# NOTE: These setup scripts rely on an open source BASH framework BashMatic.
# https://github.com/kigster/bashmatic
Expand Down Expand Up @@ -52,24 +53,21 @@ setup.xcode-tools() {
info: "xcode-select tools are already installed."
fi

info "Next command requires sudo privileges to accept XCode License"
run.set-next show-output-on
run "sudo xcodebuild -license accept"
info "Next command may require a sudo privileges to accept XCode License"
bin/xcode-accept
}

setup.bazel() {
brew.package.is-installed bazelisk &&
brew.uninstall.package bazelisk &&
run "brew unlink bazel"
brew.uninstall.package bazelisk 1>/dev/null 2>/dev/null &&
run "brew unlink bazel 2>/dev/null || true"

if __setup.is-bazelisk-installed && __setup.is-bazel-installed ; then
info: "Bazel & bazelisk are already installed."
else
brew.install.packages bazel bazelisk
run "brew link bazel || true"
fi


}

setup.darwin() {
Expand Down
13 changes: 13 additions & 0 deletions bin/xcode-accept
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/usr/bin/env bash
# vim: ft=bash

# https://stackoverflow.com/questions/58632629/how-to-check-if-xcode-license-needs-to-be-accepted

XCODE_VERSION=$(xcodebuild -version | grep '^Xcode\s' | sed -E 's/^Xcode[[:space:]]+([0-9\.]+)/\1/')
ACCEPTED_LICENSE_VERSION=$(defaults read /Library/Preferences/com.apple.dt.Xcode 2> /dev/null | grep IDEXcodeVersionForAgreedToGMLicense | cut -d '"' -f 2)

if [[ "$XCODE_VERSION" = "$ACCEPTED_LICENSE_VERSION" ]]; then
exit 0
else
exit 1
fi
2 changes: 1 addition & 1 deletion examples/simple_rails_api/WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ load(

rules_ruby_dependencies()

rules_ruby_select_sdk(version = "3.0.2")
rules_ruby_select_sdk(version = "3.1.2")

load("@bazel_skylib//:workspace.bzl", "bazel_skylib_workspace")

Expand Down
2 changes: 1 addition & 1 deletion examples/simple_script/.ruby-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.0.2
3.1.2
2 changes: 1 addition & 1 deletion examples/simple_script/WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ load(

rules_ruby_dependencies()

rules_ruby_select_sdk(version = "3.0.2")
rules_ruby_select_sdk(version = "3.1.2")

load("@bazelruby_rules_ruby//ruby:defs.bzl", "ruby_bundle")

Expand Down
1 change: 1 addition & 0 deletions ruby/private/sdk.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ def rules_ruby_select_sdk(version = "host"):
"3.0.3",
"3.1.0",
"3.1.1",
"3.1.2",
]

if version in supported_versions:
Expand Down
2 changes: 1 addition & 1 deletion ruby/tests/testdata/bundle_includes_workspace/WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ load(

rules_ruby_dependencies()

rules_ruby_select_sdk(version = "3.0.2")
rules_ruby_select_sdk(version = "3.1.2")

load("@bazelruby_rules_ruby//ruby:defs.bzl", "ruby_bundle")

Expand Down