Merge pull request #1793 from sparkle-project/ci-upload-dist

Test validity of archived products and upload distribution in CI
This commit is contained in:
Mayur Pawashe authored and GitHub committed 2021-03-07 09:23:50 -08:00
commit f74f9d288d
2 files changed
+49 -6

No files matched your search

+20 -6
View File
@@ -10,7 +10,15 @@ jobs:
build:
strategy:
matrix:
xcode: ['/Applications/Xcode_12.2.app/Contents/Developer', '/Applications/Xcode_11.7.app/Contents/Developer']
xcode: ['xcode12.2', 'xcode11.7']
include:
- xcode: 'xcode12.2'
xcode-path: '/Applications/Xcode_12.2.app/Contents/Developer'
upload-dist: true
- xcode: 'xcode11.7'
xcode-path: '/Applications/Xcode_11.7.app/Contents/Developer'
upload-dist: false # No arm64 slice, so no upload
name: Build and Test Sparkle
runs-on: macos-10.15
@@ -21,27 +29,27 @@ jobs:
submodules: true
- name: Build Unit Tests
env:
DEVELOPER_DIR: ${{ matrix.xcode }}
DEVELOPER_DIR: ${{ matrix.xcode-path }}
run: |
xcodebuild build-for-testing -project Sparkle.xcodeproj -scheme Distribution -enableCodeCoverage YES -derivedDataPath build
- name: Run Unit Tests
env:
DEVELOPER_DIR: ${{ matrix.xcode }}
DEVELOPER_DIR: ${{ matrix.xcode-path }}
run: |
xcodebuild test-without-building -project Sparkle.xcodeproj -scheme Distribution -enableCodeCoverage YES -derivedDataPath build
- name: Build UI Tests
env:
DEVELOPER_DIR: ${{ matrix.xcode }}
DEVELOPER_DIR: ${{ matrix.xcode-path }}
run: |
xcodebuild build-for-testing -project Sparkle.xcodeproj -scheme UITests -configuration Debug -derivedDataPath build
- name: Run UI Tests
env:
DEVELOPER_DIR: ${{ matrix.xcode }}
DEVELOPER_DIR: ${{ matrix.xcode-path }}
run: |
xcodebuild test-without-building -project Sparkle.xcodeproj -scheme UITests -configuration Debug -derivedDataPath build
- name: Build Release Distribution
env:
DEVELOPER_DIR: ${{ matrix.xcode }}
DEVELOPER_DIR: ${{ matrix.xcode-path }}
run: |
xcodebuild build -project Sparkle.xcodeproj -scheme Distribution -configuration Release -derivedDataPath build
- name: Archive Test Results
@@ -50,3 +58,9 @@ jobs:
with:
name: build-logs
path: build/Logs
- name: Upload Distribution
if: ${{ success() && matrix.upload-dist }}
uses: actions/upload-artifact@v2
with:
name: Sparkle-distribution-${{ matrix.xcode }}.tar.xz
path: build/Build/Products/Release/sparkle-dist.tar.xz
+29
View File
@@ -74,13 +74,42 @@ if [ "$ACTION" = "" ] ; then
XZ_EXISTS=0
fi
rm -rf "/tmp/sparkle-extract"
mkdir -p "/tmp/sparkle-extract"
# Sorted file list groups similar files together, which improves tar compression
if [ "$XZ_EXISTS" -eq 1 ] ; then
find . \! -type d | rev | sort | rev | tar cv --files-from=- | xz -9 > "../Sparkle-$CURRENT_PROJECT_VERSION.tar.xz"
# Copy archived distribution for CI
cp -f "../Sparkle-$CURRENT_PROJECT_VERSION.tar.xz" "../sparkle-dist.tar.xz"
# Extract archive for testing binary validity
tar -xf "../Sparkle-$CURRENT_PROJECT_VERSION.tar.xz" -C "/tmp/sparkle-extract"
else
# Fallback to bz2 compression if xz utility is not available
find . \! -type d | rev | sort | rev | tar cjvf "../Sparkle-$CURRENT_PROJECT_VERSION.tar.bz2" --files-from=-
# Extract archive for testing binary validity
tar -xf "../Sparkle-$CURRENT_PROJECT_VERSION.tar.bz2" -C "/tmp/sparkle-extract"
fi
# Test code signing validity of the extracted products
# This guards against our archives being corrupt / created incorrectly
codesign --verify -vvv --deep "/tmp/sparkle-extract/Sparkle.framework"
codesign --verify -vvv --deep "/tmp/sparkle-extract/SparkleCore.framework"
codesign --verify -vvv --deep "/tmp/sparkle-extract/XPCServices/org.sparkle-project.Downloader.xpc"
codesign --verify -vvv --deep "/tmp/sparkle-extract/XPCServices/org.sparkle-project.InstallerConnection.xpc"
codesign --verify -vvv --deep "/tmp/sparkle-extract/XPCServices/org.sparkle-project.InstallerLauncher.xpc"
codesign --verify -vvv --deep "/tmp/sparkle-extract/XPCServices/org.sparkle-project.InstallerStatus.xpc"
codesign --verify -vvv --deep "/tmp/sparkle-extract/sparkle.app"
codesign --verify -vvv --deep "/tmp/sparkle-extract/Sparkle Test App.app"
codesign --verify -vvv --deep "/tmp/sparkle-extract/bin/BinaryDelta"
codesign --verify -vvv --deep "/tmp/sparkle-extract/bin/generate_appcast"
codesign --verify -vvv --deep "/tmp/sparkle-extract/bin/sign_update"
codesign --verify -vvv --deep "/tmp/sparkle-extract/bin/generate_keys"
rm -rf "/tmp/sparkle-extract"
rm -rf "$CONFIGURATION_BUILD_DIR/staging"
# Generate zip containing the xcframework for SPM