-
Notifications
You must be signed in to change notification settings - Fork 0
134 lines (130 loc) · 4.51 KB
/
test.yml
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
name: Tests
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
on:
pull_request: { types: [opened, reopened, synchronize, ready_for_review] }
push: { branches: [ main ] }
env:
LOG_LEVEL: info
jobs:
appleos:
if: ${{ !(github.event.pull_request.draft || false) }}
strategy:
fail-fast: false
matrix:
xcode:
- latest
#- latest-stable
platform:
- 'macOS'
- 'iOS Simulator'
- 'tvOS Simulator'
- 'watchOS Simulator'
include:
- platform: 'macOS'
destination: 'arch=x86_64'
- platform: 'iOS Simulator'
destination: 'OS=latest,name=iPhone 15 Pro'
- platform: 'tvOS Simulator'
destination: 'OS=latest,name=Apple TV 4K (3rd generation)'
- platform: 'watchOS Simulator'
destination: 'OS=latest,name=Apple Watch Series 9 (45mm)'
name: ${{ matrix.platform }} Tests
runs-on: macos-13
steps:
- name: Select latest available Xcode
uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: ${{ matrix.xcode }}
- name: Install xcbeautify
run: brew install xcbeautify
- name: Checkout code
uses: actions/checkout@v4
- name: Run tests
env:
DESTINATION: ${{ format('platform={0},{1}', matrix.platform, matrix.destination) }}
run: |
set -o pipefail && \
xcodebuild test -scheme StructuredAPIClient-Package \
-enableThreadSanitizer YES \
-enableCodeCoverage YES \
-disablePackageRepositoryCache \
-resultBundlePath "${GITHUB_WORKSPACE}/results.resultBundle" \
-destination "${DESTINATION}" |
xcbeautify --is-ci --quiet --renderer github-actions
- name: Upload coverage data
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
swift: true
verbose: true
xcode: true
xcode_archive_path: ${{ github.workspace }}/results.resultBundle
linux:
if: ${{ !(github.event.pull_request.draft || false) }}
strategy:
fail-fast: false
matrix:
swift-image:
- swift:5.9-jammy
- swiftlang/swift:nightly-5.10-jammy
- swiftlang/swift:nightly-main-jammy
name: Linux ${{ matrix.swift-image }} Tests
runs-on: ubuntu-latest
container: ${{ matrix.swift-image }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install xcbeautify
run: |
DEBIAN_FRONTEND=noninteractive apt-get update
DEBIAN_FRONTEND=noninteractive apt-get install -y curl
curl -fsSLO 'https://github.com/tuist/xcbeautify/releases/download/1.0.1/xcbeautify-1.0.1-x86_64-unknown-linux-gnu.tar.xz'
tar -x -J -f xcbeautify-1.0.1-x86_64-unknown-linux-gnu.tar.xz
- name: Run tests
shell: bash
run: |
set -o pipefail && \
swift test --sanitize=thread --enable-code-coverage |
./xcbeautify --is-ci --quiet --renderer github-actions
- name: Upload coverage data
uses: vapor/[email protected]
with:
cc_token: ${{ secrets.CODECOV_TOKEN }}
cc_verbose: true
codeql:
if: ${{ !(github.event.pull_request.draft || false) }}
name: CodeQL Analysis
runs-on: ubuntu-latest
container:
image: swift:5.9-jammy
permissions: { actions: write, contents: read, security-events: write }
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Mark repo safe
run: |
git config --global --add safe.directory "${GITHUB_WORKSPACE}"
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with: { languages: swift }
- name: Perform build
run: swift build
- name: Run CodeQL analyze
uses: github/codeql-action/analyze@v2
dependency-graph:
if: ${{ github.event_name == 'push' }}
runs-on: ubuntu-latest
container: swift:jammy
permissions:
contents: write
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Set up dependencies
run: |
git config --global --add safe.directory "${GITHUB_WORKSPACE}"
apt-get update && apt-get install -y curl
- name: Submit dependency graph
uses: vapor-community/[email protected]