Set version range in manifest, up to local swift version to resolve #97
Workflow file for this run
This file contains hidden or 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: Tests | |
| on: | |
| push: | |
| pull_request: | |
| pull_request_target: | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| macos_tests: | |
| name: macOS Tests (SwiftPM, Xcode ${{ matrix.xcode }}) | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - os: "macos-14" | |
| xcode: "15.1" # Swift 5.9. Same as 15.2. | |
| - os: "macos-14" | |
| xcode: "15.3" # Swift 5.10. Same as 15.4. | |
| - os: "macos-15" | |
| xcode: "16.0" # Swift 6.0. Same as 16.1 and 16.2. | |
| - os: "macos-15" | |
| xcode: "16.3" # Swift 6.1. Same as 16.4. | |
| - os: "macos-26" | |
| xcode: "26.0.1" # Swift 6.2. Same as 26.1. | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Select Xcode ${{ matrix.xcode }} | |
| run: sudo xcode-select --switch /Applications/Xcode_${{ matrix.xcode }}.app | |
| - name: Install Mint | |
| run: brew install mint | |
| - name: Cache Mint | |
| uses: actions/cache@v3 | |
| with: | |
| path: ~/.mint | |
| key: ${{ runner.os }}-mint-xcode_${{ matrix.xcode }}-${{ hashFiles('**/Mintfile') }} | |
| restore-keys: | | |
| ${{ runner.os }}-mint-xcode_${{ matrix.xcode }} | |
| - run: mint bootstrap | |
| - name: Cache SwiftPM | |
| uses: actions/cache@v3 | |
| with: | |
| path: .build | |
| key: ${{ runner.os }}-xcode_${{ matrix.xcode }}-swiftpm-${{ github.ref }}-${{ hashFiles('**/Package.resolved') }} | |
| restore-keys: | | |
| ${{ runner.os }}-xcode_${{ matrix.xcode }}-swiftpm-${{ github.ref }}- | |
| ${{ runner.os }}-xcode_${{ matrix.xcode }}-swiftpm-main- | |
| ${{ runner.os }}-xcode_${{ matrix.xcode }}-swiftpm- | |
| - name: SwiftPM tests | |
| run: swift test --enable-code-coverage | mint run xcbeautify --renderer github-actions | |
| - name: Convert coverage for Codecov | |
| id: convert-coverage | |
| uses: sersoft-gmbh/swift-coverage-action@v4 | |
| with: | |
| ignore-conversion-failures: true | |
| fail-on-empty-output: true | |
| - name: Upload coverage to Codecov | |
| uses: codecov/codecov-action@v3 | |
| env: | |
| CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | |
| with: | |
| files: ${{ join(fromJSON(steps.convert-coverage.outputs.files), ',') }} | |
| fail_ci_if_error: ${{ github.event.action != 'pull_request_target' }} | |
| generate_swift_syntax_version: | |
| name: Generate Swift Syntax Versions | |
| runs-on: macOS-latest | |
| outputs: | |
| matrix: ${{ steps.set-matrix.outputs.matrix }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - run: brew install mint | |
| - name: Cache Mint | |
| uses: actions/cache@v3 | |
| with: | |
| path: ~/.mint | |
| key: ${{ runner.os }}-mint-xcode_${{ matrix.xcode }}-${{ hashFiles('**/Mintfile') }} | |
| restore-keys: | | |
| ${{ runner.os }}-mint-xcode_${{ matrix.xcode }} | |
| - run: mint bootstrap | |
| - name: Set up matrix | |
| id: set-matrix | |
| run: | | |
| matrix="$(mint run josephduffy/swift-dependency-compatibility-checker swift-syntax --resolve-only --github-actions-matrix)" | |
| echo "${matrix}" | |
| echo "matrix=${matrix}" >> "${GITHUB_OUTPUT}" | |
| test_swift_syntax_versions: | |
| name: Swift Syntax ${{ matrix.version }} Tests | |
| needs: | |
| - generate_swift_syntax_version | |
| runs-on: macOS-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: ${{ fromJson(needs.generate_swift_syntax_version.outputs.matrix) }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - run: swift package resolve swift-syntax --version ${{ matrix.version }} | |
| - run: swift test | mint run xcbeautify --renderer github-actions | |
| generate_xcode_tests_matrix: | |
| name: Generate Xcode Tests Matrix | |
| runs-on: ubuntu-latest | |
| outputs: | |
| matrix: ${{ steps.set-matrix.outputs.matrix }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up matrix | |
| id: set-matrix | |
| run: | | |
| matrix="$(./.github/generate-xcode-tests-matrix.sh)" | |
| echo "${matrix}" | |
| echo "matrix=${matrix}" >> "${GITHUB_OUTPUT}" | |
| xcode_tests: | |
| name: ${{ matrix.platform }} Tests (Xcode ${{ matrix.xcode }}) | |
| needs: | |
| - generate_xcode_tests_matrix | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: ${{ fromJson(needs.generate_xcode_tests_matrix.outputs.matrix) }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Select Xcode ${{ matrix.xcode }} | |
| run: sudo xcode-select --switch /Applications/Xcode_${{ matrix.xcode }}.app | |
| - name: Install Mint | |
| run: brew install mint | |
| - name: Cache Mint | |
| uses: actions/cache@v3 | |
| with: | |
| path: ~/.mint | |
| key: ${{ runner.os }}-mint-xcode_${{ matrix.xcode }}-${{ hashFiles('**/Mintfile') }} | |
| restore-keys: | | |
| ${{ runner.os }}-mint-xcode_${{ matrix.xcode }} | |
| - run: mint bootstrap | |
| - name: Cache DerivedData | |
| uses: actions/cache@v3 | |
| with: | |
| path: ~/Library/Developer/Xcode/DerivedData | |
| key: ${{ runner.os }}-xcode_${{ matrix.xcode }}-derived_data-${{ github.ref }} | |
| restore-keys: | | |
| ${{ runner.os }}-xcode_${{ matrix.xcode }}-derived_data-main | |
| ${{ runner.os }}-xcode_${{ matrix.xcode }}-derived_data- | |
| - name: Run Tests | |
| run: | | |
| set -o pipefail | |
| mint run xcutils test ${{ matrix.platform }} --scheme HashableMacro --enable-code-coverage | mint run xcbeautify --renderer github-actions | |
| - name: Convert coverage for Codecov | |
| id: convert-coverage | |
| uses: sersoft-gmbh/swift-coverage-action@v4 | |
| with: | |
| fail-on-empty-output: true | |
| - name: Upload coverage to Codecov | |
| uses: codecov/codecov-action@v3 | |
| env: | |
| CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | |
| with: | |
| files: ${{ join(fromJSON(steps.convert-coverage.outputs.files), ',') }} | |
| fail_ci_if_error: ${{ github.event.action != 'pull_request_target' }} | |
| linux_tests: | |
| name: Swift ${{ matrix.swift }} on ${{ matrix.os }} | |
| runs-on: ${{ matrix.os }} | |
| container: | |
| image: swift:${{ matrix.swift }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: ["ubuntu-latest"] | |
| swift: ["5.9.2", "5.10", "6.0", "6.1", "6.2"] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Cache SwiftPM | |
| uses: actions/cache@v3 | |
| with: | |
| path: .build | |
| key: ${{ runner.os }}-swift_${{ matrix.swift }}-swiftpm-deps-${{ github.ref }}-${{ hashFiles('Package.resolved') }} | |
| restore-keys: | | |
| ${{ runner.os }}-swift_${{ matrix.swift }}-swiftpm-deps-${{ github.ref }}- | |
| ${{ runner.os }}-swift_${{ matrix.swift }}-swiftpm-deps-main- | |
| ${{ runner.os }}-swift_${{ matrix.swift }}-swiftpm-deps- | |
| - name: swift test | |
| run: swift test | |
| windows_tests: | |
| name: Windows Tests | |
| runs-on: windows-2025 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| # Requires https://github.com/swiftlang/swift-package-manager/issues/6367 so can't use e.g. 6.0.3, 5.10.1, or 5.9.2. | |
| - branch: "swift-6.1.3-release" | |
| tag: "6.1.3-RELEASE" | |
| - branch: "swift-6.2.2-release" | |
| tag: "6.2.2-RELEASE" | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install Swift | |
| uses: compnerd/gha-setup-swift@main | |
| with: | |
| branch: ${{ matrix.branch }} | |
| tag: ${{ matrix.tag }} | |
| - name: swift test | |
| run: swift test |