From 6dc7960665d8cf80753e8154f5a430f93c0fc409 Mon Sep 17 00:00:00 2001 From: Adam Ward Date: Thu, 7 Nov 2024 10:48:01 -0500 Subject: [PATCH] Point to branch in forked workflows repo --- .github/workflows/pull_request.yml | 35 +--- .../scripts/windows/install-nodejs.ps1 | 24 --- .../workflows/scripts/windows/install-vsb.ps1 | 32 ---- .../windows/swift/install-swift-5.10.ps1 | 6 - .../windows/swift/install-swift-5.9.ps1 | 6 - .../windows/swift/install-swift-6.0.ps1 | 6 - .../swift/install-swift-nightly-6.0.ps1 | 7 - .../scripts/windows/swift/install-swift.ps1 | 31 ---- .github/workflows/swift_package_test.yml | 159 ------------------ 9 files changed, 3 insertions(+), 303 deletions(-) delete mode 100644 .github/workflows/scripts/windows/install-nodejs.ps1 delete mode 100644 .github/workflows/scripts/windows/install-vsb.ps1 delete mode 100644 .github/workflows/scripts/windows/swift/install-swift-5.10.ps1 delete mode 100644 .github/workflows/scripts/windows/swift/install-swift-5.9.ps1 delete mode 100644 .github/workflows/scripts/windows/swift/install-swift-6.0.ps1 delete mode 100644 .github/workflows/scripts/windows/swift/install-swift-nightly-6.0.ps1 delete mode 100644 .github/workflows/scripts/windows/swift/install-swift.ps1 delete mode 100644 .github/workflows/swift_package_test.yml diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index 56f1ca687..7d8dc9f69 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -20,7 +20,7 @@ jobs: tests: name: Test - uses: ./.github/workflows/swift_package_test.yml + uses: award999/github-workflows/.github/workflows/swift_package_test.yml@dockerless-windows with: # Linux linux_exclude_swift_versions: '[{"swift_version": "nightly-main"}]' @@ -37,42 +37,13 @@ jobs: /bin/bash -c "source $NVM_DIR/nvm.sh && nvm install $NODE_VERSION" echo "$NODE_PATH" >> $GITHUB_PATH linux_build_command: ./docker/test.sh - enable_linux_checks: false + enable_linux_checks: true # Windows enable_windows_checks: true enable_windows_docker: false - windows_exclude_swift_versions: '[{"swift_version": "nightly-main"}]' + windows_exclude_swift_versions: '[{"swift_version": "nightly"}]' windows_env_vars: | CI=1 FAST_TEST_RUN=1 windows_pre_build_command: .github\workflows\scripts\windows\install-nodejs.ps1 windows_build_command: docker\test-windows.ps1 - - tests-windows: - defaults: - run: - shell: powershell - name: Windows (${{ matrix.swift_version }}) - runs-on: ${{ contains(matrix.swift_version, 'nightly') && 'windows-2019' || 'windows-2022' }} - strategy: - fail-fast: false - matrix: - swift_version: ['5.9', '5.10', '6.0', 'nightly', 'nightly-6.0'] - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - name: Install node.js - if: ${{ !vars.skip_nodejs_install }} - run: . .github\workflows\scripts\windows\install-nodejs.ps1 - - name: Install Visual Studio Build Tools - if: ${{ !vars.skip_vsb_install }} - run: . .github\workflows\scripts\windows\install-vsb.ps1 - - name: Install Swift - if: ${{ !vars.skip_swift_install }} - run: . .github\workflows\scripts\windows\swift\install-swift-${{ matrix.swift_version }}.ps1 - - name: Build / Test - run: | - cd $env:GITHUB_WORKSPACE - Import-Module $env:ChocolateyInstall\helpers\chocolateyProfile.psm1 - refreshenv - docker\test-windows.ps1 diff --git a/.github/workflows/scripts/windows/install-nodejs.ps1 b/.github/workflows/scripts/windows/install-nodejs.ps1 deleted file mode 100644 index 2105d63ad..000000000 --- a/.github/workflows/scripts/windows/install-nodejs.ps1 +++ /dev/null @@ -1,24 +0,0 @@ -$NODEJS='https://nodejs.org/dist/v18.20.4/node-v18.20.4-x64.msi' -$NODEJS_SHA256='c2654d3557abd59de08474c6dd009b1d358f420b8e4010e4debbf130b1dfb90a' -Set-Variable ErrorActionPreference Stop -Set-Variable ProgressPreference SilentlyContinue -Write-Host -NoNewLine ('Downloading {0} ... ' -f ${NODEJS}) -Invoke-WebRequest -Uri ${NODEJS} -OutFile $env:TEMP\node.msi -Write-Host 'SUCCESS' -Write-Host -NoNewLine ('Verifying SHA256 ({0}) ... ' -f ${NODEJS_SHA256}) -$Hash = Get-FileHash $env:TEMP\node.msi -Algorithm sha256 -if ($Hash.Hash -eq ${NODEJS_SHA256}) { - Write-Host 'SUCCESS' -} else { - Write-Host ('FAILED ({0})' -f $Hash.Hash) - exit 1 -} -Write-Host -NoNewLine 'Installing node.js for Windows ... ' -$Process = Start-Process msiexec "/i $env:TEMP\node.msi /norestart /qn" -Wait -PassThru -if ($Process.ExitCode -eq 0) { - Write-Host 'SUCCESS' -} else { - Write-Host ('FAILED ({0})' -f $Process.ExitCode) - exit 1 -} -Remove-Item -Force $env:TEMP\node.msi \ No newline at end of file diff --git a/.github/workflows/scripts/windows/install-vsb.ps1 b/.github/workflows/scripts/windows/install-vsb.ps1 deleted file mode 100644 index 5529a6e4f..000000000 --- a/.github/workflows/scripts/windows/install-vsb.ps1 +++ /dev/null @@ -1,32 +0,0 @@ -$VSB='https://aka.ms/vs/17/release/vs_buildtools.exe' -$VSB_SHA256='99C7677154366062A43082921F40F3CE00EF2614DBF94DB23B244DD13DC9443D' -Set-Variable ErrorActionPreference Stop -Set-Variable ProgressPreference SilentlyContinue -Write-Host -NoNewLine ('Downloading {0} ... ' -f ${VSB}) -Invoke-WebRequest -Uri $VSB -OutFile $env:TEMP\vs_buildtools.exe -Write-Host 'SUCCESS' -Write-Host -NoNewLine ('Verifying SHA256 ({0}) ... ' -f $VSB_SHA256) -$Hash = Get-FileHash $env:TEMP\vs_buildtools.exe -Algorithm sha256 -if ($Hash.Hash -eq $VSB_SHA256) { - Write-Host 'SUCCESS' -} else { - Write-Host ('FAILED ({0})' -f $Hash.Hash) - exit 1 -} -Write-Host -NoNewLine 'Installing Visual Studio Build Tools ... ' -$Process = - Start-Process $env:TEMP\vs_buildtools.exe -Wait -PassThru -NoNewWindow -ArgumentList @( - '--quiet', - '--wait', - '--norestart', - '--nocache', - '--add', 'Microsoft.VisualStudio.Component.Windows11SDK.22000', - '--add', 'Microsoft.VisualStudio.Component.VC.Tools.x86.x64' - ) -if ($Process.ExitCode -eq 0 -or $Process.ExitCode -eq 3010) { - Write-Host 'SUCCESS' -} else { - Write-Host ('FAILED ({0})' -f $Process.ExitCode) - exit 1 -} -Remove-Item -Force $env:TEMP\vs_buildtools.exe \ No newline at end of file diff --git a/.github/workflows/scripts/windows/swift/install-swift-5.10.ps1 b/.github/workflows/scripts/windows/swift/install-swift-5.10.ps1 deleted file mode 100644 index 85daf4b12..000000000 --- a/.github/workflows/scripts/windows/swift/install-swift-5.10.ps1 +++ /dev/null @@ -1,6 +0,0 @@ -. $PSScriptRoot\install-swift.ps1 - -$SWIFT='https://download.swift.org/swift-5.10.1-release/windows10/swift-5.10.1-RELEASE/swift-5.10.1-RELEASE-windows10.exe' -$SWIFT_SHA256='3027762138ACFA1BBE3050FF6613BBE754332E84C9EFA5C23984646009297286' - -Install-Swift -Url $SWIFT -Sha256 $SWIFT_SHA256 diff --git a/.github/workflows/scripts/windows/swift/install-swift-5.9.ps1 b/.github/workflows/scripts/windows/swift/install-swift-5.9.ps1 deleted file mode 100644 index c34c02a87..000000000 --- a/.github/workflows/scripts/windows/swift/install-swift-5.9.ps1 +++ /dev/null @@ -1,6 +0,0 @@ -. $PSScriptRoot\install-swift.ps1 - -$SWIFT='https://download.swift.org/swift-5.9.2-release/windows10/swift-5.9.2-RELEASE/swift-5.9.2-RELEASE-windows10.exe' -$SWIFT_SHA256='D78A717551C78E824C9B74B0CFB1AD86060FC286EA071FDDB26DF18F56DC7212' - -Install-Swift -Url $SWIFT -Sha256 $SWIFT_SHA256 \ No newline at end of file diff --git a/.github/workflows/scripts/windows/swift/install-swift-6.0.ps1 b/.github/workflows/scripts/windows/swift/install-swift-6.0.ps1 deleted file mode 100644 index 82cbd143d..000000000 --- a/.github/workflows/scripts/windows/swift/install-swift-6.0.ps1 +++ /dev/null @@ -1,6 +0,0 @@ -. $PSScriptRoot\install-swift.ps1 - -$SWIFT='https://download.swift.org/swift-6.0.2-release/windows10/swift-6.0.2-RELEASE/swift-6.0.2-RELEASE-windows10.exe' -$SWIFT_SHA256='516FE8E64713BD92F03C01E5198011B74A27F8C1C88627607A2F421718636126' - -Install-Swift -Url $SWIFT -Sha256 $SWIFT_SHA256 \ No newline at end of file diff --git a/.github/workflows/scripts/windows/swift/install-swift-nightly-6.0.ps1 b/.github/workflows/scripts/windows/swift/install-swift-nightly-6.0.ps1 deleted file mode 100644 index 6641f3805..000000000 --- a/.github/workflows/scripts/windows/swift/install-swift-nightly-6.0.ps1 +++ /dev/null @@ -1,7 +0,0 @@ -. $PSScriptRoot\install-swift.ps1 - -$SWIFT_RELEASE_METADATA='http://download.swift.org/swift-6.0-branch/windows10/latest-build.json' -$Release = curl.exe -sL ${SWIFT_RELEASE_METADATA} -$SWIFT_URL = "https://download.swift.org/swift-6.0-branch/windows10/$($($Release | ConvertFrom-JSON).dir)/$($($Release | ConvertFrom-JSON).download)" - -Install-Swift -Url $SWIFT_URL -Sha256 "" \ No newline at end of file diff --git a/.github/workflows/scripts/windows/swift/install-swift.ps1 b/.github/workflows/scripts/windows/swift/install-swift.ps1 deleted file mode 100644 index f81c5d8ff..000000000 --- a/.github/workflows/scripts/windows/swift/install-swift.ps1 +++ /dev/null @@ -1,31 +0,0 @@ -function Install-Swift { - param ( - [string]$Url, - [string]$Sha256 - ) - Set-Variable ErrorActionPreference Stop - Set-Variable ProgressPreference SilentlyContinue - Write-Host -NoNewLine ('Downloading {0} ... ' -f $url) - Invoke-WebRequest -Uri $url -OutFile installer.exe - Write-Host 'SUCCESS' - Write-Host -NoNewLine ('Verifying SHA256 ({0}) ... ' -f $Sha256) - $Hash = Get-FileHash installer.exe -Algorithm sha256 - if ($Hash.Hash -eq $Sha256 -or $Sha256 -eq "") { - Write-Host 'SUCCESS' - } else { - Write-Host ('FAILED ({0})' -f $Hash.Hash) - exit 1 - } - Write-Host -NoNewLine 'Installing Swift ... ' - $Process = Start-Process installer.exe -Wait -PassThru -NoNewWindow -ArgumentList @( - '/quiet', - '/norestart' - ) - if ($Process.ExitCode -eq 0) { - Write-Host 'SUCCESS' - } else { - Write-Host ('FAILED ({0})' -f $Process.ExitCode) - exit 1 - } - Remove-Item -Force installer.exe -} \ No newline at end of file diff --git a/.github/workflows/swift_package_test.yml b/.github/workflows/swift_package_test.yml deleted file mode 100644 index a350c6cb8..000000000 --- a/.github/workflows/swift_package_test.yml +++ /dev/null @@ -1,159 +0,0 @@ -name: Swift Linux Matrix - -on: - workflow_call: - inputs: - linux_exclude_swift_versions: - type: string - description: "Exclude Linux Swift version list (JSON)" - default: "[{\"swift_version\": \"\"}]" - linux_os_versions: - type: string - description: "Linux OS version list (JSON)" - default: "[\"jammy\"]" - windows_exclude_swift_versions: - type: string - description: "Exclude Windows Swift version list (JSON)" - default: "[{\"swift_version\": \"\"}]" - swift_flags: - type: string - description: "Swift flags for release version" - default: "" - swift_nightly_flags: - type: string - description: "Swift flags for nightly version" - default: "" - linux_pre_build_command: - type: string - description: "Linux command to execute before building the Swift package" - default: "" - linux_build_command: - type: string - description: "Linux command to build and test the package" - default: "swift test" - windows_pre_build_command: - type: string - description: "Windows Command Prompt command to execute before building the Swift package" - default: "" - windows_build_command: - type: string - description: "Windows Command Prompt command to build and test the package" - default: "swift test" - linux_env_vars: - description: "List of environment variables" - type: string - windows_env_vars: - description: "List of environment variables" - type: string - enable_linux_checks: - type: boolean - description: "Boolean to enable linux testing. Defaults to true" - default: true - enable_windows_checks: - type: boolean - description: "Boolean to enable windows testing. Defaults to true" - default: true - enable_windows_docker: - type: boolean - description: "Boolean to enable running build in windows docker container. Defaults to true" - default: true - -jobs: - linux-build: - name: Linux (${{ matrix.swift_version }} - ${{ matrix.os_version }}) - if: ${{ inputs.enable_linux_checks }} - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - swift_version: ['5.8', '5.9', '5.10', '6.0', 'nightly-main', 'nightly-6.0'] - os_version: ${{ fromJson(inputs.linux_os_versions) }} - exclude: - - ${{ fromJson(inputs.linux_exclude_swift_versions) }} - container: - image: ${{ (contains(matrix.swift_version, 'nightly') && 'swiftlang/swift') || 'swift' }}:${{ matrix.swift_version }}-${{ matrix.os_version }} - steps: - - name: Swift version - run: swift --version - - name: Checkout repository - uses: actions/checkout@v4 - - name: Set environment variables - if: ${{ inputs.linux_env_vars }} - run: | - for i in "${{ inputs.linux_env_vars }}" - do - printf "%s\n" $i | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append - done - - name: Pre-build - 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 }} - - windows-build: - name: Windows (${{ matrix.swift_version }} - windows-2022) - if: ${{ inputs.enable_windows_checks }} - runs-on: ${{ contains(matrix.swift_version, 'nightly') && 'windows-2019' || 'windows-2022' }} - outputs: - image: ${{ steps.pull_docker_image.outputs.image }} - strategy: - fail-fast: false - matrix: - swift_version: ['5.9', '5.10', '6.0', 'nightly', 'nightly-6.0'] - exclude: - - ${{ fromJson(inputs.windows_exclude_swift_versions) }} - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - name: Set environment variables - if: ${{ inputs.windows_env_vars }} - run: | - $lines = "${{ inputs.windows_env_vars }}" -split "`r`n" - foreach ($line in $lines) { - echo $line | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append - } - - name: Pull Docker image - id: pull_docker_image - if: ${{ inputs.enable_windows_docker }} - run: | - if ("${{ matrix.swift_version }}".Contains("nightly")) { - $Image = "swiftlang/swift:${{ matrix.swift_version }}-windowsservercore-1809" - } else { - $Image = "swift:${{ matrix.swift_version }}-windowsservercore-ltsc2022" - } - docker pull $Image - echo "image='$Image'" >> $env:GITHUB_OUTPUT - cat "$env:GITHUB_OUTPUT" - - name: Install Visual Studio Build Tools - if: ${{ !inputs.enable_windows_docker }} - run: . .github\workflows\scripts\windows\install-vsb.ps1 - - name: Install Swift - if: ${{ !inputs.enable_windows_docker }} - run: . .github\workflows\scripts\windows\swift\install-swift-${{ matrix.swift_version }}.ps1 - - name: Create test script - run: | - mkdir $env:TEMP\test-script - echo 'Set-PSDebug -Trace 1' >> $env:TEMP\test-script\run.ps1 - echo '$ErrorActionPreference = "Stop"' >> $env:TEMP\test-script\run.ps1 - echo 'swift --version' >> $env:TEMP\test-script\run.ps1 - echo 'swift test --version' >> $env:TEMP\test-script\run.ps1 - echo 'cd C:\source\' >> $env:TEMP\test-script\run.ps1 - echo @' - ${{ inputs.windows_pre_build_command }} - '@ >> $env:TEMP\test-script\run.ps1 - echo '${{ inputs.windows_build_command }} ${{ (contains(matrix.swift_version, 'nightly') && inputs.swift_nightly_flags) || inputs.swift_flags }}' >> $env:TEMP\test-script\run.ps1 - # Docker build - - name: Build / Test - timeout-minutes: 60 - if: ${{ !inputs.enable_windows_docker }} - run: | - if ("${{ matrix.swift_version }}".Contains("nightly")) { - $Image = "swiftlang/swift:${{ matrix.swift_version }}-windowsservercore-1809" - } else { - $Image = "swift:${{ matrix.swift_version }}-windowsservercore-ltsc2022" - } - docker run -v ${{ github.workspace }}:C:\source -v $env:TEMP\test-script:C:\test-script "$Image" powershell.exe -NoLogo -File C:\test-script\run.ps1 - # Docker-less build - - name: Build / Test - timeout-minutes: 60 - if: ${{ inputs.enable_windows_docker }} - run: powershell.exe -NoLogo -File $env:TEMP\test-script\run.ps1 \ No newline at end of file