From ef686567837774b5f64289fa83b9402968081564 Mon Sep 17 00:00:00 2001 From: Zorg Date: Sat, 6 Mar 2021 21:53:31 -0800 Subject: [PATCH 1/4] Test validity of archived products and upload distribution in CI --- .github/workflows/ci.yml | 6 ++++++ Configurations/make-release-package.sh | 30 ++++++++++++++++++++++++++ 2 files changed, 36 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index edea7bcd..d4a46463 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -50,3 +50,9 @@ jobs: with: name: build-logs path: build/Logs + - name: Upload Distribution + if: success() + uses: actions/upload-artifact@v2 + with: + name: Sparkle-dist + path: /tmp/sparkle-dist.tar.xz diff --git a/Configurations/make-release-package.sh b/Configurations/make-release-package.sh index 5e3b1539..40e9460e 100755 --- a/Configurations/make-release-package.sh +++ b/Configurations/make-release-package.sh @@ -74,13 +74,43 @@ 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 + rm -f "/tmp/sparkle-dist.tar.xz" + cp "../Sparkle-$CURRENT_PROJECT_VERSION.tar.xz" "/tmp/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 From 018d4ea630a5319f43f4f1bb0a29ffdc57ad9fa9 Mon Sep 17 00:00:00 2001 From: Zorg Date: Sat, 6 Mar 2021 22:14:27 -0800 Subject: [PATCH 2/4] Reference relative path --- .github/workflows/ci.yml | 4 ++-- Configurations/make-release-package.sh | 3 +-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d4a46463..37dc6a58 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -54,5 +54,5 @@ jobs: if: success() uses: actions/upload-artifact@v2 with: - name: Sparkle-dist - path: /tmp/sparkle-dist.tar.xz + name: Sparkle-distribution.tar.xz + path: build/Build/Products/Release/sparkle-dist.tar.xz diff --git a/Configurations/make-release-package.sh b/Configurations/make-release-package.sh index 40e9460e..f6e1682f 100755 --- a/Configurations/make-release-package.sh +++ b/Configurations/make-release-package.sh @@ -82,8 +82,7 @@ if [ "$ACTION" = "" ] ; then find . \! -type d | rev | sort | rev | tar cv --files-from=- | xz -9 > "../Sparkle-$CURRENT_PROJECT_VERSION.tar.xz" # Copy archived distribution for CI - rm -f "/tmp/sparkle-dist.tar.xz" - cp "../Sparkle-$CURRENT_PROJECT_VERSION.tar.xz" "/tmp/sparkle-dist.tar.xz" + 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" From 3ded119af568a14af8789a13d9c3186dcbf9e761 Mon Sep 17 00:00:00 2001 From: Zorg Date: Sat, 6 Mar 2021 22:47:49 -0800 Subject: [PATCH 3/4] Include Xcode version in artifact upload --- .github/workflows/ci.yml | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 37dc6a58..fd813036 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -10,7 +10,13 @@ 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' + - xcode: 'xcode11.7' + xcode-path: '/Applications/Xcode_11.7.app/Contents/Developer' + name: Build and Test Sparkle runs-on: macos-10.15 @@ -21,27 +27,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 @@ -54,5 +60,5 @@ jobs: if: success() uses: actions/upload-artifact@v2 with: - name: Sparkle-distribution.tar.xz + name: Sparkle-distribution-${{ matrix.xcode }}.tar.xz path: build/Build/Products/Release/sparkle-dist.tar.xz From 2179eb1e394adf7a97ed082d10e3973c8ba41aad Mon Sep 17 00:00:00 2001 From: Zorg Date: Sat, 6 Mar 2021 23:19:25 -0800 Subject: [PATCH 4/4] Upload release distribution only for Xcode 12 builds currently --- .github/workflows/ci.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index fd813036..30aec1f3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -14,8 +14,10 @@ jobs: 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 @@ -57,7 +59,7 @@ jobs: name: build-logs path: build/Logs - name: Upload Distribution - if: success() + if: ${{ success() && matrix.upload-dist }} uses: actions/upload-artifact@v2 with: name: Sparkle-distribution-${{ matrix.xcode }}.tar.xz