actions / runner-images

GitHub Actions runner images
MIT License
9.98k stars 3.02k forks source link

Add Swift to Windows images #8281

Closed fumoboy007 closed 1 year ago

fumoboy007 commented 1 year ago

Tool name

Swift

Tool license

Apache

Add or update?

Desired version

Any

Approximate size

No response

Brief description of tool

From the homepage:

Swift is a general-purpose programming language that’s approachable for newcomers and powerful for experts. It is fast, modern, safe, and a joy to write.

URL for tool's homepage

https://www.swift.org

Provide a basic test case to validate the tool's functionality.

Something similar to the Ubuntu image’s tests I would assume:

Describe "Swift" {
    It "swift" {
        "swift --version" | Should -ReturnZeroExitCode
    }

    It "swiftc" {
        "swiftc --version" | Should -ReturnZeroExitCode
    }

    It "libsourcekitd" {
        "/usr/local/lib/libsourcekitdInProc.so" | Should -Exist
    }
}

Platforms where you need the tool

Runner images where you need the tool

Can this tool be installed during the build?

Something similar to the Ubuntu image’s install script I would assume:

#!/bin/bash -e
################################################################################
##  File:  swift.sh
##  Desc:  Installs Swift
################################################################################

# Source the helpers for use with the script
source $HELPER_SCRIPTS/install.sh

# Install
image_label="$(lsb_release -rs)"
swift_version=$(curl -fsSL "https://api.github.com/repos/apple/swift/releases/latest" | jq -r '.tag_name | match("[0-9.]+").string')

swift_tar_name="swift-$swift_version-RELEASE-ubuntu$image_label.tar.gz"
swift_tar_url="https://swift.org/builds/swift-$swift_version-release/ubuntu${image_label//./}/swift-$swift_version-RELEASE/$swift_tar_name"
download_with_retries $swift_tar_url "/tmp" "$swift_tar_name"

tar xzf /tmp/$swift_tar_name

SWIFT_INSTALL_ROOT="/usr/share/swift"
SWIFT_BIN_ROOT="$SWIFT_INSTALL_ROOT/usr/bin"
SWIFT_LIB_ROOT="$SWIFT_INSTALL_ROOT/usr/lib"

mv swift-$swift_version-RELEASE-ubuntu$image_label $SWIFT_INSTALL_ROOT
mkdir -p /usr/local/lib

ln -s "$SWIFT_BIN_ROOT/swift" /usr/local/bin/swift
ln -s "$SWIFT_BIN_ROOT/swiftc" /usr/local/bin/swiftc
ln -s "$SWIFT_LIB_ROOT/libsourcekitdInProc.so" /usr/local/lib/libsourcekitdInProc.so

echo "SWIFT_PATH=$SWIFT_BIN_ROOT" | tee -a /etc/environment

invoke_tests "Common" "Swift"

Tool installation time in runtime

No response

Are you willing to submit a PR?

I don’t think I’m the right person. I’ve never used Swift on Windows. I just want to make sure my Swift package’s tests pass on Windows.

shamil-mubarakshin commented 1 year ago

Hello @fumoboy007. There were some concerns about adding swift to windows images in the past. Let us check if those still stand and get back

shamil-mubarakshin commented 1 year ago

@fumoboy007, we would not like to include the tool in the image due to maintenance concerns. I am closing this issue for now, feel free to reach out in case of further concerns

fumoboy007 commented 1 year ago

@shamil-mubarakshin For posterity’s sake, can you elaborate on the maintenance concerns?

fumoboy007 commented 3 months ago

@shamil-mubarakshin For posterity’s sake, can you elaborate on the maintenance concerns?

@shamil-mubarakshin ^

fumoboy007 commented 3 months ago

@compnerd Would you happen to know if there are extra maintenance issues with Swift on Windows? Not sure what kind of maintenance issues @shamil-mubarakshin is referring to that aren’t also relevant to the existing support for Swift in the Ubuntu runner images.

compnerd commented 3 months ago

I'm unaware of the issues, the only one that was ever mentioned was size.