Skip to content

Commit 2cc0791

Browse files
committed
Add release-mode test runs for macOS and Linux
1 parent 0fedcfc commit 2cc0791

File tree

2 files changed

+25
-1
lines changed

2 files changed

+25
-1
lines changed

.github/workflows/pull_request.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ jobs:
1515
cd MyPackage
1616
swift package init --type library
1717
swift build
18+
linux_release_build_command: |
19+
cd MyPackage
20+
swift build -c release
1821
# Windows
1922
windows_build_command: |
2023
mkdir MyPackage
@@ -50,6 +53,9 @@ jobs:
5053
cd MyPackage
5154
xcrun swift package init --type library
5255
xcrun swift build
56+
macos_release_build_command: |
57+
cd MyPackage
58+
xcrun swift build -c release
5359
5460
soundness:
5561
name: Soundness

.github/workflows/swift_package_test.yml

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,18 @@ on:
5959
type: string
6060
description: "macOS command to build and test the package"
6161
default: "xcrun swift test"
62+
macos_release_build_command:
63+
type: string
64+
description: "macOS command to build and test the package"
65+
default: "xcrun swift test -c release"
6266
linux_build_command:
6367
type: string
6468
description: "Linux command to build and test the package"
6569
default: "swift test"
70+
linux_release_build_command:
71+
type: string
72+
description: "Linux command to build and test the package"
73+
default: "swift test -c release"
6674
windows_pre_build_command:
6775
type: string
6876
description: "Windows Command Prompt command to execute before building the Swift package"
@@ -99,6 +107,10 @@ on:
99107
type: boolean
100108
description: "Boolean to enable running build in windows docker container. Defaults to true"
101109
default: true
110+
enable_release_tests:
111+
type: boolean
112+
description: "Boolean to enable building and running tests in release mode in addition to the default debug mode. Defaults to true"
113+
default: true
102114
needs_token:
103115
type: boolean
104116
description: "Boolean to enable providing the GITHUB_TOKEN to downstream job."
@@ -137,9 +149,12 @@ jobs:
137149
run: xcrun swift --version
138150
- name: Pre-build
139151
run: ${{ inputs.macos_pre_build_command }}
140-
- name: Build / Test
152+
- name: Build / Test [debug]
141153
run: ${{ inputs.macos_build_command }} ${{ (contains(matrix.swift_version, 'nightly') && inputs.swift_nightly_flags) || inputs.swift_flags }}
142154
timeout-minutes: 60
155+
- name: Build / Test [release]
156+
if: ${{ inputs.enable_release_tests }}
157+
run: ${{ inputs.macos_release_build_command }} ${{ (contains(matrix.swift_version, 'nightly') && inputs.swift_nightly_flags) || inputs.swift_flags }}
143158

144159
linux-build:
145160
name: Linux (${{ matrix.swift_version }} - ${{ matrix.os_version }})
@@ -174,6 +189,9 @@ jobs:
174189
run: ${{ inputs.linux_pre_build_command }}
175190
- name: Build / Test
176191
run: ${{ inputs.linux_build_command }} ${{ (contains(matrix.swift_version, 'nightly') && inputs.swift_nightly_flags) || inputs.swift_flags }}
192+
- name: Build / Test [release]
193+
if: ${{ inputs.enable_release_tests }}
194+
run: ${{ inputs.linux_release_build_command }} ${{ (contains(matrix.swift_version, 'nightly') && inputs.swift_nightly_flags) || inputs.swift_flags }}
177195

178196
windows-build:
179197
name: Windows (${{ matrix.swift_version }} - ${{ inputs.enable_windows_docker && contains(matrix.swift_version, 'nightly') && 'windows-2019' || 'windows-2022' }})

0 commit comments

Comments
 (0)