diff --git a/.github/workflows/cicd.yml b/.github/workflows/cicd.yml index fa5453b..5ab133e 100644 --- a/.github/workflows/cicd.yml +++ b/.github/workflows/cicd.yml @@ -1,27 +1,40 @@ ---- -name: build +name: ci/cd + on: + workflow_dispatch: push: - branches: - - master + branches: [ main, 'release/*' ] pull_request: - branches: - - master + branches: [ main, 'release/*' ] + # Build once a month, just to be sure things are still working + schedule: + - cron: "19 3 26 * *" + jobs: - ci: - name: Run checks and tests over ${{matrix.otp_vsn}} and ${{matrix.os}} - runs-on: ${{matrix.os}} - container: - image: erlang:${{matrix.otp_vsn}} + + builds: + name: Erlang ${{ matrix.otp_version }} build + runs-on: ubuntu-latest + strategy: matrix: - otp_vsn: [20.3, 21.3, 22.3, 23.0] - os: [ubuntu-latest] + otp_version: ['26', '25', '24', '25', '26', '27'] + steps: - - uses: actions/checkout@v2 - - run: rebar3 --version - - run: rebar3 as test xref - - run: rebar3 as test dialyzer - - run: rebar3 lint - - run: rebar3 ct - - run: rebar3 cover + - uses: actions/checkout@v4 + - uses: erlef/setup-beam@v1 + with: + otp-version: ${{ matrix.otp_version }} + rebar3-version: '3.22' + - name: Compile + run: rebar3 compile + - name: Xref Checks + run: rebar3 xref + #- name: Dialyzer + # run: rebar3 dialyzer + #- name: Proper Tests + # run: rebar3 as test do compile, proper --regressions + #- name: Run Unit Tests + # run: rebar3 as test lfe ltest -tall + - name: Run Common Tests + run: rebar3 ct -v \ No newline at end of file diff --git a/README.md b/README.md index a0f1457..e4797db 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ deleting log files, you should be able to use a single build tool. This is a very simple and straightforward plugin. Simply describe your command in `rebar.config` and execute (just like you would Linux aliases) -with `rebar3 cmd `. +with `rebar3 oscmd `. ## Usage @@ -22,7 +22,7 @@ Add the plugin to your `rebar.config`: ```erlang {plugins, [ - {rebar3_oscmd, "0.4.1"} + {rebar3_oscmd, "0.5.0"} ]}. {commands, [ diff --git a/src/r3_oscmd_prv.erl b/src/r3_oscmd_prv.erl index f2fac4a..027f843 100644 --- a/src/r3_oscmd_prv.erl +++ b/src/r3_oscmd_prv.erl @@ -1,4 +1,4 @@ --module(rebar_cmd_prv). +-module(r3_oscmd_prv). -export([ init/1, @@ -17,7 +17,7 @@ {providers, create, 1} ]). --define(PROVIDER, cmd). +-define(PROVIDER, oscmd). -define(DEPS, [app_discovery]). -define(DEFAULT_OPT_TIMEOUT, 15000). -define(DEFAULT_OPT_VERBOSE, false). @@ -44,10 +44,10 @@ init(State) -> {module, ?MODULE}, {bare, true}, {deps, ?DEPS}, - {example, "rebar3 cmd "}, + {example, "rebar3 oscmd "}, {opts, []}, - {short_desc, "A rebar3 plugin to run custom shell commands 'cmd '."}, - {desc, "A rebar3 plugin to run custom shell commands 'cmd '"} + {short_desc, "A rebar3 plugin to run custom shell commands 'oscmd '."}, + {desc, "A rebar3 plugin to run custom shell commands 'oscmd '"} ]), {ok, rebar_state:add_provider(State, Provider)}. diff --git a/src/rebar3_oscmd.app.src b/src/rebar3_oscmd.app.src index 38d2800..b81ac2f 100644 --- a/src/rebar3_oscmd.app.src +++ b/src/rebar3_oscmd.app.src @@ -1,6 +1,6 @@ -{application, rebar_cmd, - [{description, "Run custom shell commands with rebar3 cmd "}, - {vsn, "0.4.0"}, +{application, rebar3_oscmd, + [{description, "Run custom shell commands with rebar3 oscmd "}, + {vsn, "0.5.0"}, {registered, []}, {applications, [kernel, @@ -9,7 +9,6 @@ {env,[]}, {modules, []}, - {maintainers, ["Sasan Hezarkhani", "Matheus Mendes", "Ahmad Mokhtar", "Paulo F. Oliveira"]}, {licenses, ["MIT"]}, - {links, [{"Github", "https://github.com/gootik/rebar_cmd"}]} + {links, [{"Github", "https://github.com/erlsci/rebar3_oscmd"}]} ]}. diff --git a/src/rebar3_oscmd.erl b/src/rebar3_oscmd.erl index c6fa5c9..ecb2f34 100644 --- a/src/rebar3_oscmd.erl +++ b/src/rebar3_oscmd.erl @@ -1,4 +1,4 @@ --module(rebar_cmd). +-module(rebar3_oscmd). -export([init/1]). @@ -6,5 +6,5 @@ -spec init(rebar_state:t()) -> {ok, rebar_state:t()}. init(State) -> - {ok, State1} = rebar_cmd_prv:init(State), + {ok, State1} = r3_oscmd_prv:init(State), {ok, State1}. diff --git a/test/rebar3_oscmd_SUITE.erl b/test/rebar3_oscmd_SUITE.erl index a9a52ba..68973aa 100644 --- a/test/rebar3_oscmd_SUITE.erl +++ b/test/rebar3_oscmd_SUITE.erl @@ -1,4 +1,4 @@ --module(rebar_cmd_SUITE). +-module(rebar3_oscmd_SUITE). -include_lib("stdlib/include/assert.hrl"). @@ -33,89 +33,89 @@ all() -> ]. command_not_atom(_Config) -> - {Cmd, CmdFound} = as_rebar3_cmd(not_tuple, _FoundInSuiteConfig = true), + {Cmd, CmdFound} = as_rebar3_oscmd(not_tuple, _FoundInSuiteConfig = true), ?assertMatch( {error, _}, - rebar_cmd_prv:do_internal({Cmd, CmdFound}, no_state) + r3_oscmd_prv:do_internal({Cmd, CmdFound}, no_state) ). command_tuple_1(_Config) -> - {Cmd, CmdFound} = as_rebar3_cmd(tuple_1, _FoundInSuiteConfig = true), + {Cmd, CmdFound} = as_rebar3_oscmd(tuple_1, _FoundInSuiteConfig = true), ?assertMatch( {error, _}, - rebar_cmd_prv:do_internal({Cmd, CmdFound}, no_state) + r3_oscmd_prv:do_internal({Cmd, CmdFound}, no_state) ). command_tuple_4(_Config) -> - {Cmd, CmdFound} = as_rebar3_cmd(tuple_4, _FoundInSuiteConfig = true), + {Cmd, CmdFound} = as_rebar3_oscmd(tuple_4, _FoundInSuiteConfig = true), ?assertMatch( {error, _}, - rebar_cmd_prv:do_internal({Cmd, CmdFound}, no_state) + r3_oscmd_prv:do_internal({Cmd, CmdFound}, no_state) ). command_not_in_commands(_Config) -> - {Cmd, CmdFound} = as_rebar3_cmd(not_in_commands, _FoundInSuiteConfig = false), + {Cmd, CmdFound} = as_rebar3_oscmd(not_in_commands, _FoundInSuiteConfig = false), ?assertMatch( {error, _}, - rebar_cmd_prv:do_internal({Cmd, CmdFound}, no_state) + r3_oscmd_prv:do_internal({Cmd, CmdFound}, no_state) ). command_timeout_0(_Config) -> - {Cmd, CmdFound} = as_rebar3_cmd(timeout_0, _FoundInSuiteConfig = true), + {Cmd, CmdFound} = as_rebar3_oscmd(timeout_0, _FoundInSuiteConfig = true), ?assertMatch( {error, _}, - rebar_cmd_prv:do_internal({Cmd, CmdFound}, no_state) + r3_oscmd_prv:do_internal({Cmd, CmdFound}, no_state) ). command_timeout_1999(_Config) -> - {Cmd, CmdFound} = as_rebar3_cmd(timeout_1999, _FoundInSuiteConfig = true), + {Cmd, CmdFound} = as_rebar3_oscmd(timeout_1999, _FoundInSuiteConfig = true), ?assertMatch( {error, _}, - rebar_cmd_prv:do_internal({Cmd, CmdFound}, no_state) + r3_oscmd_prv:do_internal({Cmd, CmdFound}, no_state) ). command_verbose_false(_Config) -> - {Cmd, CmdFound} = as_rebar3_cmd(non_verbose_ls, _FoundInSuiteConfig = true), + {Cmd, CmdFound} = as_rebar3_oscmd(non_verbose_ls, _FoundInSuiteConfig = true), ?assertMatch( {ok, no_state}, - rebar_cmd_prv:do_internal({Cmd, CmdFound}, no_state) + r3_oscmd_prv:do_internal({Cmd, CmdFound}, no_state) ). command_verbose_true(_Config) -> - {Cmd, CmdFound} = as_rebar3_cmd(verbose_ls, _FoundInSuiteConfig = true), + {Cmd, CmdFound} = as_rebar3_oscmd(verbose_ls, _FoundInSuiteConfig = true), ?assertMatch( {ok, no_state}, - rebar_cmd_prv:do_internal({Cmd, CmdFound}, no_state) + r3_oscmd_prv:do_internal({Cmd, CmdFound}, no_state) ). command_not_string(_Config) -> - {Cmd, CmdFound} = as_rebar3_cmd(not_string, _FoundInSuiteConfig = true), + {Cmd, CmdFound} = as_rebar3_oscmd(not_string, _FoundInSuiteConfig = true), ?assertEqual( {ok, no_state}, - rebar_cmd_prv:do_internal({Cmd, CmdFound}, no_state) + r3_oscmd_prv:do_internal({Cmd, CmdFound}, no_state) ). command_timeout_not_integer(_Config) -> - {Cmd, CmdFound} = as_rebar3_cmd(timeout_not_int, _FoundInSuiteConfig = true), + {Cmd, CmdFound} = as_rebar3_oscmd(timeout_not_int, _FoundInSuiteConfig = true), ?assertMatch( {ok, no_state}, - rebar_cmd_prv:do_internal({Cmd, CmdFound}, no_state) + r3_oscmd_prv:do_internal({Cmd, CmdFound}, no_state) ). command_ok(_Config) -> - {Cmd, CmdFound} = as_rebar3_cmd(ok, _FoundInSuiteConfig = true), + {Cmd, CmdFound} = as_rebar3_oscmd(ok, _FoundInSuiteConfig = true), ?assertMatch( {ok, no_state}, - rebar_cmd_prv:do_internal({Cmd, CmdFound}, no_state) + r3_oscmd_prv:do_internal({Cmd, CmdFound}, no_state) ). %% Internal -as_rebar3_cmd(Cmd, FoundInSuiteConfig) -> +as_rebar3_oscmd(Cmd, FoundInSuiteConfig) -> FoundInSuiteConfig andalso begin true = lists:keyfind(Cmd, 1, ?CONFIG) =/= false orelse lists:member(Cmd, ?CONFIG) end, - {atom_to_list(Cmd), rebar_cmd_prv:find_command_in(atom_to_list(Cmd), ?CONFIG)}. + {atom_to_list(Cmd), r3_oscmd_prv:find_command_in(atom_to_list(Cmd), ?CONFIG)}.