|
1 |
| -name: test |
| 1 | +name: Tests |
| 2 | +concurrency: |
| 3 | + group: ${{ github.workflow }}-${{ github.ref }} |
| 4 | + cancel-in-progress: true |
2 | 5 | on:
|
3 |
| - push: |
4 |
| - branches: |
5 |
| - - main |
6 |
| - pull_request: |
| 6 | + pull_request: { types: [opened, reopened, synchronize, ready_for_review] } |
| 7 | + push: { branches: [ main ] } |
| 8 | +env: |
| 9 | + LOG_LEVEL: info |
7 | 10 |
|
8 | 11 | jobs:
|
9 | 12 | appleos:
|
| 13 | + if: ${{ !(github.event.pull_request.draft || false) }} |
10 | 14 | strategy:
|
11 | 15 | fail-fast: false
|
12 | 16 | matrix:
|
13 | 17 | xcode:
|
14 | 18 | - latest
|
15 |
| - - latest-stable |
16 |
| - destination: |
17 |
| - - 'platform=macOS,arch=x86_64' |
18 |
| - #- 'platform=macOS,arch=arm64' |
19 |
| - - 'platform=iOS Simulator,OS=latest,name=iPhone 11 Pro' |
20 |
| - - 'platform=tvOS Simulator,OS=latest,name=Apple TV 4K' |
21 |
| - - 'platform=watchOS Simulator,OS=latest,name=Apple Watch Series 6 - 44mm' |
22 |
| - runs-on: macos-11.0 |
| 19 | + #- latest-stable |
| 20 | + platform: |
| 21 | + - 'macOS' |
| 22 | + - 'iOS Simulator' |
| 23 | + - 'tvOS Simulator' |
| 24 | + - 'watchOS Simulator' |
| 25 | + include: |
| 26 | + - platform: 'macOS' |
| 27 | + destination: 'arch=x86_64' |
| 28 | + - platform: 'iOS Simulator' |
| 29 | + destination: 'OS=latest,name=iPhone 15 Pro' |
| 30 | + - platform: 'tvOS Simulator' |
| 31 | + destination: 'OS=latest,name=Apple TV 4K (3rd generation)' |
| 32 | + - platform: 'watchOS Simulator' |
| 33 | + destination: 'OS=latest,name=Apple Watch Series 9 (45mm)' |
| 34 | + name: ${{ matrix.platform }} Tests |
| 35 | + runs-on: macos-13 |
23 | 36 | steps:
|
24 |
| - - name: Select latest available Xcode |
25 |
| - uses: maxim-lobanov/setup-xcode@v1 |
26 |
| - with: |
27 |
| - xcode-version: ${{ matrix.xcode }} |
28 |
| - - name: Checkout |
29 |
| - uses: actions/checkout@v2 |
30 |
| - - name: Run tests for ${{ matrix.destination }} |
31 |
| - run: xcodebuild test -scheme StructuredAPIClient-Package -enableThreadSanitizer YES -destination '${{ matrix.destination }}' |
| 37 | + - name: Select latest available Xcode |
| 38 | + uses: maxim-lobanov/setup-xcode@v1 |
| 39 | + with: |
| 40 | + xcode-version: ${{ matrix.xcode }} |
| 41 | + - name: Install xcbeautify |
| 42 | + run: brew install xcbeautify |
| 43 | + - name: Checkout code |
| 44 | + uses: actions/checkout@v4 |
| 45 | + - name: Run tests |
| 46 | + env: |
| 47 | + DESTINATION: ${{ format('platform={0},{1}', matrix.platform, matrix.destination) }} |
| 48 | + run: | |
| 49 | + set -o pipefail && \ |
| 50 | + xcodebuild test -scheme StructuredAPIClient-Package \ |
| 51 | + -enableThreadSanitizer YES \ |
| 52 | + -enableCodeCoverage YES \ |
| 53 | + -disablePackageRepositoryCache \ |
| 54 | + -resultBundlePath "${GITHUB_WORKSPACE}/results.resultBundle" \ |
| 55 | + -destination "${DESTINATION}" | |
| 56 | + xcbeautify --is-ci --quiet --renderer github-actions |
| 57 | + - name: Upload coverage data |
| 58 | + uses: codecov/codecov-action@v3 |
| 59 | + with: |
| 60 | + token: ${{ secrets.CODECOV_TOKEN }} |
| 61 | + swift: true |
| 62 | + verbose: true |
| 63 | + xcode: true |
| 64 | + xcode_archive_path: ${{ github.workspace }}/results.resultBundle |
32 | 65 |
|
33 | 66 | linux:
|
34 |
| - runs-on: ubuntu-latest |
| 67 | + if: ${{ !(github.event.pull_request.draft || false) }} |
35 | 68 | strategy:
|
36 | 69 | fail-fast: false
|
37 | 70 | matrix:
|
38 |
| - ver: |
39 |
| - - swift:5.3 |
40 |
| - - swift:5.4 |
41 |
| - - swift:5.5 |
42 |
| - - swiftlang/swift:nightly-main |
43 |
| - os: |
44 |
| - - bionic |
45 |
| - - focal |
46 |
| - - amazonlinux2 |
| 71 | + swift-image: |
| 72 | + - swift:5.9-jammy |
| 73 | + - swiftlang/swift:nightly-5.10-jammy |
| 74 | + - swiftlang/swift:nightly-main-jammy |
| 75 | + name: Linux ${{ matrix.swift-image }} Tests |
| 76 | + runs-on: ubuntu-latest |
| 77 | + container: ${{ matrix.swift-image }} |
| 78 | + steps: |
| 79 | + - name: Checkout code |
| 80 | + uses: actions/checkout@v4 |
| 81 | + - name: Install xcbeautify |
| 82 | + run: | |
| 83 | + DEBIAN_FRONTEND=noninteractive apt-get update |
| 84 | + DEBIAN_FRONTEND=noninteractive apt-get install -y curl |
| 85 | + curl -fsSLO 'https://github.com/tuist/xcbeautify/releases/download/1.0.1/xcbeautify-1.0.1-x86_64-unknown-linux-gnu.tar.xz' |
| 86 | + tar -x -J -f xcbeautify-1.0.1-x86_64-unknown-linux-gnu.tar.xz |
| 87 | + - name: Run tests |
| 88 | + shell: bash |
| 89 | + run: | |
| 90 | + set -o pipefail && \ |
| 91 | + swift test --sanitize=thread --enable-code-coverage | |
| 92 | + ./xcbeautify --is-ci --quiet --renderer github-actions |
| 93 | + - name: Upload coverage data |
| 94 | + |
| 95 | + with: |
| 96 | + cc_token: ${{ secrets.CODECOV_TOKEN }} |
| 97 | + cc_verbose: true |
| 98 | + |
| 99 | + codeql: |
| 100 | + if: ${{ !(github.event.pull_request.draft || false) }} |
| 101 | + name: CodeQL Analysis |
| 102 | + runs-on: ubuntu-latest |
47 | 103 | container:
|
48 |
| - image: ${{ matrix.ver }}-${{ matrix.os }} |
| 104 | + image: swift:5.9-jammy |
| 105 | + permissions: { actions: write, contents: read, security-events: write } |
49 | 106 | steps:
|
50 |
| - - name: Checkout |
51 |
| - uses: actions/checkout@v2 |
52 |
| - - name: Run tests for ${{ matrix.runner }} |
53 |
| - run: swift test --enable-test-discovery --sanitize=thread |
| 107 | + - name: Checkout code |
| 108 | + uses: actions/checkout@v4 |
| 109 | + - name: Mark repo safe |
| 110 | + run: | |
| 111 | + git config --global --add safe.directory "${GITHUB_WORKSPACE}" |
| 112 | + - name: Initialize CodeQL |
| 113 | + uses: github/codeql-action/init@v2 |
| 114 | + with: { languages: swift } |
| 115 | + - name: Perform build |
| 116 | + run: swift build |
| 117 | + - name: Run CodeQL analyze |
| 118 | + uses: github/codeql-action/analyze@v2 |
54 | 119 |
|
55 |
| - windows: |
56 |
| - runs-on: windows-latest |
| 120 | + dependency-graph: |
| 121 | + if: ${{ github.event_name == 'push' }} |
| 122 | + runs-on: ubuntu-latest |
| 123 | + container: swift:jammy |
| 124 | + permissions: |
| 125 | + contents: write |
57 | 126 | steps:
|
58 |
| - - name: Install Swift toolchain |
59 |
| - uses: compnerd/gha-setup-swift@main |
60 |
| - with: |
61 |
| - branch: swift-5.5-release |
62 |
| - tag: 5.5-RELEASE |
63 |
| - - name: Checkout |
64 |
| - uses: actions/checkout@v2 |
65 |
| - - name: Run tests |
66 |
| - run: swift test |
| 127 | + - name: Check out code |
| 128 | + uses: actions/checkout@v4 |
| 129 | + - name: Set up dependencies |
| 130 | + run: | |
| 131 | + git config --global --add safe.directory "${GITHUB_WORKSPACE}" |
| 132 | + apt-get update && apt-get install -y curl |
| 133 | + - name: Submit dependency graph |
| 134 | + uses: vapor-community/[email protected] |
0 commit comments