Skip to content

Commit

Permalink
Consolidate Swift setup in workflows (#211)
Browse files Browse the repository at this point in the history
  • Loading branch information
tristanlabelle authored Jul 23, 2024
1 parent fdc8e2b commit a038bfc
Show file tree
Hide file tree
Showing 4 changed files with 70 additions and 106 deletions.
14 changes: 14 additions & 0 deletions .github/actions/setup-swift/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: Setup Swift
description: Installs dependencies and setups the environment for building Swift code on Windows.
runs:
using: "composite"

steps:
- name: Setup Visual Studio Development Environment
uses: compnerd/gha-setup-vsdevenv@main

- name: Install Swift
uses: compnerd/gha-setup-swift@81f383b35a86e6e966de139be25b451d4f7dd953 # The next main commit breaks our %Path%
with:
branch: swift-5.10.1-release
tag: 5.10.1-RELEASE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Build & Test (SPM)
name: Build & Test

on:
pull_request:
Expand All @@ -10,22 +10,14 @@ on:
workflow_dispatch:

jobs:
support:
name: Support Module
support-spm:
name: Support Module (SPM)
runs-on: windows-2022
timeout-minutes: 10

steps:
- uses: actions/checkout@v3

- name: Setup Visual Studio Development Environment
uses: compnerd/gha-setup-vsdevenv@main

- name: Install Swift
uses: compnerd/gha-setup-swift@81f383b35a86e6e966de139be25b451d4f7dd953 # The next main commit breaks our %Path%
with:
branch: swift-5.10.1-release
tag: 5.10.1-RELEASE
- uses: ./.github/actions/setup-swift

- name: Build support module
shell: pwsh
Expand All @@ -35,22 +27,14 @@ jobs:
shell: pwsh
run: swift test --verbose --skip-build

generator-and-interoptests:
name: Generator and InteropTests
generator-and-interoptests-spm:
name: Generator and InteropTests (SPM)
runs-on: windows-2022
timeout-minutes: 15

steps:
- uses: actions/checkout@v3

- name: Setup Visual Studio Development Environment
uses: compnerd/gha-setup-vsdevenv@main

- name: Install Swift
uses: compnerd/gha-setup-swift@81f383b35a86e6e966de139be25b451d4f7dd953 # The next main commit breaks our %Path%
with:
branch: swift-5.10.1-release
tag: 5.10.1-RELEASE
- uses: ./.github/actions/setup-swift

- name: Build code generator
working-directory: Generator
Expand All @@ -75,4 +59,40 @@ jobs:
- name: Run InteropTests
working-directory: InteropTests
shell: pwsh
run: swift test --verbose --skip-build
run: swift test --verbose --skip-build

support-cmake:
name: Support Module (CMake)
runs-on: windows-2022
timeout-minutes: 15

steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/setup-swift

- name: CMake Configure
shell: pwsh
run: cmake --preset debug

- name: CMake Build
shell: pwsh
run: cmake --build --preset debug

generator-cmake:
name: Generator (CMake)
runs-on: windows-2022
timeout-minutes: 15

steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/setup-swift

- name: CMake Configure
working-directory: Generator
shell: pwsh
run: cmake --preset debug

- name: CMake Build
working-directory: Generator
shell: pwsh
run: cmake --build --preset debug
63 changes: 0 additions & 63 deletions .github/workflows/build-cmake.yml

This file was deleted.

31 changes: 12 additions & 19 deletions .github/workflows/release-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,25 +14,7 @@ jobs:

steps:
- uses: actions/checkout@v3

- name: Setup Visual Studio Development Environment
uses: compnerd/gha-setup-vsdevenv@main

- name: Install Swift
uses: compnerd/gha-setup-swift@81f383b35a86e6e966de139be25b451d4f7dd953 # The next main commit breaks our %Path%
with:
branch: swift-5.10.1-release
tag: 5.10.1-RELEASE

- name: CMake Configure
working-directory: Generator
shell: pwsh
run: cmake --preset release

- name: CMake Build
working-directory: Generator
shell: pwsh
run: cmake --build --preset release
- uses: ./.github/actions/setup-swift

- name: Compute Version
id: version
Expand All @@ -46,10 +28,21 @@ jobs:
}
echo "::set-output semver=$SemVer"
- name: CMake Configure
working-directory: Generator
shell: pwsh
run: cmake --preset release

- name: CMake Build
working-directory: Generator
shell: pwsh
run: cmake --build --preset release

- name: Create NuGet Package
working-directory: Generator
shell: pwsh
run: |
$OutputPath = "${{ github.workspace }}/SwiftWinRT.nupkg"
& .\Create-NuGetPackage.ps1 `
-NativeExe "build\release\Sources\SwiftWinRT\SwiftWinRT.exe" `
-Version "${{ steps.version.outputs.semver }}" `
Expand Down

0 comments on commit a038bfc

Please sign in to comment.