Skip to content

Commit 28ea3dc

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

File tree

2 files changed

+27
-1
lines changed

2 files changed

+27
-1
lines changed

.github/workflows/pull_request.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,16 @@ jobs:
99
name: Test with Docker
1010
uses: ./.github/workflows/swift_package_test.yml
1111
with:
12+
enable_release_tests: true
1213
# Linux
1314
linux_build_command: |
1415
mkdir MyPackage
1516
cd MyPackage
1617
swift package init --type library
1718
swift build
19+
linux_release_build_command: |
20+
cd MyPackage
21+
swift build -c release
1822
# Windows
1923
windows_build_command: |
2024
mkdir MyPackage
@@ -41,6 +45,7 @@ jobs:
4145
name: Test
4246
uses: ./.github/workflows/swift_package_test.yml
4347
with:
48+
enable_release_tests: true
4449
enable_linux_checks: false
4550
enable_windows_checks: false
4651
# macOS
@@ -50,6 +55,9 @@ jobs:
5055
cd MyPackage
5156
xcrun swift package init --type library
5257
xcrun swift build
58+
macos_release_build_command: |
59+
cd MyPackage
60+
xcrun swift build -c release
5361
5462
soundness:
5563
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 false"
113+
default: false
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)