-
Notifications
You must be signed in to change notification settings - Fork 14
113 lines (97 loc) · 2.78 KB
/
swift-package.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
name: Swift Package
defaults:
run:
shell: bash -eo pipefail {0}
on:
workflow_dispatch:
push:
branches:
- '**'
tags-ignore:
- '**'
paths-ignore:
- '.github/**' # Ignore all files under '.github'
- '!.github/workflows/swift-package.yml' # Except for this workflow
- '.gitignore'
- '.remarkrc'
- '.swiftlint.yml'
- 'Documentation/**'
- 'LICENSE'
- 'README.md'
- 'CBORCoding.podspec'
jobs:
build:
strategy:
matrix:
os: [macOS-13, ubuntu-latest]
xcode: ['15.0']
name: Build
runs-on: ${{ matrix.os }}
env:
LOGSDIR: /tmp/.cborcoding.swiftpm/Logs/Build
steps:
- name: Select Xcode Version
if: ${{ runner.os == 'macOS' }}
uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: ${{ matrix.xcode }}
- name: Checkout Code
uses: actions/checkout@v4
with:
submodules: recursive
- name: Setup Environment
run: |
mkdir -p "$LOGSDIR"
- name: Build
run: |
swift --version | tee "$LOGSDIR/Build.log"
swift build --verbose | tee -a "$LOGSDIR/Build.log"
- name: Upload Logs
uses: actions/upload-artifact@v3
if: always()
with:
name: BuildLogs-${{ runner.os }}
path: ${{ env.LOGSDIR }}/*.log
test:
strategy:
matrix:
os: [macOS-13, ubuntu-latest]
xcode: ['15.0']
name: Test
runs-on: ${{ matrix.os }}
needs: build
env:
LOGSDIR: /tmp/.cborcoding.swiftpm/Logs/Test
steps:
- name: Select Xcode Version
if: ${{ runner.os == 'macOS' }}
uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: ${{ matrix.xcode }}
- name: Checkout Code
uses: actions/checkout@v4
with:
submodules: recursive
- name: Setup Environment
run: |
mkdir -p "$LOGSDIR"
- name: Test
run: |
swift test --verbose --enable-code-coverage | tee "$LOGSDIR/Test.log"
- name: Generate Code Coverage File
if: ${{ runner.os == 'macOS' && github.event_name == 'push' && github.ref == 'refs/heads/main' }}
run: |
xcrun llvm-cov export --format=lcov --instr-profile=".build/debug/codecov/default.profdata" ".build/debug/CBORCodingPackageTests.xctest/Contents/MacOS/CBORCodingPackageTests" > "./codecov.lcov"
- name: Upload Code Coverage
if: ${{ runner.os == 'macOS' && github.event_name == 'push' && github.ref == 'refs/heads/main' }}
uses: codecov/codecov-action@v2
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./codecov.lcov
verbose: true
- name: Upload Logs
uses: actions/upload-artifact@v3
if: always()
with:
name: TestLogs-${{ runner.os }}
path: ${{ env.LOGSDIR }}/*.log