-
Notifications
You must be signed in to change notification settings - Fork 10
63 lines (53 loc) · 1.57 KB
/
swift-ci.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
name: Swift CI
on:
pull_request:
push:
branches: ['main']
jobs:
format:
runs-on: macos-12
steps:
- uses: actions/checkout@v3
- name: Install swift-format
run: brew install swift-format
- name: Format
run: swift format lint --strict --configuration .swift-format.json --recursive --parallel Sources/ Tests/ Examples/ Package.swift
build:
strategy:
matrix:
swift: ["5.7", "5.8"]
os: [macos-12, macos-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: swift-actions/setup-swift@v1
with:
swift-version: ${{ matrix.swift }}
- uses: actions/checkout@v3
- uses: actions/cache@v3
with:
path: sdk/swift/.build
key: ${{ runner.os }}-${{ matrix.swift }}-spm-${{ github.job }}-${{ hashFiles('**/Package.resolved') }}
restore-keys: |
${{ runner.os }}-${{ matrix.swift }}-spm-
- name: Build
run: swift build
test:
strategy:
matrix:
swift: ["5.7", "5.8"]
os: [macos-12, macos-latest]
needs: [build]
runs-on: ${{ matrix.os }}
steps:
- uses: swift-actions/setup-swift@v1
with:
swift-version: ${{ matrix.swift }}
- uses: actions/checkout@v3
- uses: actions/cache@v3
with:
path: sdk/swift/.build
key: ${{ runner.os }}-${{ matrix.swift }}-spm-${{ github.job }}-${{ hashFiles('**/Package.resolved') }}
restore-keys: |
${{ runner.os }}-${{ matrix.swift }}-spm-
- name: Test
run: swift test