Skip to content

Add release-mode test runs for macOS and Linux #134

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,16 @@ jobs:
name: Test with Docker
uses: ./.github/workflows/swift_package_test.yml
with:
enable_release_tests: true
# Linux
linux_build_command: |
mkdir MyPackage
cd MyPackage
swift package init --type library
swift build
linux_release_build_command: |
cd MyPackage
swift build -c release
# Windows
windows_build_command: |
mkdir MyPackage
Expand All @@ -41,6 +45,7 @@ jobs:
name: Test
uses: ./.github/workflows/swift_package_test.yml
with:
enable_release_tests: true
enable_linux_checks: false
enable_windows_checks: false
# macOS
Expand All @@ -50,6 +55,9 @@ jobs:
cd MyPackage
xcrun swift package init --type library
xcrun swift build
macos_release_build_command: |
cd MyPackage
xcrun swift build -c release

soundness:
name: Soundness
Expand Down
20 changes: 19 additions & 1 deletion .github/workflows/swift_package_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,18 @@ on:
type: string
description: "macOS command to build and test the package"
default: "xcrun swift test"
macos_release_build_command:
type: string
description: "macOS command to build and test the package"
default: "xcrun swift test -c release"
linux_build_command:
type: string
description: "Linux command to build and test the package"
default: "swift test"
linux_release_build_command:
type: string
description: "Linux command to build and test the package"
default: "swift test -c release"
windows_pre_build_command:
type: string
description: "Windows Command Prompt command to execute before building the Swift package"
Expand Down Expand Up @@ -99,6 +107,10 @@ on:
type: boolean
description: "Boolean to enable running build in windows docker container. Defaults to true"
default: true
enable_release_tests:
type: boolean
description: "Boolean to enable building and running tests in release mode in addition to the default debug mode. Defaults to false"
default: false
needs_token:
type: boolean
description: "Boolean to enable providing the GITHUB_TOKEN to downstream job."
Expand Down Expand Up @@ -137,9 +149,12 @@ jobs:
run: xcrun swift --version
- name: Pre-build
run: ${{ inputs.macos_pre_build_command }}
- name: Build / Test
- name: Build / Test [debug]
run: ${{ inputs.macos_build_command }} ${{ (contains(matrix.swift_version, 'nightly') && inputs.swift_nightly_flags) || inputs.swift_flags }}
timeout-minutes: 60
- name: Build / Test [release]
if: ${{ inputs.enable_release_tests }}
run: ${{ inputs.macos_release_build_command }} ${{ (contains(matrix.swift_version, 'nightly') && inputs.swift_nightly_flags) || inputs.swift_flags }}

linux-build:
name: Linux (${{ matrix.swift_version }} - ${{ matrix.os_version }})
Expand Down Expand Up @@ -174,6 +189,9 @@ jobs:
run: ${{ inputs.linux_pre_build_command }}
- name: Build / Test
run: ${{ inputs.linux_build_command }} ${{ (contains(matrix.swift_version, 'nightly') && inputs.swift_nightly_flags) || inputs.swift_flags }}
- name: Build / Test [release]
if: ${{ inputs.enable_release_tests }}
run: ${{ inputs.linux_release_build_command }} ${{ (contains(matrix.swift_version, 'nightly') && inputs.swift_nightly_flags) || inputs.swift_flags }}

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