From 84ad5c93db9a604fe4fa78324c6af6b1a8f23e5f Mon Sep 17 00:00:00 2001 From: Orestis Floros Date: Fri, 1 May 2020 11:10:05 +0200 Subject: [PATCH] travis: update dist, add custom matrix New matrix for 5 jobs in total. Updates our checks to bionic & xenial. Trusty could also be included but it is a bit outdated at this point. I use bionic to pull a more recent clang-format and use a dedicated job just to check formatting. An alternative would be to conditionally run the formatting script only on bionic. I don't think that there is a better way to expand a `dist` x `compiler` matrix (except using docker). --- .travis.yml | 26 +++++++++++++++++++------- i3status.c | 2 +- src/print_load.c | 2 +- src/print_wireless_info.c | 16 ++++++++-------- 4 files changed, 29 insertions(+), 17 deletions(-) diff --git a/.travis.yml b/.travis.yml index 538e60d..02c9223 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,10 +1,25 @@ os: linux -dist: trusty language: c -compiler: - - gcc - - clang +jobs: + include: + - name: "clang-format check" + dist: bionic + addons: + apt: + packages: + - clang-format-6.0 + script: + - clang-format-6.0 -i $(find . -name "*.[ch]" | tr '\n' ' ') && git diff --exit-code || (echo 'Code was not formatted using clang-format!'; false) + - dist: xenial + compiler: gcc + - dist: xenial + compiler: clang + - dist: bionic + compiler: gcc + - dist: bionic + compiler: clang + addons: # See http://docs.travis-ci.com/user/apt/ apt: @@ -18,11 +33,8 @@ addons: # xmlto pulls in a2x which we need for generating manpages from asciidoc. - xmlto - libcap2-bin - - clang-format-3.8 - - libllvm3.5 - pulseaudio script: - - clang-format-3.8 -i $(find . -name "*.[ch]" | tr '\n' ' ') && git diff --exit-code || (echo 'Code was not formatted using clang-format!'; false) # TODO: re-enable sanitizers once issues are fixed - autoreconf -fi && mkdir -p build && cd build && (../configure --disable-sanitizers || (cat config.log; false)) && make -j 8 V=1 && ldd ./i3status |& grep -q pulse || (echo "not linked against pulseaudio"; exit 1) - make clean && (../configure --disable-sanitizers --disable-pulseaudio || (cat config.log; false)) && make -j 8 V=1 && ldd ./i3status |& grep -q pulse && (echo "linked against pulseaudio"; exit 1) || true diff --git a/i3status.c b/i3status.c index 2108e04..8756e8a 100644 --- a/i3status.c +++ b/i3status.c @@ -577,7 +577,7 @@ int main(int argc, char *argv[]) { #else "Built without pulseaudio support\n" #endif - ); + ); return 0; break; case 0: diff --git a/src/print_load.c b/src/print_load.c index 3ffc576..a2638c0 100644 --- a/src/print_load.c +++ b/src/print_load.c @@ -13,7 +13,7 @@ void print_load(yajl_gen json_gen, char *buffer, const char *format, const char *format_above_threshold, const float max_threshold) { char *outwalk = buffer; -/* Get load */ + /* Get load */ #if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(linux) || defined(__OpenBSD__) || defined(__NetBSD__) || defined(__APPLE__) || defined(sun) || defined(__DragonFly__) double loadavg[3]; diff --git a/src/print_wireless_info.c b/src/print_wireless_info.c index cfb51b6..ff63c41 100644 --- a/src/print_wireless_info.c +++ b/src/print_wireless_info.c @@ -164,11 +164,11 @@ static int gwi_sta_cb(struct nl_msg *msg, void *data) { struct nlattr *sinfo[NL80211_STA_INFO_MAX + 1]; struct nlattr *rinfo[NL80211_RATE_INFO_MAX + 1]; static struct nla_policy stats_policy[NL80211_STA_INFO_MAX + 1] = { - [NL80211_STA_INFO_RX_BITRATE] = {.type = NLA_NESTED}, + [NL80211_STA_INFO_RX_BITRATE] = {.type = NLA_NESTED}, }; static struct nla_policy rate_policy[NL80211_RATE_INFO_MAX + 1] = { - [NL80211_RATE_INFO_BITRATE] = {.type = NLA_U16}, + [NL80211_RATE_INFO_BITRATE] = {.type = NLA_U16}, }; if (nla_parse(tb, NL80211_ATTR_MAX, genlmsg_attrdata(gnlh, 0), genlmsg_attrlen(gnlh, 0), NULL) < 0) @@ -212,12 +212,12 @@ static int gwi_scan_cb(struct nl_msg *msg, void *data) { struct nlattr *tb[NL80211_ATTR_MAX + 1]; struct nlattr *bss[NL80211_BSS_MAX + 1]; struct nla_policy bss_policy[NL80211_BSS_MAX + 1] = { - [NL80211_BSS_FREQUENCY] = {.type = NLA_U32}, - [NL80211_BSS_BSSID] = {.type = NLA_UNSPEC}, - [NL80211_BSS_INFORMATION_ELEMENTS] = {.type = NLA_UNSPEC}, - [NL80211_BSS_SIGNAL_MBM] = {.type = NLA_U32}, - [NL80211_BSS_SIGNAL_UNSPEC] = {.type = NLA_U8}, - [NL80211_BSS_STATUS] = {.type = NLA_U32}, + [NL80211_BSS_FREQUENCY] = {.type = NLA_U32}, + [NL80211_BSS_BSSID] = {.type = NLA_UNSPEC}, + [NL80211_BSS_INFORMATION_ELEMENTS] = {.type = NLA_UNSPEC}, + [NL80211_BSS_SIGNAL_MBM] = {.type = NLA_U32}, + [NL80211_BSS_SIGNAL_UNSPEC] = {.type = NLA_U8}, + [NL80211_BSS_STATUS] = {.type = NLA_U32}, }; if (nla_parse(tb, NL80211_ATTR_MAX, genlmsg_attrdata(gnlh, 0), genlmsg_attrlen(gnlh, 0), NULL) < 0)