Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into dev/netlink
Browse files Browse the repository at this point in the history
  • Loading branch information
Caellian committed May 3, 2024
2 parents f109f59 + a03f0bc commit c33aa60
Show file tree
Hide file tree
Showing 21 changed files with 281 additions and 155 deletions.
45 changes: 45 additions & 0 deletions .github/scripts/docker-build.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
#!/usr/bin/env bash
set -ex

DOCKERHUB_IMAGE_ID=$DOCKERHUB_ACCOUNT/$IMAGE_NAME

# Change all uppercase to lowercase
DOCKERHUB_IMAGE_ID=$(echo $DOCKERHUB_IMAGE_ID | tr '[A-Z]' '[a-z]')

image_tags=()

# Strip git ref prefix from version
VERSION_TAG=$(echo $GITHUB_REF | sed -e 's,.*/\(.*\),\1,')

# Strip "v" prefix from tag name
if [[ "$GITHUB_REF" == refs/tags/* ]]; then
VERSION_TAG=$(echo $VERSION_TAG | sed -e 's/^v//')
fi

image_tags+=("--tag" "$DOCKERHUB_IMAGE_ID:$VERSION_TAG")

# tag as latest on releases
if [[ "$RELEASE" == ON ]]; then
image_tags+=("--tag" "$DOCKERHUB_IMAGE_ID:latest")
fi

# Only build amd64 on PRs, build all platforms on main. The arm builds
# take far too long.
image_platforms="--platform linux/amd64"
push_image=""
cache_tag="pr-cache"

# Only push on main
if [[ "$GITHUB_REF" == refs/heads/main ]]; then
push_image="--push"
image_platforms="--platform linux/arm/v7,linux/arm64/v8,linux/amd64"
cache_tag="main-cache"
fi

docker buildx build \
${push_image} \
${image_platforms} \
--cache-from=type=registry,ref=$DOCKERHUB_ACCOUNT/$IMAGE_NAME:$cache_tag \
--cache-to=type=registry,ref=$DOCKERHUB_ACCOUNT/$IMAGE_NAME:$cache_tag,mode=max \
"${image_tags[@]}" \
.
38 changes: 13 additions & 25 deletions .github/workflows/docker.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,13 @@ name: Docker

on:
push:
# Publish `main` as Docker `latest` image.
branches:
- main
paths-ignore:
- web/**
- doc/**

pull_request:
branches:
- main
paths-ignore:
Expand All @@ -23,7 +29,7 @@ env:
DOCKER_BUILDKIT: 1

jobs:
buildx:
docker-buildx:
runs-on: ubuntu-latest
steps:
- name: Checkout
Expand All @@ -35,26 +41,8 @@ jobs:
uses: docker/setup-buildx-action@v3
- name: Log into Dockerhub registry
run: echo "${{ secrets.DOCKERHUB_TOKEN }}" | docker login -u $DOCKERHUB_ACCOUNT --password-stdin
- name: Build
run: |
DOCKERHUB_IMAGE_ID=$DOCKERHUB_ACCOUNT/$IMAGE_NAME
# Change all uppercase to lowercase
DOCKERHUB_IMAGE_ID=$(echo $DOCKERHUB_IMAGE_ID | tr '[A-Z]' '[a-z]')
# Strip git ref prefix from version
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,')
# Strip "v" prefix from tag name
[[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//')
# Use Docker `latest` tag convention
[ "$VERSION" == "main" ] && VERSION=latest
docker buildx build \
--push \
--platform linux/arm/v7,linux/arm64/v8,linux/amd64 \
--cache-from=type=registry,ref=$DOCKERHUB_ACCOUNT/$IMAGE_NAME:buildcache \
--cache-to=type=registry,ref=$DOCKERHUB_ACCOUNT/$IMAGE_NAME:buildcache,mode=max \
--tag $DOCKERHUB_IMAGE_ID:$VERSION \
.
- name: Build and push Docker image
env:
RELEASE: "${{ startsWith(github.ref, 'refs/tags/') && 'ON' || 'OFF' }}"
GITHUB_REF: ${{ github.ref }}
run: ./.github/scripts/docker-build.bash
17 changes: 8 additions & 9 deletions .github/workflows/publish-appimage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,6 @@ jobs:
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Get git version
id: git-version
run: echo "GIT_VERSION=$(git describe --tags --always --debug)" | tee -a $GITHUB_ENV
- name: Import GPG Deploy Key
# only run on main branch
if: github.ref == 'refs/heads/main'
Expand All @@ -109,19 +106,21 @@ jobs:
env:
RELEASE: "${{ startsWith(github.ref, 'refs/tags/') && 'ON' || 'OFF' }}"
- run: ./conky-x86_64.AppImage --version # print version
- run: mv conky-x86_64.AppImage conky-${{ matrix.os }}-${{ matrix.arch }}-${{ env.GIT_VERSION }}.AppImage
- run: mv conky-x86_64.AppImage.sha256 conky-${{ matrix.os }}-${{ matrix.arch }}-${{ env.GIT_VERSION }}.AppImage.sha256
- name: Set CONKY_VERSION
run: echo "CONKY_VERSION=$(./conky-x86_64.AppImage --short-version)" | tee -a $GITHUB_ENV
- run: mv conky-x86_64.AppImage conky-${{ matrix.os }}-${{ matrix.arch }}-v${{ env.CONKY_VERSION }}.AppImage
- run: mv conky-x86_64.AppImage.sha256 conky-${{ matrix.os }}-${{ matrix.arch }}-v${{ env.CONKY_VERSION }}.AppImage.sha256
- name: Upload AppImage artifact
uses: actions/upload-artifact@v4
with:
path: 'conky-${{ matrix.os }}-${{ matrix.arch }}-${{ env.GIT_VERSION }}.AppImage'
name: 'conky-${{ matrix.os }}-${{ matrix.arch }}-${{ env.GIT_VERSION }}.AppImage'
path: 'conky-${{ matrix.os }}-${{ matrix.arch }}-v${{ env.CONKY_VERSION }}.AppImage'
name: 'conky-${{ matrix.os }}-${{ matrix.arch }}-v${{ env.CONKY_VERSION }}.AppImage'
if-no-files-found: error
- name: Upload AppImage checksum artifact
uses: actions/upload-artifact@v4
with:
path: 'conky-${{ matrix.os }}-${{ matrix.arch }}-${{ env.GIT_VERSION }}.AppImage.sha256'
name: 'conky-${{ matrix.os }}-${{ matrix.arch }}-${{ env.GIT_VERSION }}.AppImage.sha256'
path: 'conky-${{ matrix.os }}-${{ matrix.arch }}-v${{ env.CONKY_VERSION }}.AppImage.sha256'
name: 'conky-${{ matrix.os }}-${{ matrix.arch }}-v${{ env.CONKY_VERSION }}.AppImage.sha256'
if-no-files-found: error
- name: Upload man page artifact
uses: actions/upload-artifact@v4
Expand Down
30 changes: 9 additions & 21 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
FROM ubuntu:jammy AS builder
FROM ubuntu:noble AS builder

RUN apt-get update \
&& DEBIAN_FRONTEND=noninteractive \
apt-get install -qy --no-install-recommends \
audacious-dev \
ca-certificates \
clang \
cmake \
curl \
gfortran \
git \
Expand Down Expand Up @@ -39,25 +40,11 @@ RUN apt-get update \
libxml2-dev \
libxmmsclient-dev \
libxnvctrl-dev \
make \
ninja-build \
patch \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*

# Compile CMake, we need the latest because the bug here (for armv7 builds):
# https://gitlab.kitware.com/cmake/cmake/-/issues/20568
WORKDIR /cmake
ENV CMAKE_VERSION 3.25.1
RUN curl -Lq https://github.com/Kitware/CMake/releases/download/v${CMAKE_VERSION}/cmake-${CMAKE_VERSION}.tar.gz -o cmake-${CMAKE_VERSION}.tar.gz \
&& tar xf cmake-${CMAKE_VERSION}.tar.gz \
&& cd cmake-${CMAKE_VERSION} \
&& CC=clang CXX=clang++ CFLAGS="-D_FILE_OFFSET_BITS=64" CXXFLAGS="-D_FILE_OFFSET_BITS=64" ./bootstrap --system-libs --parallel=5 \
&& make -j5 \
&& make -j5 install \
&& cd \
&& rm -rf /cmake

COPY . /conky
WORKDIR /conky/build

Expand Down Expand Up @@ -112,7 +99,7 @@ RUN sh -c 'if [ "$X11" = "yes" ] ; then \
&& cmake --build . \
&& cmake --install .

FROM ubuntu:jammy
FROM ubuntu:noble

RUN apt-get update \
&& DEBIAN_FRONTEND=noninteractive \
Expand All @@ -121,14 +108,14 @@ RUN apt-get update \
libc++1 \
libc++abi1 \
libcairo2 \
libcurl4 \
libcurl4t64 \
libdbus-glib-1-2 \
libical3 \
libimlib2 \
libical3t64 \
libimlib2t64 \
libircclient1 \
libiw30 \
libiw30t64 \
liblua5.3-0 \
libmicrohttpd12 \
libmicrohttpd12t64 \
libmysqlclient21 \
libncurses6 \
libpulse0 \
Expand All @@ -140,6 +127,7 @@ RUN apt-get update \
libxext6 \
libxfixes3 \
libxft2 \
libxi6 \
libxinerama1 \
libxml2 \
libxmmsclient6 \
Expand Down
20 changes: 10 additions & 10 deletions cmake/Conky.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,8 @@ endif(OS_HAIKU)

# Do version stuff
set(VERSION_MAJOR "1")
set(VERSION_MINOR "20")
set(VERSION_PATCH "3")
set(VERSION_MINOR "21")
set(VERSION_PATCH "0")

find_program(APP_AWK awk)

Expand All @@ -153,12 +153,6 @@ if(NOT APP_UNAME)
message(FATAL_ERROR "Unable to find program 'uname'")
endif(NOT APP_UNAME)

find_program(APP_GPERF gperf)

if(NOT APP_GPERF)
message(FATAL_ERROR "Unable to find program 'gperf' (required at build-time as of Conky v1.20.2)")
endif(NOT APP_GPERF)

if(NOT RELEASE)
find_program(APP_GIT git)

Expand All @@ -169,18 +163,24 @@ if(NOT RELEASE)
mark_as_advanced(APP_GIT)
endif(NOT RELEASE)

mark_as_advanced(APP_AWK APP_WC APP_UNAME APP_GPERF)
mark_as_advanced(APP_AWK APP_WC APP_UNAME)

execute_process(COMMAND ${APP_UNAME} -sm
RESULT_VARIABLE RETVAL
OUTPUT_VARIABLE BUILD_ARCH
OUTPUT_STRIP_TRAILING_WHITESPACE)

execute_process(COMMAND ${APP_GIT} rev-parse --short HEAD
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
RESULT_VARIABLE RETVAL
OUTPUT_VARIABLE GIT_SHORT_SHA
OUTPUT_STRIP_TRAILING_WHITESPACE)

if(RELEASE)
set(VERSION "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}")
else(RELEASE)
set(VERSION
"${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}_pre${COMMIT_COUNT}")
"${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}-pre-${GIT_SHORT_SHA}")
endif(RELEASE)

set(COPYRIGHT "Copyright Brenden Matthews, et al, 2005-2024")
Expand Down
2 changes: 2 additions & 0 deletions cmake/ConkyBuildOptions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ option(BUILD_EXTRAS "Build extras (includes syntax files for editors)" false)

option(BUILD_I18N "Enable if you want internationalization support" true)

option(BUILD_COLOUR_NAME_MAP "Include mappings of colour name -> RGB (i.e., red -> ff0000)" true)

if(BUILD_I18N)
set(LOCALE_DIR "${CMAKE_INSTALL_PREFIX}/share/locale"
CACHE STRING "Directory containing the locales")
Expand Down
12 changes: 11 additions & 1 deletion cmake/ConkyPlatformChecks.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -509,7 +509,7 @@ if(BUILD_LUA_CAIRO)
set(luacairo_libs ${CAIROXLIB_LIBRARIES} ${luacairo_libs})
set(luacairo_includes ${CAIROXLIB_INCLUDE_DIRS} ${luacairo_includes})
endif(BUILD_LUA_CAIRO_XLIB)

find_program(APP_PATCH patch)

if(NOT APP_PATCH)
Expand Down Expand Up @@ -668,6 +668,16 @@ if(BUILD_DOCS OR BUILD_EXTRAS)
endif()
endif(BUILD_DOCS OR BUILD_EXTRAS)

if(BUILD_COLOUR_NAME_MAP)
find_program(APP_GPERF gperf)

if(NOT APP_GPERF)
message(FATAL_ERROR "Unable to find program 'gperf' (required at build-time as of Conky v1.20.2)")
endif(NOT APP_GPERF)

mark_as_advanced(APP_GPERF)
endif(BUILD_COLOUR_NAME_MAP)

if(CMAKE_BUILD_TYPE MATCHES "Debug")
set(DEBUG true)
endif(CMAKE_BUILD_TYPE MATCHES "Debug")
Expand Down
2 changes: 2 additions & 0 deletions cmake/config.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,8 @@

#cmakedefine BUILD_HSV_GRADIENT 1

#cmakedefine BUILD_COLOUR_NAME_MAP 1

#cmakedefine HAVE_STATFS64 1
#ifndef HAVE_STATFS64
#define statfs64 statfs
Expand Down
12 changes: 6 additions & 6 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit c33aa60

Please sign in to comment.