|
1 | 1 | name: CI |
| 2 | + |
2 | 3 | on: |
3 | 4 | push: |
4 | 5 | branches: [main] |
5 | 6 | pull_request: |
6 | 7 | branches: [main] |
| 8 | + |
| 9 | +env: |
| 10 | + XCODE_PROJECT: mplayer.xcodeproj |
| 11 | + XCODE_SCHEME: mplayer |
| 12 | + XCODE_DESTINATION: 'platform=macOS' |
| 13 | + BUILD_SETTINGS: 'CODE_SIGNING_ALLOWED=NO' |
| 14 | + |
7 | 15 | jobs: |
8 | 16 | build-and-test: |
9 | 17 | runs-on: macos-latest |
10 | 18 | steps: |
11 | 19 | - name: Checkout code |
12 | 20 | uses: actions/checkout@v4 |
| 21 | + |
13 | 22 | - name: Show Xcode version |
14 | 23 | run: xcodebuild -version |
15 | | - - name: Show available destinations |
16 | | - run: xcodebuild -project mplayer.xcodeproj -scheme mplayer -showdestinations |
17 | | - - name: Clean build directory |
18 | | - run: | |
19 | | - xcodebuild clean \ |
20 | | - -project mplayer.xcodeproj \ |
21 | | - -scheme mplayer |
22 | | - - name: Build project for macOS |
23 | | - run: | |
24 | | - xcodebuild build \ |
25 | | - -project mplayer.xcodeproj \ |
26 | | - -scheme mplayer \ |
27 | | - -destination 'platform=macOS' \ |
28 | | - -configuration Debug \ |
29 | | - CODE_SIGNING_ALLOWED=NO \ |
30 | | - ONLY_ACTIVE_ARCH=YES |
31 | | - - name: Run unit tests |
| 24 | + |
| 25 | + - name: Build and test (Debug) |
32 | 26 | run: | |
33 | 27 | xcodebuild test \ |
34 | | - -project mplayer.xcodeproj \ |
35 | | - -scheme mplayer \ |
36 | | - -destination 'platform=macOS' \ |
| 28 | + -project ${{ env.XCODE_PROJECT }} \ |
| 29 | + -scheme ${{ env.XCODE_SCHEME }} \ |
| 30 | + -destination ${{ env.XCODE_DESTINATION }} \ |
37 | 31 | -configuration Debug \ |
38 | | - CODE_SIGNING_ALLOWED=NO \ |
| 32 | + -derivedDataPath ./DerivedData \ |
| 33 | + ${{ env.BUILD_SETTINGS }} \ |
39 | 34 | ONLY_ACTIVE_ARCH=YES |
40 | | - - name: Build for Release configuration |
| 35 | +
|
| 36 | + - name: Build Release .app for distribution |
41 | 37 | run: | |
| 38 | + echo "🚀 Building Release .app for distribution..." |
42 | 39 | xcodebuild build \ |
43 | | - -project mplayer.xcodeproj \ |
44 | | - -scheme mplayer \ |
45 | | - -destination 'platform=macOS' \ |
| 40 | + -project ${{ env.XCODE_PROJECT }} \ |
| 41 | + -scheme ${{ env.XCODE_SCHEME }} \ |
| 42 | + -destination ${{ env.XCODE_DESTINATION }} \ |
46 | 43 | -configuration Release \ |
47 | | - CODE_SIGNING_ALLOWED=NO \ |
48 | | - ONLY_ACTIVE_ARCH=YES |
| 44 | + -derivedDataPath ./ReleaseData \ |
| 45 | + ${{ env.BUILD_SETTINGS }} \ |
| 46 | + ONLY_ACTIVE_ARCH=NO \ |
| 47 | + ARCHS="arm64" |
| 48 | +
|
| 49 | + - name: Package Release .app |
| 50 | + run: | |
| 51 | + # Create artifacts directory |
| 52 | + mkdir -p ./artifacts |
| 53 | +
|
| 54 | + # Find and copy Release .app |
| 55 | + RELEASE_APP=$(find ./ReleaseData -path "*/Release/*.app" -type d | head -1) |
| 56 | + if [ -n "$RELEASE_APP" ]; then |
| 57 | + cp -R "$RELEASE_APP" ./artifacts/mplayer-Release.app |
| 58 | + echo "✅ Release .app packaged successfully" |
| 59 | + ls -la ./artifacts/ |
| 60 | + else |
| 61 | + echo "❌ Release .app not found!" |
| 62 | + exit 1 |
| 63 | + fi |
| 64 | +
|
| 65 | + - name: Upload Release .app |
| 66 | + uses: actions/upload-artifact@v4 |
| 67 | + with: |
| 68 | + name: mplayer-release-${{ github.run_number }} |
| 69 | + path: ./artifacts/ |
| 70 | + retention-days: 30 |
| 71 | + |
49 | 72 | code-quality-check: |
50 | 73 | runs-on: macos-latest |
51 | 74 | steps: |
@@ -137,7 +160,33 @@ jobs: |
137 | 160 | if [ -d "./build/mplayer.xcarchive" ]; then |
138 | 161 | echo "Archive created successfully" |
139 | 162 | ls -la ./build/mplayer.xcarchive/ |
| 163 | +
|
| 164 | + # Also check for .app inside archive |
| 165 | + find ./build/mplayer.xcarchive -name "*.app" -type d |
140 | 166 | else |
141 | 167 | echo "Archive not found" |
142 | 168 | exit 1 |
143 | 169 | fi |
| 170 | + - name: Extract .app from archive |
| 171 | + run: | |
| 172 | + echo "📦 Extracting .app from archive..." |
| 173 | +
|
| 174 | + # Create archive artifacts directory |
| 175 | + mkdir -p ./archive-artifacts |
| 176 | +
|
| 177 | + # Find and copy .app from archive |
| 178 | + ARCHIVE_APP=$(find ./build/mplayer.xcarchive -name "*.app" -type d | head -1) |
| 179 | + if [ -n "$ARCHIVE_APP" ]; then |
| 180 | + cp -R "$ARCHIVE_APP" ./archive-artifacts/mplayer-Archive.app |
| 181 | + echo "✅ Extracted .app from archive" |
| 182 | + ls -la ./archive-artifacts/ |
| 183 | + else |
| 184 | + echo "❌ No .app found in archive" |
| 185 | + fi |
| 186 | + - name: Upload archive .app artifact |
| 187 | + uses: actions/upload-artifact@v4 |
| 188 | + if: success() |
| 189 | + with: |
| 190 | + name: mplayer-archive-app-${{ github.run_number }} |
| 191 | + path: ./archive-artifacts/ |
| 192 | + retention-days: 30 |
0 commit comments