-
Notifications
You must be signed in to change notification settings - Fork 2
70 lines (58 loc) · 2.36 KB
/
tests.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
name: tests
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
on:
pull_request: { types: [opened, reopened, synchronize] }
push: { branches: [main] }
jobs:
tests:
strategy:
fail-fast: false
matrix:
swift-image:
- name: swift:5.10-noble
error-sign: "-"
- name: swift:6.0-noble
error-sign: "-"
- name: swiftlang/swift:nightly-main-jammy
# https://github.com/swiftlang/swift/issues/77242
error-sign: "+"
config:
- mode: "debug"
build_args: ""
- mode: "release"
build_args: "-Xswiftc -enable-testing"
runs-on: ubuntu-latest
container: ${{ matrix.swift-image.name }}
timeout-minutes: 30
steps:
- name: Check out ${{ github.event.repository.name }}
uses: actions/checkout@v4
- name: Restore .build
id: "restore-cache"
uses: actions/cache/restore@v4
with:
path: .build
# e.g. 'enumerator-macro-debug-build-swiftlang/swift:nightly-6.0-jammy-Linux-c7008df8062ac4d5887ead9e59aa05829e'
key: "${{ github.event.repository.name }}-${{ matrix.config.mode }}-build-${{ matrix.swift-image.name }}-${{ runner.os }}-${{ hashFiles('./Package.resolved') }}"
restore-keys: "${{ github.event.repository.name }}-${{ matrix.config.mode }}-build-${{ matrix.swift-image.name }}-${{ runner.os }}-"
- name: Build ${{ github.event.repository.name }}
run:
set ${{ matrix.swift-image.error-sign }}e
swift build --build-tests -c ${{ matrix.config.mode }} ${{ matrix.config.build_args }}
- name: Cache .build
if: steps.restore-cache.outputs.cache-hit != 'true'
uses: actions/cache/save@v4
with:
path: .build
key: "${{ github.event.repository.name }}-${{ matrix.config.mode }}-build-${{ matrix.swift-image.name }}-${{ runner.os }}-${{ hashFiles('./Package.resolved') }}"
- name: Run tests
run:
set ${{ matrix.swift-image.error-sign }}e
swift test --parallel --enable-code-coverage -c ${{ matrix.config.mode }}
- name: Submit code coverage
uses: vapor/swift-codecov-action@v0.3
with:
build_parameters: "-c ${{ matrix.config.mode }}"
codecov_token: "${{ secrets.CODECOV_TOKEN }}"