diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index fa6d766..a28191b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -9,43 +9,47 @@ jobs: strategy: fail-fast: false matrix: - otp: ['19.3', '21.3', 24] - runs-on: ubuntu-20.04 + otp: [20, 25, 26, 27] + runs-on: ubuntu-24.04 container: image: erlang:${{ matrix.otp }} steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Prepare libraries run: | apt-get -qq update apt-get -qq install libgd-dev libjpeg-dev libpng-dev libwebp-dev - run: ./configure - run: make - - run: rebar3 compile - - run: rebar3 xref - - run: rebar3 dialyzer + if: matrix.otp >= 22 + - run: REBAR=rebar3 make + - run: REBAR=rebar3 make xref + - run: REBAR=rebar3 make dialyzer - run: rebar3 eunit -v cover: name: Cover needs: [tests] - runs-on: ubuntu-20.04 + runs-on: ubuntu-24.04 + container: + image: erlang:26 steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Prepare libraries run: | - sudo apt-get -qq update - sudo apt-get -qq install libgd-dev libjpeg-dev libpng-dev libwebp-dev + apt-get -qq update + apt-get -qq install libgd-dev libjpeg-dev libpng-dev libwebp-dev - run: ./configure --enable-gcov - - run: rebar3 compile + - run: REBAR=rebar3 make - run: rebar3 eunit -v - - run: pip install --user cpp-coveralls - - run: cpp-coveralls -b `pwd` --verbose --gcov-options '\-lp' --dump c.json + #- run: pip install --user cpp-coveralls + #- run: cpp-coveralls -b `pwd` --verbose --gcov-options '\-lp' --dump c.json - name: Send to Coveralls env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | - ADDJSONFILE=c.json COVERALLS=true rebar3 as test coveralls send + #ADDJSONFILE=c.json COVERALLS=true rebar3 as test coveralls send + COVERALLS=true rebar3 as test coveralls send curl -v -k https://coveralls.io/webhook \ --header "Content-Type: application/json" \ --data '{"repo_name":"$GITHUB_REPOSITORY", diff --git a/.github/workflows/hexpm-release.yml b/.github/workflows/hexpm-release.yml index 79502c0..aea078d 100644 --- a/.github/workflows/hexpm-release.yml +++ b/.github/workflows/hexpm-release.yml @@ -7,10 +7,10 @@ on: jobs: release: - runs-on: ubuntu-20.04 + runs-on: ubuntu-24.04 steps: - name: Check out - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Generate documentation run: rebar3 edoc @@ -39,6 +39,6 @@ jobs: echo "{plugins, [rebar3_hex]}." > ~/.config/rebar3/rebar.config - name: Publish to hex.pm - run: DIAGNOSTIC=1 rebar3 hex publish --repo hexpm --yes ; head rebar3.crashdump + run: DEBUG=1 rebar3 hex publish --repo hexpm --yes env: HEX_API_KEY: ${{ secrets.HEX_API_KEY }} diff --git a/rebar.config b/rebar.config index a0bb0fb..ab578c0 100644 --- a/rebar.config +++ b/rebar.config @@ -30,7 +30,7 @@ {port_specs, [{"priv/bin/eimp", ["c_src/eimp.c"]}]}. -{deps, [{p1_utils, ".*", {git, "https://github.com/processone/p1_utils", {tag, "1.0.26"}}}]}. +{deps, [{p1_utils, "~> 1.0.25", {git, "https://github.com/processone/p1_utils", {tag, "1.0.26"}}}]}. {clean_files, ["c_src/eimp.gcda", "c_src/eimp.gcno"]}. diff --git a/rebar.config.script b/rebar.config.script index 4f33a7a..7ce14d6 100644 --- a/rebar.config.script +++ b/rebar.config.script @@ -165,13 +165,31 @@ AppendList = fun(Append) -> end end, -Rebar3DepsFilter = fun(DepsList) -> - lists:map(fun({DepName,_, {git,_, {tag,Version}}}) -> - {DepName, Version}; - (Dep) -> - Dep - end, DepsList) - end, +% Convert our rich deps syntax to rebar2 format: +% https://github.com/rebar/rebar/wiki/Dependency-management +Rebar2DepsFilter = +fun(DepsList) -> + lists:map(fun({DepName, _HexVersion, Source}) -> + {DepName, ".*", Source} + end, DepsList) +end, + +% Convert our rich deps syntax to rebar3 version definition format: +% https://rebar3.org/docs/configuration/dependencies/#dependency-version-handling +% https://hexdocs.pm/elixir/Version.html +Rebar3DepsFilter = +fun(DepsList) -> + lists:map(fun({DepName, HexVersion, {git, _, {tag, GitVersion}} = Source}) -> + case HexVersion == ".*" of + true -> + {DepName, GitVersion}; + false -> + {DepName, HexVersion} + end; + ({DepName, _HexVersion, Source}) -> + {DepName, ".*", Source} + end, DepsList) +end, GlobalDepsFilter = fun(Deps) -> DepNames = lists:map(fun({DepName, _, _}) -> DepName; @@ -187,6 +205,30 @@ GlobalDepsFilter = fun(Deps) -> end, DepNames) end, +ResolveDepPath = case IsRebar3 of + true -> + fun("deps/" ++ Rest) -> + Slash = string:str(Rest, "/"), + "_build/default/lib/" ++ + string:sub_string(Rest, 1, Slash - 1) ++ + string:sub_string(Rest, Slash); + (Path) -> + Path + end; + _ -> + fun(P) -> + P + end + end, + +ProcessErlOpt = fun(Vals) -> + lists:map( + fun({i, Path}) -> + {i, ResolveDepPath(Path)}; + (ErlOpt) -> + ErlOpt + end, Vals) + end, GithubConfig = case {os:getenv("GITHUB_ACTIONS"), os:getenv("GITHUB_TOKEN")} of {"true", Token} when is_list(Token) -> CONFIG1 = [{coveralls_repo_token, Token}, @@ -219,21 +261,25 @@ Rules = [ AppendStr("--coverage"), ""}, {[port_env, "CFLAGS"], CfgWithGCov == "true", AppendStr("--coverage"), ""}, + {[deps], (not IsRebar3), + Rebar2DepsFilter, []}, {[deps], IsRebar3, Rebar3DepsFilter, []}, {[plugins], IsRebar3, - AppendList([pc]), []}, + AppendList([{pc, "~> 1.15.0"}, provider_asn1]), []}, {[provider_hooks], IsRebar3, AppendList([{pre, [ {compile, {pc, compile}}, {clean, {pc, clean}} ]}]), []}, {[plugins], os:getenv("COVERALLS") == "true", - AppendList([{coveralls, {git, - "https://github.com/processone/coveralls-erl.git", - {branch, "addjsonfile"}}} ]), []}, + AppendList([{coveralls, ".*", + {git, "https://github.com/processone/coveralls-erl.git", + {branch, "addjsonfile"}}} ]), []}, {[deps], os:getenv("USE_GLOBAL_DEPS") /= false, - GlobalDepsFilter, []} + GlobalDepsFilter, []}, + {[erl_opts], true, + ProcessErlOpt, []} ],