Add support to send C coverage. Don't cache. Move hex plugin to Action
This commit is contained in:
24
.github/workflows/ci.yml
vendored
24
.github/workflows/ci.yml
vendored
@@ -13,29 +13,29 @@ jobs:
|
||||
runs-on: ubuntu-20.04
|
||||
container:
|
||||
image: erlang:${{ matrix.otp }}
|
||||
|
||||
steps:
|
||||
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
- name: Cache rebar3
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: |
|
||||
~/.cache/rebar3/
|
||||
key: ${{matrix.otp}}-${{hashFiles('rebar.config')}}
|
||||
|
||||
- run: rebar3 compile
|
||||
- run: rebar3 xref
|
||||
- run: rebar3 dialyzer
|
||||
- run: rebar3 eunit -v
|
||||
|
||||
cover:
|
||||
name: Cover
|
||||
needs: [tests]
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- run: ./configure --enable-gcov
|
||||
- run: rebar3 compile
|
||||
- run: rebar3 eunit -v
|
||||
- run: pip install --user cpp-coveralls
|
||||
- run: cpp-coveralls -b `pwd` --verbose --gcov-options '\-lp' --dump c.json
|
||||
- name: Send to Coveralls
|
||||
if: matrix.otp == 24
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
run: |
|
||||
COVERALLS=true rebar3 as test coveralls send
|
||||
ADDJSONFILE=c.json COVERALLS=true rebar3 as test coveralls send
|
||||
curl -v -k https://coveralls.io/webhook \
|
||||
--header "Content-Type: application/json" \
|
||||
--data '{"repo_name":"$GITHUB_REPOSITORY",
|
||||
|
||||
7
.github/workflows/hexpm-release.yml
vendored
7
.github/workflows/hexpm-release.yml
vendored
@@ -1,4 +1,4 @@
|
||||
name: hexpm-release
|
||||
name: Hex
|
||||
|
||||
on:
|
||||
push:
|
||||
@@ -12,6 +12,11 @@ jobs:
|
||||
- name: Check out
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Setup rebar3 hex
|
||||
run: |
|
||||
mkdir -p ~/.config/rebar3/
|
||||
echo "{plugins, [rebar3_hex]}." > ~/.config/rebar3/rebar.config
|
||||
|
||||
- name: Publish to hex.pm
|
||||
run: rebar3 hex publish --repo hexpm --yes || head rebar3.crashdump
|
||||
env:
|
||||
|
||||
43
configure.ac
Normal file
43
configure.ac
Normal file
@@ -0,0 +1,43 @@
|
||||
# -*- Autoconf -*-
|
||||
# Process this file with autoconf to produce a configure script.
|
||||
|
||||
AC_PREREQ(2.53)
|
||||
AC_PACKAGE_VERSION(1.0.0)
|
||||
AC_INIT(sqlite3, 1.0.0, [], [])
|
||||
|
||||
# Checks for programs.
|
||||
AC_PROG_CC
|
||||
AC_PROG_MAKE_SET
|
||||
|
||||
if test "x$GCC" = "xyes"; then
|
||||
CFLAGS="$CFLAGS -Wall"
|
||||
fi
|
||||
|
||||
# Checks for typedefs, structures, and compiler characteristics.
|
||||
AC_C_CONST
|
||||
|
||||
# Checks for library functions.
|
||||
AC_FUNC_MALLOC
|
||||
AC_HEADER_STDC
|
||||
|
||||
# Checks Erlang runtime and compiler
|
||||
AC_ERLANG_NEED_ERL
|
||||
AC_ERLANG_NEED_ERLC
|
||||
|
||||
# Checks and sets ERLANG_ROOT_DIR and ERLANG_LIB_DIR variable
|
||||
# AC_ERLANG_SUBST_ROOT_DIR
|
||||
# AC_ERLANG_SUBST_LIB_DIR
|
||||
|
||||
AC_ARG_ENABLE(gcov,
|
||||
[AC_HELP_STRING([--enable-gcov], [compile with gcov enabled (default: no)])],
|
||||
[case "${enableval}" in
|
||||
yes) gcov=true ;;
|
||||
no) gcov=false ;;
|
||||
*) AC_MSG_ERROR(bad value ${enableval} for --enable-gcov) ;;
|
||||
esac],[gcov=false])
|
||||
|
||||
AC_SUBST(gcov)
|
||||
|
||||
AC_CONFIG_FILES([vars.config])
|
||||
|
||||
AC_OUTPUT
|
||||
@@ -1,10 +1,10 @@
|
||||
%%%----------------------------------------------------------------------
|
||||
%%% File : rebar.config.script
|
||||
%%% Author : Evgeniy Khramtsov <ekhramtsov@process-one.net>
|
||||
%%% File : rebar.config
|
||||
%%% Author : Mickael Remond <mremond@process-one.net>
|
||||
%%% Purpose : Rebar build script. Compliant with rebar and rebar3.
|
||||
%%% Created : 8 May 2013 by Evgeniy Khramtsov <ekhramtsov@process-one.net>
|
||||
%%% Created : 15 Dec 2015 by Mickael Remond <mremond@process-one.net>
|
||||
%%%
|
||||
%%% Copyright (C) 2002-2017 ProcessOne, SARL. All Rights Reserved.
|
||||
%%% Copyright (C) 2002-2021 ProcessOne, SARL. All Rights Reserved.
|
||||
%%%
|
||||
%%% Licensed under the Apache License, Version 2.0 (the "License");
|
||||
%%% you may not use this file except in compliance with the License.
|
||||
@@ -19,17 +19,28 @@
|
||||
%%% limitations under the License.
|
||||
%%%
|
||||
%%%----------------------------------------------------------------------
|
||||
Cfg = case file:consult(filename:join([filename:dirname(SCRIPT),"vars.config"])) of
|
||||
{ok, Terms} ->
|
||||
Terms;
|
||||
_Err ->
|
||||
[]
|
||||
end ++ [{cflags, "-g -O2 -Wall"}, {ldflags, ""}, {with_gcov, "false"}],
|
||||
{cflags, CfgCFlags} = lists:keyfind(cflags, 1, Cfg),
|
||||
{ldflags, CfgLDFlags} = lists:keyfind(ldflags, 1, Cfg),
|
||||
{with_gcov, CfgWithGCov} = lists:keyfind(with_gcov, 1, Cfg),
|
||||
|
||||
SysVersion = lists:map(fun erlang:list_to_integer/1,
|
||||
string:tokens(erlang:system_info(version), ".")),
|
||||
|
||||
IsRebar3 = case application:get_key(rebar, vsn) of
|
||||
{ok, VSN} ->
|
||||
[VSN1 | _] = string:tokens(VSN, "-+"),
|
||||
[Maj, Min, Patch] = string:tokens(VSN1, "."),
|
||||
[VSN1 | _] = string:tokens(VSN, "-"),
|
||||
[Maj|_] = string:tokens(VSN1, "."),
|
||||
(list_to_integer(Maj) >= 3);
|
||||
undefined ->
|
||||
lists:keymember(mix, 1, application:loaded_applications())
|
||||
end,
|
||||
|
||||
|
||||
ModCfg0 = fun(F, Cfg, [Key|Tail], Op, Default) ->
|
||||
{OldVal,PartCfg} = case lists:keytake(Key, 1, Cfg) of
|
||||
{value, {_, V1}, V2} -> {V1, V2};
|
||||
@@ -110,10 +121,26 @@ GithubConfig = case {os:getenv("GITHUB_ACTIONS"), os:getenv("GITHUB_TOKEN")} of
|
||||
end,
|
||||
|
||||
Rules = [
|
||||
{[port_env, "CFLAGS"], SysVersion >= [7, 3],
|
||||
AppendStr("-DHAS_ERTS_EXIT"), "$CFLAGS"},
|
||||
{[port_env, "CFLAGS"], true,
|
||||
AppendStr(CfgCFlags), "$CFLAGS"},
|
||||
{[port_env, "LDFLAGS"], true,
|
||||
AppendStr(CfgLDFlags), "$LDFLAGS"},
|
||||
{[post_hooks], (not IsRebar3) and (CfgWithGCov == "true"),
|
||||
AppendList([{eunit, "gcov -o c_src mqtree"},
|
||||
{eunit, "mv *.gcov .eunit/"}]), []},
|
||||
{[post_hooks], IsRebar3 and (CfgWithGCov == "true"),
|
||||
AppendList([{eunit, "gcov -o c_src mqtree"},
|
||||
{eunit, "mv *.gcov _build/test/cover/"}]), []},
|
||||
{[port_env, "LDFLAGS"], CfgWithGCov == "true",
|
||||
AppendStr("--coverage"), ""},
|
||||
{[port_env, "CFLAGS"], CfgWithGCov == "true",
|
||||
AppendStr("--coverage"), ""},
|
||||
{[deps], IsRebar3,
|
||||
Rebar3DepsFilter, []},
|
||||
{[plugins], IsRebar3,
|
||||
AppendList([rebar3_hex, pc]), []},
|
||||
AppendList([pc]), []},
|
||||
{[provider_hooks], IsRebar3,
|
||||
AppendList([{pre, [
|
||||
{compile, {pc, compile}},
|
||||
@@ -121,15 +148,14 @@ Rules = [
|
||||
]}]), []},
|
||||
{[plugins], os:getenv("COVERALLS") == "true",
|
||||
AppendList([{coveralls, {git,
|
||||
"https://github.com/RoadRunnr/coveralls-erl.git",
|
||||
{branch, "feature/git-info"}}} ]), []},
|
||||
"https://github.com/processone/coveralls-erl.git",
|
||||
{branch, "addjsonfile"}}} ]), []},
|
||||
{[deps], os:getenv("USE_GLOBAL_DEPS") /= false,
|
||||
GlobalDepsFilter, []}
|
||||
],
|
||||
|
||||
|
||||
Config = FilterConfig(FilterConfig, CONFIG, Rules)
|
||||
++ GithubConfig,
|
||||
Config = FilterConfig(FilterConfig, CONFIG, Rules) ++ GithubConfig,
|
||||
|
||||
%io:format("Rules:~n~p~n~nCONFIG:~n~p~n~nConfig:~n~p~n", [Rules, CONFIG, Config]),
|
||||
|
||||
|
||||
6
vars.config.in
Normal file
6
vars.config.in
Normal file
@@ -0,0 +1,6 @@
|
||||
{with_gcov, "@gcov@"}.
|
||||
|
||||
%% Local Variables:
|
||||
%% mode: erlang
|
||||
%% End:
|
||||
%% vim: set filetype=erlang tabstop=8:
|
||||
Reference in New Issue
Block a user