Fix shared classes being defined both in unit tests and Sparkle (#2629) #1516
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build & Tests | |
on: | |
push: | |
branches: [ 2.x, master ] | |
pull_request: | |
branches: [ 2.x, master ] | |
jobs: | |
build: | |
strategy: | |
matrix: | |
xcode: ['xcode16.1_beta', 'xcode15.4'] | |
include: | |
- xcode: 'xcode15.4' | |
xcode-path: '/Applications/Xcode_15.4.app/Contents/Developer' | |
upload-dist: true | |
run-analyzer: true | |
macos: 'macos-14' | |
- xcode: 'xcode16.1_beta' | |
xcode-path: '/Applications/Xcode_16.1_beta.app' | |
upload-dist: false | |
run-analyzer: false | |
macos: 'macos-14' | |
name: Build and Test Sparkle | |
runs-on: ${{ matrix.macos }} | |
permissions: | |
pull-requests: write | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
submodules: true | |
fetch-depth: 0 | |
- name: Build Unit Tests | |
env: | |
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-path }} | |
run: | | |
xcodebuild test-without-building -project Sparkle.xcodeproj -scheme Distribution -enableCodeCoverage YES -derivedDataPath build | |
- name: Build UI Tests | |
env: | |
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-path }} | |
run: | | |
xcodebuild test-without-building -project Sparkle.xcodeproj -scheme UITests -configuration Debug -derivedDataPath build | |
- name: Analyze Sparkle | |
if: ${{ matrix.run-analyzer && github.event_name == 'pull_request' }} | |
env: | |
DEVELOPER_DIR: ${{ matrix.xcode-path }} | |
run: | | |
xcodebuild analyze -project Sparkle.xcodeproj -quiet -scheme Sparkle -configuration Release -derivedDataPath analyze > analyze_output.txt | |
- name: Find Analyzed Warnings | |
if: ${{ success() && matrix.run-analyzer && github.event_name == 'pull_request' }} | |
id: findwarnings | |
env: | |
DEVELOPER_DIR: ${{ matrix.xcode-path }} | |
run: | | |
if grep -q "warning:" analyze_output.txt; then | |
echo '::set-output name=analyzestatus::0' | |
else | |
echo '::set-output name=analyzestatus::1' | |
fi | |
- name: Extract Analyzed Warnings | |
if: ${{ success() && matrix.run-analyzer && github.event_name == 'pull_request' && steps.findwarnings.outputs.analyzestatus == '0' }} | |
id: warnings | |
run: | | |
echo ::set-output name=content::$(cat analyze_output.txt) | |
- name: Post Analyzed Warnings | |
if: ${{ success() && matrix.run-analyzer && github.event_name == 'pull_request' && steps.findwarnings.outputs.analyzestatus == '0' }} | |
uses: mshick/add-pr-comment@v2 | |
with: | |
allow-repeats: false | |
message: "``` ${{ steps.warnings.outputs.content }} ```" | |
- name: Build Release Distribution | |
env: | |
DEVELOPER_DIR: ${{ matrix.xcode-path }} | |
run: | | |
xcodebuild build -project Sparkle.xcodeproj -scheme Distribution -configuration Release -derivedDataPath build | |
- name: Archive Test Results | |
if: failure() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: build-logs | |
path: build/Logs | |
- name: Upload Distribution | |
if: ${{ success() && matrix.upload-dist }} | |
uses: actions/upload-artifact@v4 | |
with: | |
name: Sparkle-distribution-${{ matrix.xcode }}.tar.xz | |
path: build/Build/Products/Release/sparkle-dist.tar.xz |