Skip to content

Commit

Permalink
[force ci] CI, improve readme, add icon
Browse files Browse the repository at this point in the history
Rjvs committed Aug 8, 2023

Verified

This commit was signed with the committer’s verified signature.
Rjvs Robert J Spencer
1 parent 45069ca commit 8576ddb
Showing 4 changed files with 222 additions and 27 deletions.
194 changes: 194 additions & 0 deletions .github/workflows/deploy.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,194 @@
name: Deploy
on:
push:
tags:
- 'v[0-9]+.[0-9]+.*'

jobs:
meta:
name: Get Metadata
uses: StirlingLabs/Actions/.github/workflows/[email protected]

build:
name: Build & Test
needs: [ meta ]
uses: ./.github/workflows/integrate.yaml

release:
name: Create & Push NuPkg
needs: [ meta, build ]
strategy:
fail-fast: true
max-parallel: 1
matrix:
include:
- rid: linux-x64
name: Linux
filename: ${{ needs.meta.outputs.linuxBaseName }}
short_sha: ${{ needs.meta.outputs.short_sha }}
- rid: osx
name: macOS
filename: ${{ needs.meta.outputs.macBaseName }}
short_sha: ${{ needs.meta.outputs.short_sha }}
- rid: win-x64
name: Windows
filename: ${{ needs.meta.outputs.winBaseName }}
short_sha: ${{ needs.meta.outputs.short_sha }}
runs-on: ubuntu-22.04
defaults:
run:
shell: bash
env:
DOTNET_NOLOGO: true
DOTNET_CLI_TELEMETRY_OPTOUT: true
steps:

- name: Download artifact
id: download
uses: actions/download-artifact@v3
with:
name: libtray-${{ matrix.name }}

- name: Download ancillary files
id: ancillary
env:
rawUrl: 'https://raw.githubusercontent.com/StirlingLabs/tray/master'
readmeFilename: README.md
iconFilename: icon.png
run: |
readme="README.md"
icon="icon.png"
wget --output-document $readme ${rawUrl}/${readmeFilename}
wget --output-document $icon ${rawUrl}/${iconFilename}
echo "readme=$readme" >> $GITHUB_OUTPUT
echo "icon=$icon" >> $GITHUB_OUTPUT
- name: List Files
run: |
ls -laR
- name: Rename Win DLL
id: rename
if: matrix.name == 'Windows'
env:
filename: ${{ matrix.filename }}
run: |
find . -maxdepth 1 -type f -name "*.dll" 2>/dev/null | wc -l
dllCount=$(find . -maxdepth 1 -type f -name "*.dll") 2>/dev/null
if [[ $dllCount -eq 1 ]] ; then
mv ./*.dll $filename
else
echo "Could not rename DLL, since $dllCount files were identified."
exit 1
fi
ls -laR
- name: Compute Values
id: compute
env:
description: ${{ needs.meta.outputs.description }}
rid: ${{ matrix.rid }}
run: |
prefixDesc=""
if [ "$description" != "" ] ; then
prefixDesc="${description}. "
fi
description="${prefixDesc}This package provides libraries for ${rid}."
echo "Description is $description"
echo "description=$description" >> "$GITHUB_OUTPUT"
- name: Create NuSpec
id: nuspec
uses: StirlingLabs/[email protected]
with:
id: StirlingLabs.${{ needs.meta.outputs.coreName }}.native.${{ matrix.rid }}
version: ${{ needs.meta.outputs.numericVersion }}
title: ${{ needs.meta.outputs.project }} runtime for ${{ matrix.rid }} ${{ needs.meta.outputs.textVersion }}
description: ${{ steps.compute.outputs.description }}
authors: assimp Team, packaged by Stirling Labs
fileSources: ${{ steps.download.outputs.download-path }}/${{ matrix.filename }}
fileTargets: runtimes/${{ matrix.rid }}/native/${{ matrix.filename }}
readme: ${{ steps.ancillary.outputs.readme }}
icon: ${{ steps.ancillary.outputs.icon }}
tags: SL StirlingLabs library
license: BSD-3-Clause
gitUrl: ${{ needs.meta.outputs.gitUrl }}
gitBranch: ${{ needs.meta.outputs.currentBranch }}
gitCommit: ${{ github.sha }}

- name: Package Files
env:
nuspec: ${{ steps.nuspec.outputs.filename }}
run: |
nuget pack $nuspec
ls -la
- name: Push NuPkg
env:
preRelease: ${{ needs.meta.outputs.preRelease }}
repoOwner: ${{ github.repository_owner }}
run: |
if [[ "$preRelease" == "true" ]] ; then
key=${{ github.token }}
url=https://nuget.pkg.github.com/${repoOwner}/index.json
else
key=${{ secrets.NUGET_STIRLINGLABS_API_KEY }}
url=https://api.nuget.org/v3/index.json
fi
dotnet nuget push *.nupkg --api-key $key --source $url --no-symbols --skip-duplicate
[ $? -ne 0 ] && echo "dotnet nuget push to $url returned errorlevel $?" || echo "Success."
complete:
name: Create GitHub Release
needs: [ meta, release ]
runs-on: ubuntu-22.04
defaults:
run:
shell: bash
env:
DOTNET_NOLOGO: true
DOTNET_CLI_TELEMETRY_OPTOUT: true
archiveName: ${{ needs.meta.outputs.project }}-v${{ needs.meta.outputs.textVersion }}.tar.gz
steps:

- name: Download artifact
id: download
uses: actions/download-artifact@v3

- name: Download ancillary files
id: ancillary
env:
rawUrl: 'https://raw.githubusercontent.com/StirlingLabs/tray/master'
readmeFilename: README.md
iconFilename: SL.png
headerFilename: src/tray.h
run: |
readme="README.md"
icon="icon.png"
header="tray.h"
wget --output-document "$readme" "${rawUrl}/${readmeFilename}"
wget --output-document "$icon" "${rawUrl}/${iconFilename}"
wget --output-document "$header" "${rawUrl}/${headerFilename}"
echo "readme=$readme" >> "$GITHUB_OUTPUT"
echo "icon=$icon" >> "$GITHUB_OUTPUT"
echo "header=$header" >> "$GITHUB_OUTPUT"
- name: Create release on GitHub
uses: softprops/action-gh-release@v1
with:
name: ${{ needs.meta.outputs.project}} ${{ needs.meta.outputs.fullVersion }}
files: |
${{ needs.meta.outputs.linuxName }}
${{ needs.meta.outputs.macName }}
${{ needs.meta.outputs.winName }}
${{ steps.ancillary.outputs.readme }}
${{ steps.ancillary.outputs.icon }}
${{ steps.ancillary.outputs.header }}
- name: Dispatch New Release event to tray.Net
if: false
run: >
curl -X POST https://api.github.com/repos/StirlingLabs/tray.Net/dispatches
-H 'Authorization: token ${{secrets.DAEMON_HOOKS}}'
-H "Accept: application/vnd.github.v3+json"
--data '{"event_type":"New tray Release","client_payload":{"tag":"${{needs.meta.outputs.tag}}"}}'
38 changes: 19 additions & 19 deletions .github/workflows/integrate.yaml
Original file line number Diff line number Diff line change
@@ -6,7 +6,13 @@ on:
pull_request:
branches: [ '**', '!gh-pages', '!coverage' ]
types: [ opened, reopened, ready_for_review, synchronize ]

workflow_call:
inputs:
ref:
description: Reference to use for checking out
default: ${{ github.sha }}
type: string

defaults:
run:
shell: bash
@@ -20,8 +26,8 @@ jobs:
name: Build
needs: threshold
if: |
needs.threshold.outputs.continue == 'true' &&
needs.threshold.outputs.release != 'true'
needs.threshold.outputs.continue == 'true' ||
needs.threshold.outputs.release == 'true'
strategy:
matrix:
os: [ ubuntu-latest, macos-latest, windows-latest ]
@@ -30,24 +36,23 @@ jobs:
- uses: actions/checkout@v3
- name: Install Ninja
run: |
case ${{ matrix.os }} in
ubuntu-latest) ninja_os=linux ;;
macos-latest) ninja_os=mac ;;
windows-latest) ninja_os=win ;;
case ${{ runner.os }} in
Linux) ninja_os=linux ;;
macOS) ninja_os=mac ;;
Windows) ninja_os=win ;;
esac
url="https://github.com/ninja-build/ninja/releases/latest/download/ninja-$ninja_os.zip"
curl -L -o ninja-$ninja_os.zip $url
if [[ ${{ matrix.os }} == 'windows-latest' ]]; then
if [[ ${{ runner.os }} == 'Windows' ]]; then
unzip ninja-$ninja_os.zip -d .
export PATH=$PATH:"$(pwd -W)"
ls -l
else
sudo unzip ninja-$ninja_os.zip -d /usr/local/bin/
fi
ninja --version
- name: Install Dependencies
if: startsWith(matrix.os, 'ubuntu')
if: runner.os == 'Linux'
run: |
echo "Need to install Qt..."
sudo apt-get update
@@ -60,17 +65,12 @@ jobs:
- name: Make
working-directory: build
run: ninja
- name: Rename
working-directory: build
if: startsWith(matrix.os, 'windows')
run: |
mv libtray.dll tray.dll
- uses: actions/upload-artifact@v3
name: Artifact
with:
name: libtray-{{ matrix.os }}
name: libtray-${{ runner.os }}
path: |
build/libtray.so
build/libtray.dylib
build/tray.dll
build/*.so
build/*.dylib
build/*.dll
if-no-files-found: error
17 changes: 9 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -3,15 +3,14 @@

Cross-platform, super tiny C99[^1] implementation of a system tray/menu bar icon with popup menu.

The optional primary-click callback can hide/show a window while secondary-click shows a menu.
If no callback is specified, either click will show the menu.
[^1]: At least, it's super tiny and C99 on Mac & Windows.

The system can be dynamically updated; icon, tooltip, menu items and status (checked/unchecked &
enabled/disabled) can all be both queried and changed at runtime. Code is C++ friendly and will
compile fine in C++98 and up on Windows or Mac but requires C++17 on Mac. This fork is intended
to make the functionality available as a library, for use from other languages.
The optional primary-click callback can hide/show a window while secondary-click shows a menu.
If no callback is specified, either click will show the menu. The system can be dynamically
updated; icon, tooltip, menu items and status (checked/unchecked & enabled/disabled) can all be
both queried and changed at runtime.

[^1]: At least it's super tiny and C99 on Mac & Windows.
Code is C++ friendly and will compile fine in C99 or C++98 and up on Windows or Mac but requires C++17 on Linux.

Focussed PRs are welcome, especially improvements to the Linux implementation. The goal is to
keep the code as simple as possible, so functionality beyond presenting a tray icon and menu is
@@ -117,7 +116,9 @@ Build & execute the `tray_example` application:

## History

This fork is in turn based on a previous [fork by dmikushin](https://github.com/dmikushin/tray) that brings together the
This fork is predominantly to make the functionality available as a library, for use from other languages.

It based on a previous [fork by dmikushin](https://github.com/dmikushin/tray) that brings together the
[original work of Serge Zaitsev](https://github.com/zserge/tray) and "the most interesting forks and PRs of
respectable contributors" including:

Binary file added SL.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 8576ddb

Please sign in to comment.