|
1 | 1 | name: CI |
2 | 2 |
|
3 | 3 | on: |
4 | | - push: |
5 | | - branches: [main, develop] |
6 | | - pull_request: |
7 | | - branches: [main, develop] |
| 4 | + push: |
| 5 | + branches: [main, develop] |
| 6 | + pull_request: |
| 7 | + branches: [main, develop] |
8 | 8 |
|
9 | 9 | concurrency: |
10 | | - group: ${{ github.workflow }}-${{ github.ref }} |
11 | | - cancel-in-progress: true |
| 10 | + group: ${{ github.workflow }}-${{ github.ref }} |
| 11 | + cancel-in-progress: true |
12 | 12 |
|
13 | 13 | jobs: |
14 | | - test: |
15 | | - name: ${{ matrix.name }} |
16 | | - runs-on: ${{ matrix.runner }} |
17 | | - strategy: |
18 | | - fail-fast: false |
19 | | - matrix: |
20 | | - include: |
21 | | - - name: "macOS Universal" |
22 | | - runner: macos-15 |
23 | | - platform: "macOS" |
24 | | - xcode: "16.4" |
25 | | - arch: "universal" |
26 | | - comprehensive_test: true |
27 | | - lint_check: true |
28 | | - - name: "Linux x86_64" |
29 | | - runner: ubuntu-latest |
30 | | - platform: "Linux" |
31 | | - arch: "x86_64" |
32 | | - triple: "x86_64-unknown-linux-gnu" |
33 | | - comprehensive_test: true |
34 | | - lint_check: true |
35 | | - - name: "Linux ARM64" |
36 | | - runner: ubuntu-24.04-arm |
37 | | - platform: "Linux" |
38 | | - arch: "aarch64" |
39 | | - triple: "aarch64-unknown-linux-gnu" |
40 | | - comprehensive_test: true |
41 | | - lint_check: true |
42 | | - |
43 | | - steps: |
44 | | - - name: Checkout code |
45 | | - uses: actions/checkout@v4 |
46 | | - |
47 | | - - name: Select Xcode version (macOS only) |
48 | | - if: matrix.platform == 'macOS' |
49 | | - run: sudo xcode-select -s /Applications/Xcode_${{ matrix.xcode }}.app/Contents/Developer |
50 | | - |
51 | | - - name: Setup Swift (Linux only) |
52 | | - if: matrix.platform == 'Linux' |
53 | | - run: ./Scripts/setup-swift-linux.sh |
54 | | - |
55 | | - - name: Show Swift version |
56 | | - run: swift --version |
57 | | - |
58 | | - - name: Cache Swift Package Manager |
59 | | - uses: actions/cache@v4 |
60 | | - with: |
61 | | - path: | |
62 | | - .build |
63 | | - ~/.cache/org.swift.swiftpm |
64 | | - key: ${{ runner.os }}-${{ matrix.arch }}-spm-${{ hashFiles('Package.swift', 'Package.resolved') }} |
65 | | - restore-keys: | |
66 | | - ${{ runner.os }}-${{ matrix.arch }}-spm- |
67 | | - ${{ runner.os }}-spm- |
68 | | -
|
69 | | - - name: Resolve dependencies |
70 | | - run: swift package resolve |
71 | | - |
72 | | - - name: Run tests |
73 | | - run: swift test --enable-code-coverage |
74 | | - |
75 | | - - name: Build optimized binary |
76 | | - run: ./Scripts/build-swift-binary.sh "${{ matrix.platform }}" "${{ matrix.arch }}" "${{ matrix.triple }}" "git" |
77 | | - |
78 | | - - name: Sign and notarize macOS binary |
79 | | - if: matrix.platform == 'macOS' |
80 | | - env: |
81 | | - APPLE_CERTIFICATE_P12_BASE64: ${{ secrets.APPLE_CERTIFICATE_P12_BASE64 }} |
82 | | - APPLE_CERTIFICATE_PASSWORD: ${{ secrets.APPLE_CERTIFICATE_PASSWORD }} |
83 | | - APPLE_API_KEY_BASE64: ${{ secrets.APPLE_API_KEY_BASE64 }} |
84 | | - APPLE_API_KEY_ID: ${{ secrets.APPLE_API_KEY_ID }} |
85 | | - APPLE_API_ISSUER_ID: ${{ secrets.APPLE_API_ISSUER_ID }} |
86 | | - run: ./Scripts/sign-and-notarize-macos.sh |
87 | | - |
88 | | - - name: Basic functionality test |
89 | | - run: ./Scripts/test-binary-functionality.sh "${{ matrix.platform }}" "${{ matrix.arch }}" "${{ matrix.triple }}" "basic" |
90 | | - |
91 | | - - name: Comprehensive validation |
92 | | - if: matrix.comprehensive_test |
93 | | - run: ./Scripts/test-binary-functionality.sh "${{ matrix.platform }}" "${{ matrix.arch }}" "${{ matrix.triple }}" "comprehensive" |
94 | | - |
95 | | - - name: Lint and format check |
96 | | - if: matrix.lint_check |
97 | | - run: | |
98 | | - echo "=== Format Check ===" |
99 | | - # Use the built-in swift format command from the Swift toolchain |
100 | | - swift format --version |
101 | | - # Check all Swift files except test fixtures and build artifacts |
102 | | - find . -name "*.swift" -not -path "./.build/*" -not -path "./Tests/*/Fixtures/*" | xargs swift format lint --strict |
103 | | -
|
104 | | - - name: Upload build artifacts |
105 | | - uses: actions/upload-artifact@v4 |
106 | | - with: |
107 | | - name: build-artifacts-${{ matrix.platform }}-${{ matrix.arch }} |
108 | | - path: ${{ matrix.platform == 'macOS' && '.build/apple/Products/Release/swift-dependency-audit' || format('.build/{0}/release/swift-dependency-audit', matrix.triple) }} |
109 | | - retention-days: 7 |
| 14 | + test: |
| 15 | + name: ${{ matrix.name }} |
| 16 | + runs-on: ${{ matrix.runner }} |
| 17 | + strategy: |
| 18 | + fail-fast: false |
| 19 | + matrix: |
| 20 | + include: |
| 21 | + - name: "macOS Universal" |
| 22 | + runner: macos-26 |
| 23 | + platform: "macOS" |
| 24 | + xcode: "26.0.1" |
| 25 | + arch: "universal" |
| 26 | + comprehensive_test: true |
| 27 | + lint_check: true |
| 28 | + - name: "Linux x86_64" |
| 29 | + runner: ubuntu-latest |
| 30 | + platform: "Linux" |
| 31 | + arch: "x86_64" |
| 32 | + triple: "x86_64-unknown-linux-gnu" |
| 33 | + comprehensive_test: true |
| 34 | + lint_check: true |
| 35 | + - name: "Linux ARM64" |
| 36 | + runner: ubuntu-24.04-arm |
| 37 | + platform: "Linux" |
| 38 | + arch: "aarch64" |
| 39 | + triple: "aarch64-unknown-linux-gnu" |
| 40 | + comprehensive_test: true |
| 41 | + lint_check: true |
| 42 | + |
| 43 | + steps: |
| 44 | + - name: Checkout code |
| 45 | + uses: actions/checkout@v4 |
| 46 | + |
| 47 | + - name: Select Xcode version (macOS only) |
| 48 | + if: matrix.platform == 'macOS' |
| 49 | + run: sudo xcode-select -s /Applications/Xcode_${{ matrix.xcode }}.app/Contents/Developer |
| 50 | + |
| 51 | + - name: Setup Swift (Linux only) |
| 52 | + if: matrix.platform == 'Linux' |
| 53 | + run: ./Scripts/setup-swift-linux.sh |
| 54 | + |
| 55 | + - name: Show Swift version |
| 56 | + run: swift --version |
| 57 | + |
| 58 | + - name: Cache Swift Package Manager |
| 59 | + uses: actions/cache@v4 |
| 60 | + with: |
| 61 | + path: | |
| 62 | + .build |
| 63 | + ~/.cache/org.swift.swiftpm |
| 64 | + key: ${{ runner.os }}-${{ matrix.arch }}-spm-${{ hashFiles('Package.swift', 'Package.resolved') }} |
| 65 | + restore-keys: | |
| 66 | + ${{ runner.os }}-${{ matrix.arch }}-spm- |
| 67 | + ${{ runner.os }}-spm- |
| 68 | +
|
| 69 | + - name: Resolve dependencies |
| 70 | + run: swift package resolve |
| 71 | + |
| 72 | + - name: Run tests |
| 73 | + run: swift test --enable-code-coverage |
| 74 | + |
| 75 | + - name: Build optimized binary |
| 76 | + run: ./Scripts/build-swift-binary.sh "${{ matrix.platform }}" "${{ matrix.arch }}" "${{ matrix.triple }}" "git" |
| 77 | + |
| 78 | + - name: Sign and notarize macOS binary |
| 79 | + if: matrix.platform == 'macOS' |
| 80 | + env: |
| 81 | + APPLE_CERTIFICATE_P12_BASE64: ${{ secrets.APPLE_CERTIFICATE_P12_BASE64 }} |
| 82 | + APPLE_CERTIFICATE_PASSWORD: ${{ secrets.APPLE_CERTIFICATE_PASSWORD }} |
| 83 | + APPLE_API_KEY_BASE64: ${{ secrets.APPLE_API_KEY_BASE64 }} |
| 84 | + APPLE_API_KEY_ID: ${{ secrets.APPLE_API_KEY_ID }} |
| 85 | + APPLE_API_ISSUER_ID: ${{ secrets.APPLE_API_ISSUER_ID }} |
| 86 | + run: ./Scripts/sign-and-notarize-macos.sh |
| 87 | + |
| 88 | + - name: Basic functionality test |
| 89 | + run: ./Scripts/test-binary-functionality.sh "${{ matrix.platform }}" "${{ matrix.arch }}" "${{ matrix.triple }}" "basic" |
| 90 | + |
| 91 | + - name: Comprehensive validation |
| 92 | + if: matrix.comprehensive_test |
| 93 | + run: ./Scripts/test-binary-functionality.sh "${{ matrix.platform }}" "${{ matrix.arch }}" "${{ matrix.triple }}" "comprehensive" |
| 94 | + |
| 95 | + - name: Lint and format check |
| 96 | + if: matrix.lint_check |
| 97 | + run: | |
| 98 | + echo "=== Format Check ===" |
| 99 | + # Use the built-in swift format command from the Swift toolchain |
| 100 | + swift format --version |
| 101 | + # Check all Swift files except test fixtures and build artifacts |
| 102 | + find . -name "*.swift" -not -path "./.build/*" -not -path "./Tests/*/Fixtures/*" | xargs swift format lint --strict |
| 103 | +
|
| 104 | + - name: Upload build artifacts |
| 105 | + uses: actions/upload-artifact@v4 |
| 106 | + with: |
| 107 | + name: build-artifacts-${{ matrix.platform }}-${{ matrix.arch }} |
| 108 | + path: ${{ matrix.platform == 'macOS' && '.build/apple/Products/Release/swift-dependency-audit' || format('.build/{0}/release/swift-dependency-audit', matrix.triple) }} |
| 109 | + retention-days: 7 |
0 commit comments