-
-
Notifications
You must be signed in to change notification settings - Fork 54
140 lines (136 loc) Β· 5.57 KB
/
test.yml
File metadata and controls
140 lines (136 loc) Β· 5.57 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
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
name: test
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
on:
pull_request: { types: [opened, reopened, synchronize, ready_for_review] }
push: { branches: [ main ] }
permissions:
contents: read
env:
LOG_LEVEL: info
POSTGRES_HOSTNAME_A: &postgres_host_a 'psql-a'
POSTGRES_HOSTNAME_B: &postgres_host_b 'psql-b'
POSTGRES_HOSTNAME: *postgres_host_a
POSTGRES_DB_A: &postgres_db_a 'test_database_a'
POSTGRES_DB_B: &postgres_db_b 'test_database_b'
POSTGRES_DB: *postgres_db_a
POSTGRES_USER_A: &postgres_user_a 'test_username'
POSTGRES_USER_B: &postgres_user_b 'test_username'
POSTGRES_USER: *postgres_user_a
POSTGRES_PASSWORD_A: &postgres_pass_a 'test_password'
POSTGRES_PASSWORD_B: &postgres_pass_b 'test_password'
POSTGRES_PASSWORD: *postgres_pass_a
jobs:
api-breakage:
if: ${{ github.event_name == 'pull_request' && !(github.event.pull_request.draft || false) }}
runs-on: ubuntu-latest
container: swift:noble
steps:
- name: Checkout
uses: actions/checkout@v5
with: { 'fetch-depth': 0 }
- name: API breaking changes
run: |
git config --global --add safe.directory "${GITHUB_WORKSPACE}"
swift package diagnose-api-breaking-changes origin/main
linux-all:
if: ${{ !(github.event.pull_request.draft || false) }}
strategy:
fail-fast: false
matrix:
include:
- postgres-image-a: 'postgres:13'
postgres-image-b: 'postgres:14'
postgres-auth: 'trust'
swift-image: 'swift:6.0-noble'
- postgres-image-a: 'postgres:15'
postgres-image-b: 'postgres:16'
postgres-auth: 'md5'
swift-image: 'swift:6.1-noble'
- postgres-image-a: 'postgres:17'
postgres-image-b: 'postgres:18'
postgres-auth: 'scram-sha-256'
swift-image: 'swift:6.2-noble'
container: ${{ matrix.swift-image }}
runs-on: ubuntu-latest
services:
*postgres_host_a:
image: ${{ matrix.postgres-image-a }}
env:
POSTGRES_USER: *postgres_user_a
POSTGRES_DB: *postgres_db_a
POSTGRES_PASSWORD: *postgres_pass_a
POSTGRES_HOST_AUTH_METHOD: ${{ matrix.postgres-auth }}
POSTGRES_INITDB_ARGS: --auth-host=${{ matrix.postgres-auth }}
*postgres_host_b:
image: ${{ matrix.postgres-image-b }}
env:
POSTGRES_USER: *postgres_user_b
POSTGRES_DB: *postgres_db_b
POSTGRES_PASSWORD: *postgres_pass_b
POSTGRES_HOST_AUTH_METHOD: ${{ matrix.postgres-auth }}
POSTGRES_INITDB_ARGS: --auth-host=${{ matrix.postgres-auth }}
steps:
- name: Ensure curl is available
run: apt-get update -y && apt-get install -y curl
- name: Check out package
uses: actions/checkout@v5
- name: Run all tests
run: swift test --enable-code-coverage --explicit-target-dependency-import-check error -Xswiftc -require-explicit-sendable
- name: Submit coverage report to Codecov.io
uses: vapor/swift-codecov-action@v0.3
with:
codecov_token: ${{ secrets.CODECOV_TOKEN }}
macos-all:
if: ${{ !(github.event.pull_request.draft || false) }}
strategy:
fail-fast: false
matrix:
include:
- macos-version: macos-15
xcode-version: latest-stable
- macos-version: macos-26
xcode-version: latest-stable
runs-on: ${{ matrix.macos-version }}
env:
LOG_LEVEL: debug
POSTGRES_HOSTNAME: 127.0.0.1
POSTGRES_HOSTNAME_A: 127.0.0.1
POSTGRES_HOSTNAME_B: 127.0.0.1
steps:
- name: Select latest available Xcode
uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: ${{ matrix.xcode-version }}
- name: Install Postgres, setup DB and auth, and wait for server start
run: |
brew upgrade || true
export PATH="$(brew --prefix)/opt/postgresql@16/bin:$PATH" PGDATA=/tmp/vapor-postgres-test PGUSER="${POSTGRES_USER_A}"
brew install postgresql@18 && brew link --force postgresql@18
initdb --locale=C --auth-host "scram-sha-256" -U "${POSTGRES_USER_A}" --pwfile=<(echo "${POSTGRES_PASSWORD_A}")
pg_ctl start --wait
PGPASSWORD="${POSTGRES_PASSWORD_A}" createdb -w -O "${POSTGRES_USER_A}" "${POSTGRES_DB_A}"
PGPASSWORD="${POSTGRES_PASSWORD_A}" createdb -w -O "${POSTGRES_USER_B}" "${POSTGRES_DB_B}"
PGPASSWORD="${POSTGRES_PASSWORD_A}" psql -w "${POSTGRES_DB_A}" <<<"ALTER SCHEMA public OWNER TO ${POSTGRES_USER_A};"
PGPASSWORD="${POSTGRES_PASSWORD_A}" psql -w "${POSTGRES_DB_B}" <<<"ALTER SCHEMA public OWNER TO ${POSTGRES_USER_B};"
timeout-minutes: 15
- name: Checkout code
uses: actions/checkout@v5
- name: Run all tests
run: swift test --enable-code-coverage --explicit-target-dependency-import-check error -Xswiftc -require-explicit-sendable
- name: Submit coverage report to Codecov.io
uses: vapor/swift-codecov-action@v0.3
with:
codecov_token: ${{ secrets.CODECOV_TOKEN }}
musl:
runs-on: ubuntu-latest
container: swift:6.2-noble
timeout-minutes: 30
steps:
- name: Check out code
uses: actions/checkout@v5
- name: Install SDK
run: swift sdk install https://download.swift.org/swift-6.2-release/static-sdk/swift-6.2-RELEASE/swift-6.2-RELEASE_static-linux-0.0.1.artifactbundle.tar.gz --checksum d2225840e592389ca517bbf71652f7003dbf45ac35d1e57d98b9250368769378
- name: Build
run: swift build --swift-sdk x86_64-swift-linux-musl