Skip to content

Commit

Permalink
Removes Qt from macOS CI (#1137)
Browse files Browse the repository at this point in the history
  • Loading branch information
ultimaweapon authored Nov 23, 2024
1 parent 59f4e1d commit 3756a60
Show file tree
Hide file tree
Showing 8 changed files with 49 additions and 145 deletions.
90 changes: 3 additions & 87 deletions .github/workflows/ci-mac.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@ name: CI (Mac)
on:
workflow_call:
inputs:
macos:
type: string
required: true
kernel-target:
type: string
required: true
Expand All @@ -13,58 +10,10 @@ env:
jobs:
build:
name: Mac M1
runs-on: ${{ inputs.macos }}
env:
CMAKE_PREFIX_PATH: qt/6.7.2/macos
QT_URL_BASE: https://download.qt.io/online/qtsdkrepository/mac_x64/desktop/qt6_672/qt.qt6.672.clang_64/6.7.2-0-202406110330qtbase-MacOS-MacOS_13-Clang-MacOS-MacOS_13-X86_64-ARM64.7z
QT_URL_SVG: https://download.qt.io/online/qtsdkrepository/mac_x64/desktop/qt6_672/qt.qt6.672.clang_64/6.7.2-0-202406110330qtsvg-MacOS-MacOS_13-Clang-MacOS-MacOS_13-X86_64-ARM64.7z
runs-on: macos-14
steps:
- name: Set up Python 3.12 (the latest version that is able to build skia-bindings)
uses: actions/setup-python@v4
with:
python-version: "3.12"
- name: Checkout source
- name: Checkout repository
uses: actions/checkout@v4
- name: Generate cache keys
run: |
require Digest::MD5;
my $qt = Digest::MD5->new();
foreach my $name (sort keys %ENV) {
if ($name =~ /^QT_URL_/) {
$qt->add($ENV{$name});
}
}
open(my $output, '>>', $ENV{GITHUB_OUTPUT}) || die "Cannot open GITHUB_OUTPUT: $!";
print $output "qt=${{ runner.os }}-${{ runner.arch }}-qt-".$qt->hexdigest."\n";
print $output "target=${{ runner.os }}-${{ runner.arch }}-target\n";
shell: perl {0}
id: cache-keys
- name: Restore Qt
uses: actions/cache/restore@v4
with:
path: qt
key: ${{ steps.cache-keys.outputs.qt }}
id: qt-cache
- name: Install Qt
run: |
env | while IFS= read -r line; do
name=${line%%=*}
value=${line#*=}
if [[ $name == QT_URL_* ]]; then
curl -Lo qt.7z "$value"
7za x qt.7z -oqt
fi
done
if: ${{ steps.qt-cache.outputs.cache-hit != 'true' }}
- name: Restore target directory
uses: actions/cache/restore@v4
with:
path: target
key: ${{ steps.cache-keys.outputs.target }}
- name: Update Rust
run: rustup update stable
- name: Install Rust nightly
Expand All @@ -73,47 +22,14 @@ jobs:
run: rustup component add rust-src --toolchain nightly
- name: Install additional Rust targets
run: rustup target add ${{ inputs.kernel-target }}
- name: Run CMake
run: cmake --preset mac-release .
- name: Build
run: cmake --build --preset mac-release
- name: Build Slint
run: cargo build -p gui --bin obliteration -F slint -r
run: ./build.py -r
- name: Run tests
run: cargo test --workspace --exclude gui --exclude kernel
working-directory: src
- name: Create Application Bundle
run: |
cmake --install build --prefix "$(pwd)"
mkdir dist
mv obliteration.app dist/Obliteration.app
- name: Fix library paths
run: |
app="dist/Obliteration.app/Contents/MacOS/obliteration"
install_name_tool -change '@rpath/QtWidgets.framework/Versions/A/QtWidgets' '@executable_path/../Frameworks/QtWidgets.framework/Versions/A/QtWidgets' "$app"
install_name_tool -change '@rpath/QtGui.framework/Versions/A/QtGui' '@executable_path/../Frameworks/QtGui.framework/Versions/A/QtGui' "$app"
install_name_tool -change '@rpath/QtCore.framework/Versions/A/QtCore' '@executable_path/../Frameworks/QtCore.framework/Versions/A/QtCore' "$app"
otool -L "$app"
- name: Sign application
run: codesign -s - --entitlements entitlements.plist --deep --force dist/Obliteration.app
- name: Create Apple Disk Image
run: hdiutil create -volname Obliteration -srcfolder dist Obliteration.dmg
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: obliteration-mac-m1
path: Obliteration.dmg
- name: Cache target directory
uses: actions/cache/save@v4
with:
path: target
key: ${{ steps.cache-keys.outputs.target }}-${{ github.run_id }}
if: startsWith(github.ref, 'refs/heads/')
- name: Cache Qt
uses: actions/cache/save@v4
with:
path: qt
key: ${{ steps.cache-keys.outputs.qt }}
if: startsWith(github.ref, 'refs/heads/') && steps.qt-cache.outputs.cache-hit != 'true'
1 change: 0 additions & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ jobs:
name: Build
uses: ./.github/workflows/ci-mac.yml
with:
macos: macos-14
kernel-target: aarch64-unknown-none-softfloat
build-docs:
name: Build
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/pr-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ jobs:
uses: ./.github/workflows/ci-mac.yml
needs: prebuild
with:
macos: macos-14
kernel-target: aarch64-unknown-none-softfloat
build-docs:
name: Build
Expand Down
32 changes: 32 additions & 0 deletions Info.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleExecutable</key>
<string>obliteration</string>
<key>CFBundleGetInfoString</key>
<string></string>
<key>CFBundleIconFile</key>
<string>obliteration</string>
<key>CFBundleIdentifier</key>
<string>io.github.obhq.obliteration</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleLongVersionString</key>
<string></string>
<key>CFBundleName</key>
<string>Obliteration</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>0.1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>0.1.0</string>
<key>CSResourcesFileMapped</key>
<true/>
</dict>
</plist>
15 changes: 14 additions & 1 deletion build.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import shutil
from subprocess import PIPE, Popen, run
import sys
from urllib.parse import urlparse

def cargo(package, toolchain=None, target=None, release=False, args=None):
# Get package ID.
Expand All @@ -16,6 +17,13 @@ def cargo(package, toolchain=None, target=None, release=False, args=None):

id = run(cmd + ['pkgid', '-p', package], stdout=PIPE, check=True).stdout.decode('utf-8').strip()

# Parse package ID.
url = urlparse(id)
path = url.path

if platform.system() == 'Windows':
path = path[1:] # Remove '/' in front of drive letter.

# Setup command and its argument.
cmd.extend(['build', '-p', package])

Expand All @@ -31,7 +39,7 @@ def cargo(package, toolchain=None, target=None, release=False, args=None):
cmd.extend(['--message-format', 'json-render-diagnostics'])

# Run.
with Popen(cmd, stdout=PIPE) as proc:
with Popen(cmd, stdout=PIPE, cwd=path) as proc:
for line in proc.stdout:
line = json.loads(line)
reason = line['reason']
Expand Down Expand Up @@ -61,6 +69,11 @@ def export_darwin(root, kern, gui):
# Export files
shutil.copy(kern['executable'], resources)
shutil.copy(gui['executable'], macos)
shutil.copyfile('bundle.icns', os.path.join(resources, 'obliteration.icns'))
shutil.copy('Info.plist', contents)

# Sign bundle.
run(['codesign', '-s', '-', '--entitlements', 'entitlements.plist', bundle], check=True)

def export_linux(root, kern, gui):
# Create directories.
Expand Down
File renamed without changes.
43 changes: 0 additions & 43 deletions gui/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,6 @@ add_executable(obliteration WIN32 MACOSX_BUNDLE

if(WIN32)
target_sources(obliteration PRIVATE resources.rc vulkan.cpp)
elseif(APPLE)
target_sources(obliteration PRIVATE resources/obliteration.icns)
elseif(${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
target_sources(obliteration PRIVATE vulkan.cpp)
endif()
Expand All @@ -45,17 +43,6 @@ if(WIN32)
set_target_properties(obliteration PROPERTIES OUTPUT_NAME Obliteration)
endif()

if(APPLE)
set_target_properties(obliteration PROPERTIES
MACOSX_BUNDLE_GUI_IDENTIFIER io.github.obhq.obliteration
MACOSX_BUNDLE_BUNDLE_NAME Obliteration
MACOSX_BUNDLE_BUNDLE_VERSION 0.1.0
MACOSX_BUNDLE_SHORT_VERSION_STRING 0.1.0
MACOSX_BUNDLE_COPYRIGHT "Copyright © Obliteration Contributors"
MACOSX_BUNDLE_ICON_FILE obliteration
RESOURCE resources/obliteration.icns)
endif()

target_compile_features(obliteration PRIVATE cxx_std_17)

target_link_libraries(obliteration PRIVATE Qt6::Svg Qt6::Widgets)
Expand All @@ -73,33 +60,3 @@ elseif(APPLE)
else()
target_link_libraries(obliteration PRIVATE ${CMAKE_DL_LIBS})
endif()

if(APPLE)
add_custom_command(TARGET obliteration POST_BUILD
COMMAND codesign -s - --entitlements ${CMAKE_SOURCE_DIR}/entitlements.plist obliteration.app)
endif()

# Setup installation.
if(WIN32)
install(TARGETS obliteration DESTINATION .)
else()
install(TARGETS obliteration BUNDLE DESTINATION . RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
endif()

if(WIN32)
install(SCRIPT deploy-win32.cmake)
elseif(APPLE)
qt_generate_deploy_app_script(
TARGET obliteration
OUTPUT_SCRIPT QT_DEPLOY_SCRIPT
NO_TRANSLATIONS
NO_COMPILER_RUNTIME)

install(SCRIPT ${QT_DEPLOY_SCRIPT})
endif()

if(APPLE)
install(IMPORTED_RUNTIME_ARTIFACTS obkrnl DESTINATION obliteration.app/Contents/Resources)
else()
install(IMPORTED_RUNTIME_ARTIFACTS obkrnl DESTINATION share)
endif()
12 changes: 0 additions & 12 deletions gui/deploy-win32.cmake

This file was deleted.

0 comments on commit 3756a60

Please sign in to comment.