Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 18 additions & 1 deletion .github/actions/build-lin/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ outputs:
xpl-file-name:
description: Path to the resulting xpl file
value: ${{ steps.return.outputs.xpl-file-name }}
pdb-file-name:
description: Path to the resulting .debug.zip file (debug symbol info)
value: ${{ steps.return.outputs.pdb-file-name }}

runs:
using: "composite"
Expand Down Expand Up @@ -53,9 +56,23 @@ runs:
echo Expected target build not found: "$TARGET_XPL"
exit 1
fi
- name: Extract symbol info
shell: bash
env:
TARGET_XPL: ${{ inputs.baseDir }}build-lin/${{ inputs.archFolder }}/${{ inputs.pluginName }}.xpl
TARGET_DBG: ${{ inputs.baseDir }}build-lin/${{ inputs.archFolder }}/${{ inputs.pluginName }}.xpl.debug
TARGET_PDB: ${{ inputs.baseDir }}build-lin/${{ inputs.archFolder }}/${{ inputs.pluginName }}.xpl.debug.zip
run: |
objcopy --only-keep-debug "$TARGET_XPL" "$TARGET_DBG"
strip --strip-debug --strip-unneeded "$TARGET_XPL"
objcopy --add-gnu-debuglink="$TARGET_DBG" "$TARGET_XPL"
zip -9 "$TARGET_PDB" "$TARGET_DBG"
- name: Return Value
id: return
shell: bash
env:
TARGET_XPL: ${{ inputs.baseDir }}build-lin/${{ inputs.archFolder }}/${{ inputs.pluginName }}.xpl
run: echo "::set-output name=xpl-file-name::$(echo $TARGET_XPL)"
TARGET_PDB: ${{ inputs.baseDir }}build-lin/${{ inputs.archFolder }}/${{ inputs.pluginName }}.xpl.debug.zip
run: |
echo "xpl-file-name=$(echo $TARGET_XPL)" >> $GITHUB_OUTPUT
echo "pdb-file-name=$(echo $TARGET_PDB)" >> $GITHUB_OUTPUT
19 changes: 18 additions & 1 deletion .github/actions/build-mac/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ outputs:
xpl-file-name:
description: Path to the resulting xpl file
value: ${{ steps.return.outputs.xpl-file-name }}
pdb-file-name:
description: Path to the resulting .dSYM.zip file (debug symbol info)
value: ${{ steps.return.outputs.pdb-file-name }}

runs:
using: "composite"
Expand Down Expand Up @@ -52,9 +55,23 @@ runs:
echo Expected target build not found: "$TARGET_XPL"
exit 1
fi
- name: Extract symbol info
shell: bash
env:
TARGET_XPL: ${{ inputs.baseDir }}build-mac/${{ inputs.archFolder }}/${{ inputs.pluginName }}.xpl
TARGET_DSYM: ${{ inputs.baseDir }}build-mac/${{ inputs.archFolder }}/${{ inputs.pluginName }}.xpl.dSYM
TARGET_PDB: ${{ inputs.baseDir }}build-mac/${{ inputs.archFolder }}/${{ inputs.pluginName }}.xpl.dSYM.zip
run: |
dsymutil "$TARGET_XPL"
zip -9r "$TARGET_PDB" "$TARGET_DSYM"
rm -rf "$TARGET_DSYM"
strip -S "$TARGET_XPL"
- name: Return Value
id: return
shell: bash
env:
TARGET_XPL: ${{ inputs.baseDir }}build-mac/${{ inputs.archFolder }}/${{ inputs.pluginName }}.xpl
run: echo "::set-output name=xpl-file-name::$(echo $TARGET_XPL)"
TARGET_PDB: ${{ inputs.baseDir }}build-mac/${{ inputs.archFolder }}/${{ inputs.pluginName }}.xpl.dSYM.zip
run: |
echo "xpl-file-name=$(echo $TARGET_XPL)" >> $GITHUB_OUTPUT
echo "pdb-file-name=$(echo $TARGET_PDB)" >> $GITHUB_OUTPUT
4 changes: 2 additions & 2 deletions .github/actions/build-win/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,5 +45,5 @@ runs:
TARGET_XPL: ${{ inputs.baseDir }}build-win/${{ inputs.pluginName }}.xpl
TARGET_PDB: ${{ inputs.baseDir }}build-win/${{ inputs.pluginName }}.pdb
run: |
echo "::set-output name=xpl-file-name::$(echo $TARGET_XPL)"
echo "::set-output name=pdb-file-name::$(echo $TARGET_PDB)"
echo "xpl-file-name=$(echo $TARGET_XPL)" >> $GITHUB_OUTPUT
echo "pdb-file-name=$(echo $TARGET_PDB)" >> $GITHUB_OUTPUT
6 changes: 3 additions & 3 deletions .github/actions/sign-notarize/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ It waits for Apple's answer to notarization, which can take a couple of minutes!

Parameter|Requied|Default|Description
---------|-------|-------|------------
`bundleId`|yes||Plugin's bundle id, something like 'Author.plugin.NameOfPlugin
`xplFileName`|yes||Path to just built xpl plugin
`certificate`|yes||Base64 encoded .p12 certificate file
`certPwd`|yes||Password of the .p12 certificate file
`notarizeUser`|yes||Username/EMail for notarization
`notarizeAppPwd`|yes||App-specific password for notarization
`notarizeUser`|yes||Apple ID for notarization service (parameter `--apple-id` to `notarytool`)
`notarizeTeam`|yes||Team ID for notarization service (parameter `--team-id` to `notarytool`)
`notarizeAppPwd`|yes||[App-specific password](https://support.apple.com/en-gb/HT204397) for notarization service (parameter `--password` to `notarytool`)

## What it does

Expand Down
12 changes: 6 additions & 6 deletions .github/actions/sign-notarize/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,7 @@ name: Sign/Notarize MacOS plugin
description: Signs, then notarizes the plugin
author: TwinFan

inputs:
bundleId:
description: "Plugin's bundle id, something like 'Author.plugin.NameOfPlugin"
required: true
inputs:
xplFileName:
description: "Path to just built xpl plugin"
required: true
Expand All @@ -16,7 +13,10 @@ inputs:
description: "Password of the .p12 certificate file"
required: true
notarizeUser:
description: "Username/EMail for notarization"
description: "Apple-ID for notarization"
required: true
notarizeTeam:
description: "Team-ID for notarization"
required: true
notarizeAppPwd:
description: "App-specific password for notarization"
Expand All @@ -30,4 +30,4 @@ runs:
run: |
echo ${{ inputs.certificate }} | base64 --decode > certificate.p12
chmod a+x ${{ github.action_path }}/sign-notarize
${{ github.action_path }}/sign-notarize "${{ inputs.xplFileName }}" "${{ inputs.bundleId }}" certificate.p12 "${{ inputs.certPwd }}" "${{ inputs.notarizeUser }}" "${{ inputs.notarizeAppPwd }}"
${{ github.action_path }}/sign-notarize "${{ inputs.xplFileName }}" certificate.p12 "${{ inputs.certPwd }}" "${{ inputs.notarizeUser }}" "${{ inputs.notarizeTeam }}" "${{ inputs.notarizeAppPwd }}"
55 changes: 10 additions & 45 deletions .github/actions/sign-notarize/sign-notarize
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
#
# Parameters
# 1. Path to file to sign, then notarize
# 2. Bundle id to use during notarization
# 3. Signing ID file like 'certificate.p12'
# 4. Password for above p12 file
# 5. Username for notarization
# 6. App-specific password for notarization
# 2. Signing ID file like 'certificate.p12'
# 3. Password for above p12 file
# 4. Apple ID for notarization (parameter --apple-id to notarytool)
# 5. Team ID for notarization (parmeter --team-id to notarytool)
# 6. App-specific password for notarization (parameter --password to notarytool)

set -eu

Expand All @@ -18,33 +18,6 @@ function cleanup {
security delete-keychain build.keychain
}

# --- Function to check for notarization results

check_notarization() {
local REQUID=$1
local USERNAME=$2
local USERPWD=$3
local STATUS="in progress"
while [ "$STATUS" == "in progress" ]
do
echo "Wait 30s for results..."
sleep 30
STATUS=`xcrun altool --notarization-info "$REQUID" -u "$USERNAME" -p "$USERPWD" | egrep -o '(in progress|success|invalid)'`
done

case $STATUS in
success) echo ">>> SUCCESS <<<"
return 0
;;
invalid) echo "%%% INVALID %%%"
return 1
;;
*) echo "Unknown status $STATUS"
return 1
;;
esac
}

# ==================================================================
# Read parameters

Expand All @@ -55,10 +28,10 @@ then
fi

PATH_TO_FILE=$1
BUNDLE_ID=$2
SIGN_ID_FILE=$3
SIGN_ID_PWD=$4
NOTAR_USER=$5
SIGN_ID_FILE=$2
SIGN_ID_PWD=$3
NOTAR_USER=$4
NOTAR_TEAM=$5
NOTAR_PWD=$6

# --- Sign
Expand Down Expand Up @@ -91,17 +64,9 @@ echo .

# Can only send zip archives to notarization
zip -v "$PATH_TO_FILE.zip" "$PATH_TO_FILE"
REQUID=`xcrun altool --notarize-app --primary-bundle-id "$BUNDLE_ID" --username "$NOTAR_USER" --password "$NOTAR_PWD" --file "$PATH_TO_FILE.zip" | egrep -o '([a-z0-9]+-){4}[a-z0-9]+'`
xcrun notarytool submit --wait --apple-id "$NOTAR_USER" --password "$NOTAR_PWD" --team-id "$NOTAR_TEAM" "$PATH_TO_FILE.zip"
rm "$PATH_TO_FILE.zip"

# --- Check notarization results ---

echo .
echo "--- Check notarization results ---"
echo .

check_notarization "$REQUID" "$NOTAR_USER" "$NOTAR_PWD"

# Note: No stapling possible to .xpl files

echo .
Expand Down
4 changes: 2 additions & 2 deletions .github/actions/upload-plugin/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ runs:
mv "${{ inputs.pdbFileName }}" "deploy-${{ inputs.pluginName }}/${{ inputs.pluginName }}/${{ inputs.archFolder }}"
fi
- name: Upload plugin
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
with:
name: ${{ inputs.pluginName }}
name: ${{ inputs.pluginName }}-${{ env.platform }}
path: deploy-${{ inputs.pluginName }}/* # this way the top folder in the artifacts is "MyPlugin"
if-no-files-found: error
23 changes: 14 additions & 9 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,17 @@ on:
env:
PRJ_BASE: Example/ # The base directory from which we build everything
PRJ_NAME: LTAPIExample # The plugin's name, expected to be the .xpl file's name and used as the plugin folder name
PRJ_BUNDLEID: TwinFan.plugin.LTAPIExample

jobs:
#####################################
# Linux with GCC
build-lin:
runs-on: ubuntu-latest
runs-on: ubuntu-20.04
env:
platform: lin
steps:
- name: Checkout Code
uses: actions/checkout@v2 # must checkout before we can use our own actions
uses: actions/checkout@v4 # must checkout before we can use our own actions
- name: Build
uses: ./.github/actions/build-lin
id: build
Expand All @@ -32,14 +33,17 @@ jobs:
pluginName: ${{ env.PRJ_NAME }}
archFolder: lin_x64
xplFileName: "${{ steps.build.outputs.xpl-file-name }}"
pdbFileName: "${{ steps.build.outputs.pdb-file-name }}"

#####################################
# MacOS with CMake/clang and sign/notarize in self-written script
build-mac:
runs-on: macos-latest
runs-on: macos-14
env:
platform: mac
steps:
- name: Checkout Code
uses: actions/checkout@v2 # must checkout before we can use our own actions
uses: actions/checkout@v4 # must checkout before we can use our own actions
- name: Build
uses: ./.github/actions/build-mac
id: build
Expand All @@ -53,34 +57,35 @@ jobs:
shell: bash
run: |
if [ "$MACOS_CERTIFICATE" == "" ]; then
echo ::set-output name=secretspresent::
echo "secretspresent=" >> $GITHUB_OUTPUT
else
echo ::set-output name=secretspresent::true
echo "secretspresent=true" >> $GITHUB_OUTPUT
fi
- name: Codesign and Notarization
if: ${{ steps.checksecrets.outputs.secretspresent }}
uses: ./.github/actions/sign-notarize
with:
bundleId: ${{ env.PRJ_BUNDLEID }}
xplFileName: ${{ steps.build.outputs.xpl-file-name }}
certificate: ${{ secrets.MACOS_CERTIFICATE }}
certPwd: ${{ secrets.MACOS_CERT_PWD }}
notarizeUser: ${{ secrets.NOTARIZATION_USERNAME }}
notarizeTeam: ${{ secrets.NOTARIZATION_TEAM }}
notarizeAppPwd: ${{ secrets.NOTARIZATION_PASSWORD }}
- name: Upload
uses: ./.github/actions/upload-plugin
with:
pluginName: ${{ env.PRJ_NAME }}
archFolder: mac_x64
xplFileName: ${{ steps.build.outputs.xpl-file-name }}
pdbFileName: "${{ steps.build.outputs.pdb-file-name }}"

#####################################
# Windows with MS Visual Studio
build-win:
runs-on: windows-2022
steps:
- name: Checkout Code
uses: actions/checkout@v2 # must checkout before we can use our own actions
uses: actions/checkout@v4 # must checkout before we can use our own actions
- name: Build
uses: ./.github/actions/build-win
id: build
Expand Down
40 changes: 27 additions & 13 deletions Example/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,15 +1,33 @@
# LT_API build script.
#

cmake_minimum_required(VERSION 3.9)
project(LT_API VERSION 1.0.0 DESCRIPTION "LiveTraffic API Example Plugin")
cmake_minimum_required(VERSION 3.16)

# Mac: Need to tell early on that we want a cross platform build
if(DEFINED ENV{platform})
message ("-- Platform is $ENV{platform}")
if($ENV{platform} STREQUAL "mac-x86")
message (" Building cross-platform for mac/x86_64")
set(CMAKE_OSX_ARCHITECTURES "x86_64" CACHE STRING "Archs to build")
elseif($ENV{platform} STREQUAL "mac-arm")
message (" Building cross-platform for mac/arm64")
set(CMAKE_OSX_ARCHITECTURES "arm64" CACHE STRING "Archs to build")
elseif($ENV{platform} STREQUAL "mac")
message (" Building cross-platform for both mac/x86_64 and mac/arm64")
set(CMAKE_OSX_ARCHITECTURES "x86_64;arm64" CACHE STRING "Archs to build")
endif()
else()
# No 'platform' defined could mean running from command line, assume we build universal image in one go via XCode
set(CMAKE_OSX_ARCHITECTURES "x86_64;arm64" CACHE STRING "Archs to build")
endif()

# By default, use optimized release configuration.
if (NOT CMAKE_BUILD_TYPE OR CMAKE_BUILD_TYPE STREQUAL "")
set(CMAKE_BUILD_TYPE "Release" CACHE STRING "" FORCE)
endif ()
set(CMAKE_BUILD_TYPE RelWithDebInfo)

set(CMAKE_CXX_STANDARD 11)
project(LT_API VERSION 1.3.0 DESCRIPTION "LiveTraffic API Example Plugin")

set(CMAKE_CXX_STANDARD 17)
set_property(GLOBAL PROPERTY CXX_STANDARD_REQUIRED 17)
set_property(GLOBAL PROPERTY CXX_STANDARD 17)

# Set include directories used by our code and dependencies.
include_directories("${CMAKE_CURRENT_SOURCE_DIR}/..")
Expand Down Expand Up @@ -68,13 +86,9 @@ else()
if(MSVC)
# Use highest optimization level in Release builds
add_compile_options(/GL)
elseif(APPLE)
add_compile_options(-O3 -fPIC)
elseif (UNIX OR MINGW)
# Use position-independent code and highest optimization level (FPS!).
else()
# Use position-independent code and highest optimization level
add_compile_options(-O3 -fPIC)
# Strip symbols during linking
add_link_options(-s)
endif()
endif()

Expand Down
Loading