|
1 | 1 | name: test
|
2 | 2 | on:
|
3 |
| - pull_request: |
4 |
| - push: |
5 |
| - branches: |
6 |
| - - main |
7 |
| -defaults: |
8 |
| - run: |
9 |
| - shell: bash |
| 3 | + pull_request: { branches: ['*'] } |
| 4 | + push: { branches: [ main ] } |
| 5 | + |
| 6 | +env: |
| 7 | + LOG_LEVEL: debug |
| 8 | + SWIFT_DETERMINISTIC_HASHING: 1 |
10 | 9 |
|
11 | 10 | jobs:
|
12 |
| - dependents: |
| 11 | + |
| 12 | + codecov: |
13 | 13 | runs-on: ubuntu-latest
|
14 |
| - container: swift:5.4-focal |
15 |
| - strategy: |
16 |
| - fail-fast: false |
17 |
| - matrix: |
18 |
| - dependent: |
19 |
| - - sqlite-kit |
20 |
| - - fluent-sqlite-driver |
| 14 | + container: swift:5.7-jammy |
21 | 15 | steps:
|
22 |
| - - name: Install dependencies |
| 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 |
23 | 19 | run: apt-get -q update && apt-get -q install -y libsqlite3-dev
|
24 |
| - - name: Check out SQLiteNIO |
25 |
| - uses: actions/checkout@v2 |
| 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 | + |
26 | 29 | with:
|
27 |
| - path: sqlite-nio |
28 |
| - - name: Check out dependent |
29 |
| - uses: actions/checkout@v2 |
| 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 |
30 | 46 | with:
|
31 |
| - repository: vapor/${{ matrix.dependent }} |
32 |
| - path: dependent |
33 |
| - - name: Use local SQLiteNIO |
34 |
| - run: swift package edit sqlite-nio --path ../sqlite-nio |
35 |
| - working-directory: dependent |
36 |
| - - name: Run tests with Thread Sanitizer |
37 |
| - run: swift test --enable-test-discovery --sanitize=thread |
38 |
| - working-directory: dependent |
39 |
| - linux: |
| 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 | + # Make sure downstream dependents still work |
| 55 | + dependents-check: |
| 56 | + if: github.event_name == 'pull_request' |
40 | 57 | runs-on: ubuntu-latest
|
| 58 | + container: swift:5.7-jammy |
| 59 | + steps: |
| 60 | + - name: Install libsqlite3 dependency |
| 61 | + run: apt-get -q update && apt-get -q install -y libsqlite3-dev |
| 62 | + - name: Check out package |
| 63 | + uses: actions/checkout@v3 |
| 64 | + with: |
| 65 | + path: sqlite-nio |
| 66 | + - name: Check out SQLKit driver |
| 67 | + uses: actions/checkout@v3 |
| 68 | + with: |
| 69 | + repository: vapor/sqlite-kit |
| 70 | + path: sqlite-kit |
| 71 | + - name: Check out FluentKit driver |
| 72 | + uses: actions/checkout@v3 |
| 73 | + with: |
| 74 | + repository: vapor/fluent-sqlite-driver |
| 75 | + path: fluent-sqlite-driver |
| 76 | + - name: Tell dependents to use local checkout |
| 77 | + run: | |
| 78 | + swift package --package-path sqlite-kit edit sqlite-nio --path sqlite-nio |
| 79 | + swift package --package-path fluent-sqlite-driver edit sqlite-nio --path sqlite-nio |
| 80 | + - name: Run SQLiteKit tests with Thread Sanitizer |
| 81 | + run: swift test --package-path sqlite-kit --sanitize=thread |
| 82 | + - name: Run FluentSQLiteDriver tests with Thread Sanitizer |
| 83 | + run: swift test --package-path fluent-sqlite-driver --sanitize=thread |
| 84 | + |
| 85 | + # Run unit tests (Linux) |
| 86 | + linux-unit: |
| 87 | + if: github.event_name == 'pull_request' |
41 | 88 | strategy:
|
42 | 89 | fail-fast: false
|
43 | 90 | matrix:
|
44 |
| - image: |
45 |
| - - swift:5.2-focal |
46 |
| - - swift:5.2-amazonlinux2 |
47 |
| - - swift:5.3-focal |
48 |
| - - swift:5.3-amazonlinux2 |
49 |
| - - swift:5.4-focal |
50 |
| - - swift:5.4-amazonlinux2 |
51 |
| - #- swiftlang/swift:nightly-5.5-focal |
52 |
| - #- swiftlang/swift:nightly-5.5-amazonlinux2 |
53 |
| - container: ${{ matrix.image }} |
| 91 | + runner: |
| 92 | + - swift:5.5-bionic |
| 93 | + - swift:5.6-focal |
| 94 | + - swift:5.7-jammy |
| 95 | + - swiftlang/swift:nightly-main-jammy |
| 96 | + container: ${{ matrix.runner }} |
| 97 | + runs-on: ubuntu-latest |
54 | 98 | steps:
|
55 |
| - - name: Install Ubuntu dependencies |
| 99 | + - name: Install libsqlite3 dependency |
56 | 100 | run: apt-get -q update && apt-get -q install -y libsqlite3-dev
|
57 |
| - if: ${{ endsWith(matrix.image, 'bionic') || endsWith(matrix.image, 'focal') }} |
58 |
| - - name: Update AmazonLinux2's too-old SQLite and compensate for its Postgres |
59 |
| - if: ${{ endsWith(matrix.image, 'amazonlinux2') }} |
60 |
| - working-directory: /root |
61 |
| - # Cribbed from the Fedora RPM, leaves out a lot. System's Tcl is too old to run SQLite's tests. |
62 |
| - run: | |
63 |
| - yum install -y sqlite-devel |
64 |
| - yum install -y file tcl-devel make |
65 |
| - curl -L 'https://www.sqlite.org/src/tarball/sqlite.tar.gz?r=release' | tar xz && cd sqlite |
66 |
| - export CFLAGS="-DSQLITE_DISABLE_DIRSYNC=1 -DSQLITE_SECURE_DELETE=1" |
67 |
| - ./configure --prefix=/usr --libdir=/usr/lib64 --enable-fts3 --enable-all --with-tcl=/usr/lib64 |
68 |
| - make all install |
69 |
| - - name: Checkout code |
70 |
| - uses: actions/checkout@v2 |
| 101 | + - name: Check out code |
| 102 | + uses: actions/checkout@v3 |
71 | 103 | - name: Run tests with Thread Sanitizer
|
72 |
| - run: swift test --enable-test-discovery --sanitize=thread |
73 |
| - macos: |
74 |
| - runs-on: macos-latest |
| 104 | + run: swift test --sanitize=thread |
| 105 | + |
| 106 | + |
| 107 | + # Run unit tests (macOS). |
| 108 | + macos-unit: |
| 109 | + if: github.event_name == 'pull_request' |
75 | 110 | strategy:
|
76 | 111 | fail-fast: false
|
77 | 112 | matrix:
|
| 113 | + macos: |
| 114 | + - macos-11 |
| 115 | + - macos-12 |
78 | 116 | xcode:
|
79 |
| - - latest |
80 | 117 | - latest-stable
|
| 118 | + runs-on: ${{ matrix.macos }} |
81 | 119 | steps:
|
82 | 120 | - name: Select latest available Xcode
|
83 | 121 | uses: maxim-lobanov/setup-xcode@v1
|
84 |
| - with: |
| 122 | + with: |
85 | 123 | xcode-version: ${{ matrix.xcode }}
|
86 |
| - - name: Checkout code |
87 |
| - uses: actions/checkout@v2 |
| 124 | + - name: Check out code |
| 125 | + uses: actions/checkout@v3 |
88 | 126 | - name: Run tests with Thread Sanitizer
|
89 |
| - run: swift test --enable-test-discovery --sanitize=thread |
| 127 | + run: swift test --sanitize=thread |
0 commit comments