-
Notifications
You must be signed in to change notification settings - Fork 2
69 lines (59 loc) · 2.47 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
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
failure-exit-code: 99
- name: swift:6.0-noble
failure-exit-code: 99
- name: swiftlang/swift:nightly-main-jammy
# https://github.com/swiftlang/swift/issues/77242
failure-exit-code: 0
config:
- mode: "debug"
build_args: ""
test_args: "--enable-code-coverage"
with_codecov: true
- mode: "release"
build_args: "-Xswiftc -enable-testing"
test_args: "-Xswiftc -enable-testing"
with_codecov: false
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: 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:
swift test --parallel -c ${{ matrix.config.mode }} ${{ matrix.config.test_args }} || exit ${{ matrix.swift-image.failure-exit-code }}
- name: Submit code coverage
if: matrix.config.with_codecov == 'true'
uses: vapor/swift-codecov-action@v0.3
with:
codecov_token: ${{ secrets.CODECOV_TOKEN }}