From b2834147818a4fbca53d53bb9c185bdffa943108 Mon Sep 17 00:00:00 2001 From: Tristan Sloughter Date: Sun, 27 Jun 2021 08:17:46 -0600 Subject: [PATCH 1/2] add run of shelltestrunner to CI --- .github/workflows/shelltests.yml | 33 ++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 .github/workflows/shelltests.yml diff --git a/.github/workflows/shelltests.yml b/.github/workflows/shelltests.yml new file mode 100644 index 000000000..e89cec0bd --- /dev/null +++ b/.github/workflows/shelltests.yml @@ -0,0 +1,33 @@ +name: Shell tests + +on: + pull_request: + branches: + - 'master' + push: + branches: + - 'master' + +jobs: + shelltests: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: erlef/setup-beam@v1 + with: + otp-version: '24.0.1' + elixir-version: '1.12' + - name: Compile + run: ./bootstrap + - name: Install + run: cp ./rebar3 /usr/bin/ + + - name: Checkout shell tests + run: git checkout https://github.com/tsloughter/rebar3_tests + + - name: Install and run shelltestrunner + run: | + apt-get update + apt-get install -y shelltestrunner build-essential + mix local.hex --force + ./run_tests.sh From 9b132f06054660a7bb95145ebd755cd8ac09a0fd Mon Sep 17 00:00:00 2001 From: Tristan Sloughter Date: Sun, 27 Jun 2021 08:18:08 -0600 Subject: [PATCH 2/2] fix app discover to prefer erlang app to mix project --- src/rebar_app_discover.erl | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/rebar_app_discover.erl b/src/rebar_app_discover.erl index e4c047c66..a1400c688 100644 --- a/src/rebar_app_discover.erl +++ b/src/rebar_app_discover.erl @@ -256,7 +256,7 @@ app_dirs(LibDir, SrcDirs, State) -> ]), EbinPath = filename:join([LibDir, "ebin", "*.app"]), - MixExsPath = filename:join([LibDir, "src", "mix.exs"]), + MixExsPath = filename:join([LibDir, "mix.exs"]), lists:usort(lists:foldl(fun(Path, Acc) -> Files = filelib:wildcard(rebar_utils:to_list(Path)), @@ -350,7 +350,7 @@ find_app_(AppInfo, AppDir, SrcDirs, Validate, State) -> end || SrcDir <- SrcDirs], ResourceFiles = [ {app, filelib:wildcard(filename:join([AppDir, "ebin", "*.app"]))}, - {mix_exs, filelib:wildcard(filename:join([AppDir, "src", "mix.exs"]))} + {mix_exs, filelib:wildcard(filename:join([AppDir, "mix.exs"]))} | [{extension_type(Ext), lists:append([filelib:wildcard(filename:join([AppDir, SrcDir, "*" ++ Ext])) || SrcDir <- NormSrcDirs])} @@ -451,8 +451,14 @@ try_handle_resource_files(AppInfo, AppDir, [{app, AppFile} | Rest], Validate) -> try_handle_resource_files(AppInfo, AppDir, [{Type, AppSrcFile} | _Rest], Validate) when Type =:= app_src orelse Type =:= script -> try_handle_app_src_file(AppInfo, AppDir, AppSrcFile, Validate); -try_handle_resource_files(AppInfo, _AppDir, [{mix_exs, _AppSrcFile} | _Rest], _Validate) -> - {true, rebar_app_info:project_type(AppInfo, mix)}; +try_handle_resource_files(AppInfo, AppDir, [{mix_exs, _MixExs} | Rest], Validate) -> + %% prefer a rebar3 buildable app if both are found + case try_handle_resource_files(AppInfo, AppDir, Rest, Validate) of + false -> + {true, rebar_app_info:project_type(AppInfo, mix)}; + {true, _}=Result -> + Result + end; try_handle_resource_files(_AppInfo, _AppDir, [], _Validate) -> false.