-
Notifications
You must be signed in to change notification settings - Fork 0
120 lines (105 loc) · 5.2 KB
/
ci.yml
File metadata and controls
120 lines (105 loc) · 5.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
name: CI
on:
workflow_dispatch:
push:
branches: [main, develop]
paths-ignore:
- '**.md'
- '.spi.yml'
- 'Sources/**/*.docc/**'
pull_request:
branches: [main]
paths-ignore:
- '**.md'
- '.spi.yml'
- 'Sources/**/*.docc/**'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
# ─────────────────────────────────────────────────────────────────────────────
# Environment variables shared across all jobs
# ─────────────────────────────────────────────────────────────────────────────
env:
SWIFT_VERSION: "6.0"
jobs:
# ───────────────────────────────────────────────────────────────────────────
# 1. SQLite + Core tests — macOS (Swift pre-installed, ~1 min)
# ───────────────────────────────────────────────────────────────────────────
test-sqlite-macos:
name: SQLite — macOS / Swift 6.0
runs-on: macos-15
steps:
- uses: actions/checkout@v4
- name: Cache SPM
uses: actions/cache@v4
with:
path: .build
key: macos-spm-v2-${{ env.SWIFT_VERSION }}-${{ hashFiles('Package.resolved') }}
restore-keys: macos-spm-v2-${{ env.SWIFT_VERSION }}-
- run: swift test --filter SQLiteNioTests 2>&1
- run: swift test --filter SQLNioCoreTests --skip-build 2>&1
# ───────────────────────────────────────────────────────────────────────────
# 2. All integration tests in one Linux job — build once, test all three DBs
# Connects to vps.marivil.com (Docker containers, always up).
# ───────────────────────────────────────────────────────────────────────────
test-integration:
name: Integration tests (MSSQL · PostgreSQL · MySQL · SQLite/Linux)
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- name: Setup Swift ${{ env.SWIFT_VERSION }}
uses: swift-actions/setup-swift@v2
with:
swift-version: ${{ env.SWIFT_VERSION }}
- name: Install SQLite
run: sudo apt-get install -y libsqlite3-dev
- name: Cache SPM
uses: actions/cache@v4
with:
path: .build
key: linux-spm-v2-${{ env.SWIFT_VERSION }}-${{ hashFiles('Package.resolved') }}
restore-keys: linux-spm-v2-${{ env.SWIFT_VERSION }}-
- name: Build
run: swift build --build-tests --configuration debug 2>&1
- name: SQLite tests
run: swift test --filter SQLiteNioTests --skip-build 2>&1
- name: SQLite Core tests
run: swift test --filter SQLNioCoreTests --skip-build 2>&1
- name: MSSQL tests
env:
MSSQL_TEST_HOST: ${{ secrets.MSSQL_TEST_HOST }}
MSSQL_TEST_PASS: ${{ secrets.MSSQL_TEST_PASS }}
MSSQL_TEST_DB: MSSQLNioTestDb
MSSQL_TEST_USER: sa
run: swift test --filter MSSQLNioTests --skip-build 2>&1
- name: PostgreSQL tests
env:
PG_TEST_HOST: ${{ secrets.PG_TEST_HOST }}
PG_TEST_DB: PostgresNioTestDb
PG_TEST_USER: pguser
PG_TEST_PASS: ${{ secrets.PG_TEST_PASS }}
run: swift test --filter PostgresNioTests --skip-build 2>&1
- name: MySQL tests
env:
MYSQL_TEST_HOST: ${{ secrets.MYSQL_TEST_HOST }}
MYSQL_TEST_DB: MySQLNioTestDb
MYSQL_TEST_USER: mysqluser
MYSQL_TEST_PASS: ${{ secrets.MYSQL_TEST_PASS }}
run: swift test --filter MySQLNioTests --skip-build 2>&1
# ───────────────────────────────────────────────────────────────────────────
# 3. Summary / Required status check
# ───────────────────────────────────────────────────────────────────────────
ci-success:
name: All tests passed
runs-on: ubuntu-24.04
needs: [test-sqlite-macos, test-integration]
if: always()
steps:
- name: Check results
run: |
if [[ "${{ needs.test-sqlite-macos.result }}" != "success" || \
"${{ needs.test-integration.result }}" != "success" ]]; then
echo "One or more test jobs failed."
exit 1
fi
echo "All test jobs passed."