Skip to content

Commit

Permalink
Fixup config drift causing the Windows Actions to fail
Browse files Browse the repository at this point in the history
  • Loading branch information
HoloRin committed Sep 29, 2022
1 parent 76b79fb commit ad04322
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 17 deletions.
12 changes: 5 additions & 7 deletions .github/workflows/test-windows.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ on:
schedule:
- cron: '0 2 * * *'
workflow_dispatch:
push:
paths:
- .github/workflows/test-windows.yaml
jobs:
test:
name: Test Windows
Expand All @@ -28,11 +31,9 @@ jobs:
#! path: "/home/runner/repo-cache/"
#! key: repo-cache
- name: CONFIGURE BAZEL
id: configure
shell: bash
run: |
ERL_PATH="$(which erl)"
IEX_PATH="$(which iex)"
sed -i"_orig" 's/build --experimental_enable_bzlmod//' .bazelrc
cat << EOF >> user.bazelrc
startup --output_user_root=C:/tmp
startup --windows_enable_symlinks
Expand All @@ -48,10 +49,6 @@ jobs:
build:buildbuddy --disk_cache=
build:buildbuddy --noexperimental_remote_cache_compression
build:buildbuddy --noexperimental_remote_cache_async
build --@rules_erlang//:erlang_version=${{ matrix.erlang_version }}
build --@rules_erlang//:erlang_home="${ERL_PATH/\/bin\/erl/}"
build --//:elixir_home="${IEX_PATH/\/bin\/iex/}"
EOF
bazelisk info release
Expand All @@ -60,6 +57,7 @@ jobs:
run: |
bazelisk test //... ^
--config=buildbuddy ^
--noexperimental_enable_bzlmod ^
--test_tag_filters=-aws,-docker,-bats,-starts-background-broker ^
--build_tests_only ^
--verbose_failures
2 changes: 1 addition & 1 deletion MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ bazel_dep(

bazel_dep(
name = "rules_erlang",
version = "3.7.0",
version = "3.7.1",
)

erlang_config = use_extension(
Expand Down
4 changes: 2 additions & 2 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -105,14 +105,14 @@ load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository")

git_repository(
name = "rbe",
commit = "e96d11e9b2ca5bc7e7256957e718d268ddf3be35", # linux-rbe branch
branch = "linux-rbe",
remote = "https://github.com/rabbitmq/rbe-erlang-platform.git",
)

git_repository(
name = "rules_erlang",
remote = "https://github.com/rabbitmq/rules_erlang.git",
tag = "3.7.0",
tag = "3.7.1",
)

load(
Expand Down
25 changes: 18 additions & 7 deletions bazel/repositories/elixir_config.bzl
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
load(
"@rules_erlang//:util.bzl",
"msys2_path",
"path_join",
)

ELIXIR_HOME_ENV_VAR = "ELIXIR_HOME"
DEFAULT_IEX_PATH = "/usr/local/bin/iex"

_DEFAULT_EXTERNAL_ELIXIR_PACKAGE_NAME = "external"
_ELIXIR_VERSION_UNKNOWN = "UNKNOWN"
Expand Down Expand Up @@ -118,16 +118,27 @@ elixir_config = repository_rule(
],
)

def _is_windows(repository_ctx):
return repository_ctx.os.name.lower().find("windows") != -1

def _default_elixir_dict(repository_ctx):
if ELIXIR_HOME_ENV_VAR in repository_ctx.os.environ:
elixir_home = repository_ctx.os.environ[ELIXIR_HOME_ENV_VAR]
else:
if repository_ctx.os.name.find("windows") > 0:
iex_path = repository_ctx.which("iex.exe")
if _is_windows(repository_ctx):
if ELIXIR_HOME_ENV_VAR in repository_ctx.os.environ:
elixir_home = repository_ctx.os.environ[ELIXIR_HOME_ENV_VAR]
iex_path = elixir_home + "\\bin\\iex"
else:
iex_path = repository_ctx.which("iex")
if iex_path == None:
iex_path = repository_ctx.path("C:/Program Files (x86)/Elixir/bin/iex")
elixir_home = str(iex_path.dirname.dirname)
elixir_home = msys2_path(elixir_home)
elif ELIXIR_HOME_ENV_VAR in repository_ctx.os.environ:
elixir_home = repository_ctx.os.environ[ELIXIR_HOME_ENV_VAR]
iex_path = path_join(elixir_home, "bin", "elixir")
else:
iex_path = repository_ctx.which("iex")
if iex_path == None:
iex_path = repository_ctx.path(DEFAULT_IEX_PATH)
iex_path = repository_ctx.path("/usr/local/bin/iex")
elixir_home = str(iex_path.dirname.dirname)

version = repository_ctx.execute(
Expand Down

0 comments on commit ad04322

Please sign in to comment.