-
Notifications
You must be signed in to change notification settings - Fork 0
76 lines (71 loc) · 3.17 KB
/
Copy pathpull_request.yml
File metadata and controls
76 lines (71 loc) · 3.17 KB
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
# This workflow is intended to be adopted by all repositories in the swift-libp2p org
name: Pull Request
# Controls when the workflow will run
on:
workflow_call:
inputs:
api_breakage_check_enabled:
type: boolean
description: "Boolean to enable the API breakage check job. Defaults to true."
default: true
api_breakage_check_allowlist_path:
type: string
description: "Path to a file that will be passed as --breakage-allowlist-path to swift package diagnose-api-breaking-changes"
default: ""
test_in_release_configuration:
type: boolean
description: "Boolean to enable building and testing in release mode (as opposed to debug mode). Defaults to false (debug mode)."
default: false
extra_swift_flags:
type: string
description: "Additional flags passed to swift build/test (e.g. '--traits TestDependencies')"
default: ""
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
soundness:
name: Soundness
uses: swiftlang/github-workflows/.github/workflows/soundness.yml@main
with:
api_breakage_check_enabled: ${{ !contains(github.event.pull_request.labels.*.name, 'breaking-change') && inputs.api_breakage_check_enabled }}
api_breakage_check_allowlist_path: ${{ inputs.api_breakage_check_allowlist_path }}
unacceptable_language_check_word_list: "blacklist whitelist slave sane sanity insane insanity kill killed killing hang hung hanged hanging"
license_header_check_project_name: "swift-libp2p"
tests-linux:
needs: soundness
name: Tests-Linux
uses: swiftlang/github-workflows/.github/workflows/swift_package_test.yml@main
with:
# Disable windows builds for the time being
enable_windows_checks: false
# Pass the configuration flags for linux builds and tests
swift_flags: ${{ inputs.test_in_release_configuration && '-c release -Xswiftc -enable-testing' || '' }} ${{ inputs.extra_swift_flags }}
swift_nightly_flags: ${{ inputs.test_in_release_configuration && '-c release -Xswiftc -enable-testing' || '' }} ${{ inputs.extra_swift_flags }}
# Implement our own MacOS tests until swiftlang adds support for it
test-macos:
needs: soundness
name: Tests-MacOS
strategy:
fail-fast: false
matrix:
os: [macos-latest]
# Test on the latest 4 versions of Swift (skip 6.0 and 6.1 due to build errors)
swift-version: ["6.2", "6.3", "6.4"]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v7
- uses: SwiftyLab/setup-swift@latest
with:
swift-version: ${{ matrix.swift-version }}
- name: Get swift version
run: swift --version
# Build in debug mode
- name: Build
run: swift build ${{ inputs.extra_swift_flags }}
# Test in debug mode
- name: Test Debug
if: ${{ !inputs.test_in_release_configuration }}
run: swift test ${{ inputs.extra_swift_flags }}
# Test in release mode
- name: Test Release
if: ${{ inputs.test_in_release_configuration }}
run: swift test -c release -Xswiftc -enable-testing ${{ inputs.extra_swift_flags }}