|
1 | 1 | name: test |
2 | 2 | on: |
3 | | - pull_request: |
4 | | - push: |
5 | | - branches: |
6 | | - - main |
| 3 | + pull_request: { branches: ['*'] } |
| 4 | + push: { branches: [ main ] } |
| 5 | + |
7 | 6 | env: |
8 | 7 | LOG_LEVEL: debug |
9 | 8 | SWIFT_DETERMINISTIC_HASHING: 1 |
10 | 9 |
|
11 | 10 | jobs: |
12 | | - linux-all: |
| 11 | + |
| 12 | + codecov: |
| 13 | + runs-on: ubuntu-latest |
| 14 | + container: swift:5.7-jammy |
| 15 | + steps: |
| 16 | + # N.B.: When we switch to embedded SQLite, these first two steps should be removed, |
| 17 | + # and the version saved to the environment should come from the checked-out package. |
| 18 | + - name: Install libsqlite3 dependency |
| 19 | + run: apt-get -q update && apt-get -q install -y libsqlite3-dev |
| 20 | + - name: Save SQLite version to env |
| 21 | + run: | |
| 22 | + echo SQLITE_VERSION="$(pkg-config --modversion sqlite3)" >> $GITHUB_ENV |
| 23 | + - name: Check out package |
| 24 | + uses: actions/checkout@v3 |
| 25 | + - name: Run local tests with coverage |
| 26 | + run: swift test --enable-code-coverage |
| 27 | + - name: Submit coverage report to Codecov.io |
| 28 | + uses: vapor/swift-codecov-action@v0.2 |
| 29 | + with: |
| 30 | + cc_flags: 'unittests' |
| 31 | + cc_env_vars: 'SWIFT_VERSION,SWIFT_PLATFORM,RUNNER_OS,RUNNER_ARCH,SQLITE_VERSION' |
| 32 | + cc_fail_ci_if_error: true |
| 33 | + cc_verbose: true |
| 34 | + cc_dry_run: false |
| 35 | + |
| 36 | + # Check for API breakage versus main |
| 37 | + api-breakage: |
| 38 | + if: github.event_name == 'pull_request' |
| 39 | + runs-on: ubuntu-latest |
| 40 | + container: swift:5.7-jammy |
| 41 | + steps: |
| 42 | + - name: Install libsqlite3 dependency |
| 43 | + run: apt-get -q update && apt-get -q install -y libsqlite3-dev |
| 44 | + - name: Check out package |
| 45 | + uses: actions/checkout@v3 |
| 46 | + with: |
| 47 | + fetch-depth: 0 |
| 48 | + # https://github.com/actions/checkout/issues/766 |
| 49 | + - name: Mark the workspace as safe |
| 50 | + run: git config --global --add safe.directory ${GITHUB_WORKSPACE} |
| 51 | + - name: Check for API breaking changes |
| 52 | + run: swift package diagnose-api-breaking-changes origin/main |
| 53 | + |
| 54 | + # Run unit tests (Linux) |
| 55 | + linux-unit: |
| 56 | + if: github.event_name == 'pull_request' |
13 | 57 | strategy: |
14 | 58 | fail-fast: false |
15 | 59 | matrix: |
16 | | - swiftver: |
17 | | - - swift:5.4 |
18 | | - - swift:5.5 |
19 | | - - swift:5.6 |
20 | | - - swiftlang/swift:nightly-main |
21 | | - swiftos: |
22 | | - - focal |
23 | | - container: ${{ format('{0}-{1}', matrix.swiftver, matrix.swiftos) }} |
| 60 | + runner: |
| 61 | + - swift:5.5-bionic |
| 62 | + - swift:5.6-focal |
| 63 | + - swift:5.7-jammy |
| 64 | + - swiftlang/swift:nightly-main-jammy |
| 65 | + container: ${{ matrix.runner }} |
24 | 66 | runs-on: ubuntu-latest |
25 | 67 | steps: |
26 | | - - name: Install SQLite dependency |
| 68 | + - name: Install libsqlite3 dependency |
27 | 69 | run: apt-get -q update && apt-get -q install -y libsqlite3-dev |
28 | | - - name: Check out package |
| 70 | + - name: Check out code |
29 | 71 | uses: actions/checkout@v3 |
30 | | - - name: Run tests |
31 | | - run: swift test |
32 | | - |
33 | | - macos-all: |
| 72 | + - name: Run tests with Thread Sanitizer |
| 73 | + run: swift test --sanitize=thread |
| 74 | + |
| 75 | + |
| 76 | + # Run unit tests (macOS). |
| 77 | + macos-unit: |
| 78 | + if: github.event_name == 'pull_request' |
34 | 79 | strategy: |
35 | 80 | fail-fast: false |
36 | 81 | matrix: |
37 | | - macos: ['macos-11', 'macos-12'] |
38 | | - xcode: ['latest-stable', 'latest'] |
39 | | - exclude: [{ macos: 'macos-11', xcode: 'latest' }] |
| 82 | + macos: |
| 83 | + - macos-11 |
| 84 | + - macos-12 |
| 85 | + xcode: |
| 86 | + - latest-stable |
40 | 87 | runs-on: ${{ matrix.macos }} |
41 | 88 | steps: |
42 | 89 | - name: Select latest available Xcode |
43 | 90 | uses: maxim-lobanov/setup-xcode@v1 |
44 | 91 | with: |
45 | 92 | xcode-version: ${{ matrix.xcode }} |
46 | | - - name: Check out package |
| 93 | + - name: Check out code |
47 | 94 | uses: actions/checkout@v3 |
48 | 95 | - name: Run tests with Thread Sanitizer |
49 | | - run: swift test |
| 96 | + run: swift test --sanitize=thread |
0 commit comments