From ad043228f2ce04fc510fbd721be98c69e6694002 Mon Sep 17 00:00:00 2001 From: Rin Kuryloski Date: Wed, 28 Sep 2022 10:23:35 +0200 Subject: [PATCH] Fixup config drift causing the Windows Actions to fail --- .github/workflows/test-windows.yaml | 12 +++++------- MODULE.bazel | 2 +- WORKSPACE | 4 ++-- bazel/repositories/elixir_config.bzl | 25 ++++++++++++++++++------- 4 files changed, 26 insertions(+), 17 deletions(-) diff --git a/.github/workflows/test-windows.yaml b/.github/workflows/test-windows.yaml index f3a5e8e9d8db..328cc929d722 100644 --- a/.github/workflows/test-windows.yaml +++ b/.github/workflows/test-windows.yaml @@ -3,6 +3,9 @@ on: schedule: - cron: '0 2 * * *' workflow_dispatch: + push: + paths: + - .github/workflows/test-windows.yaml jobs: test: name: Test Windows @@ -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 @@ -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 @@ -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 diff --git a/MODULE.bazel b/MODULE.bazel index 3b306ef4f61a..deafa90cd430 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -25,7 +25,7 @@ bazel_dep( bazel_dep( name = "rules_erlang", - version = "3.7.0", + version = "3.7.1", ) erlang_config = use_extension( diff --git a/WORKSPACE b/WORKSPACE index ea740bb9e4d9..46b7ccca5cfc 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -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( diff --git a/bazel/repositories/elixir_config.bzl b/bazel/repositories/elixir_config.bzl index 3f6dfb36ea79..ccdbc6a35ed8 100644 --- a/bazel/repositories/elixir_config.bzl +++ b/bazel/repositories/elixir_config.bzl @@ -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" @@ -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(