11name : test
2- on : { pull_request: {}, push: { branches: [master, main] } }
2+ on :
3+ pull_request : { branches: ['*'] }
4+ push : { branches: ['main'] }
5+
6+ env :
7+ LOG_LEVEL : debug
8+ SWIFT_DETERMINISTIC_HASHING : 1
9+ REDIS_HOSTNAME : redis
10+ REDIS_PORT : 6379
11+ REDIS_HOSTNAME_2 : redis-2
12+ REDIS_PORT_2 : 6379
313
414jobs :
5- getcidata :
15+ api-breakage :
16+ if : github.event_name == 'pull_request'
617 runs-on : ubuntu-latest
7- outputs :
8- environments : ${{ steps.output.outputs.environments }}
18+ container : swift:5.7-jammy
919 steps :
10- - id : output
11- run : |
12- envblob="$(curl -fsSL https://raw.githubusercontent.com/vapor/ci/main/pr-environments.json | jq -cMj '.')"
13- echo "::set-output name=environments::${envblob}"
14-
15-
16- test-redis :
17- needs : getcidata
20+ - name : Check out package
21+ uses : actions/checkout@v3
22+ with :
23+ fetch-depth : 0
24+ # https://github.com/actions/checkout/issues/766
25+ - name : Mark the workspace as safe
26+ run : git config --global --add safe.directory ${GITHUB_WORKSPACE}
27+ - name : Check for API breaking changes
28+ run : swift package diagnose-api-breaking-changes origin/main
29+
30+ linux-unit :
1831 strategy :
1932 fail-fast : false
2033 matrix :
21- env : ${{ fromJSON(needs.getcidata.outputs.environments) }}
22- runs-on : ${{ matrix.env.os }}
23- container : ${{ matrix.env.image }}
24- steps :
25- - name : Select toolchain
26- uses :
maxim-lobanov/[email protected] 27- with :
28- xcode-version : ${{ matrix.env.toolchain }}
29- if : ${{ matrix.env.toolchain != '' }}
30- - name : Check out source code
31- uses : actions/checkout@v2
32-
33- - name : Install Redis via Homebrew (Mac)
34- if : ${{ startsWith(matrix.env.os, 'macos') }}
35- run : brew install redis
36-
37- - name : Install Redis via apt-get (Ubuntu)
38- if : ${{ startsWith(matrix.env.os, 'ubuntu') }}
39- run : apt-get update && apt-get install -y redis
40-
41- - name : Install Redis via ??? (Windows)
42- if : ${{ startsWith(matrix.env.os, 'windows') }}
43- run : echo NOT IMPLEMENTED; exit 1
44-
45- - name : Start Redis 1
46- run : redis-server .github/redis1.conf
47- - name : Start Redis 2
48- run : redis-server .github/redis2.conf
49-
50- - name : Test Redis 1 connection
51- run : redis-cli -u redis://localhost:6379/0 INFO
52- - name : Test Redis 2 connection
53- run : redis-cli -u redis://localhost:6380/0 INFO
54-
55- - name : Run 'RedisTests' tests with Thread Sanitizer
56- timeout-minutes : 20
57- run : swift test --enable-test-discovery --sanitize=thread --filter RedisTests
58-
59- - name : Run 'MultipleRedisTests' tests with Thread Sanitizer
60- timeout-minutes : 20
61- run : swift test --enable-test-discovery --sanitize=thread --filter MultipleRedisTests
34+ container :
35+ - swift:5.5-bionic
36+ - swift:5.6-focal
37+ - swift:5.7-jammy
38+ container : ${{ matrix.container }}
39+ services :
40+ redis :
41+ image : redis:6
42+ redis-2 :
43+ image : redis:6
44+ runs-on : ubuntu-latest
45+ steps :
46+ - name : Check out package
47+ uses : actions/checkout@v3
48+ - name : Run unit tests with Thread Sanitizer
49+ run : swift test --sanitize=thread
50+
51+ # TODO: Use reusable workflow
6252
6353 test-exports :
6454 name : Test exports
6959 with :
7060 fetch-depth : 0
7161 - name : Build
72- run : swift build -Xswiftc -DBUILDING_DOCC
62+ run : swift build -Xswiftc -DBUILDING_DOCC
0 commit comments