nuke icon indicating copy to clipboard operation
nuke copied to clipboard

Refresh supported runner types for Github actions (including those currently in preview)

Open avidenic opened this issue 10 months ago • 0 comments

Description

Github offers different runner types that are currently available in GitHubActionsImage

According to the documentation, the missing runner types are:

  • windows-2025
  • ubuntu-24.04-arm
  • ubuntu-22.04-arm
  • macos-13
  • macos-15

And runner types that are present in GitHubActionsImage, but are missing in the documentation are:

  • ubuntu-18.04
  • macos-10.15
  • macos-11
  • macos-12

I suggest we either:

  • a simple solution: sync runner types with documentation - but we'd need to do this regularly
  • or not-so-simple-but-long-term-solution: change GitHubActionsImage from enum to to a static class with const string for runner types. GitHubActions would need to accept string for runner type instead of an enum. This gives the ease of use for those who want to use whatever is currently supported by Nuke, while giving flexibility for the next time when these runner types get out of sync with what is supported by Github Actions

New implementation example

[PublicAPI]
public enum GitHubActionsImage
{
    [EnumValue("windows-2025")] Windows2025,
    [EnumValue("windows-2022")] WindowsServer2022,
    [EnumValue("windows-2019")] WindowsServer2019,
    [EnumValue("ubuntu-24.04")] Ubuntu2404,
    [EnumValue("ubuntu-24.04-arm")] Ubuntu2404Arm,
    [EnumValue("ubuntu-22.04")] Ubuntu2204,
    [EnumValue("ubuntu-22.04-arm")] Ubuntu2204Arm,
    [EnumValue("ubuntu-20.04")] Ubuntu2004,
    [EnumValue("macos-15")] MacOs14,
    [EnumValue("macos-14")] MacOs14,
    [EnumValue("macos-13")] MacOs13,
    [EnumValue("windows-latest")] WindowsLatest,
    [EnumValue("ubuntu-latest")] UbuntuLatest,
    [EnumValue("macos-latest")] MacOsLatest,
    [EnumValue("self-hosted")] SelfHosted
}

Less breaking implementation

private const string ObsoleteMessage = "See supported runners https://docs.github.com/en/actions/using-github-hosted-runners/using-github-hosted-runners/about-github-hosted-runners#supported-runners-and-hardware-resources";

[PublicAPI]
public enum GitHubActionsImage
{
    [EnumValue("windows-2025")] Windows2025,
    [EnumValue("windows-2022")] WindowsServer2022,
    [EnumValue("windows-2019")] WindowsServer2019,
    [EnumValue("ubuntu-24.04")] Ubuntu2404,
    [EnumValue("ubuntu-24.04-arm")] Ubuntu2404Arm,
    [EnumValue("ubuntu-22.04")] Ubuntu2204,
    [EnumValue("ubuntu-22.04-arm")] Ubuntu2204Arm,
    [EnumValue("ubuntu-20.04")] Ubuntu2004,
    [EnumValue("ubuntu-18.04"), Obsolete(ObsoleteMessage)] Ubuntu1804,
    [EnumValue("macos-15")] MacOs14,
    [EnumValue("macos-14")] MacOs14,
    [EnumValue("macos-13")] MacOs13,
    [EnumValue("macos-12"), Obsolete(ObsoleteMessage)] MacOs12,
    [EnumValue("macos-11"), Obsolete(ObsoleteMessage)] MacOs11,
    [EnumValue("macos-10.15"), Obsolete(ObsoleteMessage)] MacOs1015,
    [EnumValue("windows-latest")] WindowsLatest,
    [EnumValue("ubuntu-latest")] UbuntuLatest,
    [EnumValue("macos-latest")] MacOsLatest,
    [EnumValue("self-hosted")] SelfHosted
}

Alternative implementation

[PublicAPI]
public static class GitHubActionsImage
{
    public const string Windows2025 = "windows-2025";
    public const string Windows2022 = "windows-2022";
    public const string WindowsServer2022 = "windows-2022";
    public const string WindowsServer2019 = "windows-2019";
    public const string Ubuntu2404 = "ubuntu-24.04";
    public const string Ubuntu2404Arm = "ubuntu-24.04-arm";
    public const string Ubuntu2204 = "ubuntu-22.04";
    public const string Ubuntu2204Arm = "ubuntu-22.04-arm";
    public const string Ubuntu2004 = "ubuntu-20.04";
    public const string MacOs14 = "macos-15";
    public const string MacOs13 = "macos-13";
    public const string WindowsLatest = "windows-latest";
    public const string UbuntuLatest = "ubuntu-latest";
    public const string MacOsLatest = "macos-latest";
    public const string SelfHosted = "self-hosted";
}

We'd need to change GitHubActionsAttribute as well:

public class GitHubActionsAttribute : ConfigurationAttributeBase
{
    private readonly string _name;
    private readonly string[] _images;
    private GitHubActionsSubmodules? _submodules;
    private bool? _lfs;
    private uint? _fetchDepth;
    private bool? _progress;
    private string _filter;

    public GitHubActionsAttribute(
        string name,
        string image,
        params string[] images)
    {
        _name = name.Replace(oldChar: ' ', newChar: '_');
        _images = new[] { image }.Concat(images).ToArray();
    }

 // other code
}

We'd also need to fix examples. This would be a breaking change without a doubt but might be better as far as maintenance goes.

Could you help with a pull-request?

Yes

avidenic avatar Feb 14 '25 09:02 avidenic