From 3492bd4915dec97a3aa9ccad3c1933e16873f9b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cihat=20Gu=CC=88ndu=CC=88z?= Date: Sat, 11 Sep 2021 22:39:34 +0200 Subject: [PATCH] Add CI tests targeting Windows platform --- .github/workflows/pull-request.yml | 36 +++++++++++++++++++++ Tests/ReportingTests/LintResultsTests.swift | 1 - 2 files changed, 36 insertions(+), 1 deletion(-) diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml index 19021c0..305810c 100644 --- a/.github/workflows/pull-request.yml +++ b/.github/workflows/pull-request.yml @@ -43,3 +43,39 @@ jobs: - name: Run tests run: swift test -v --enable-code-coverage + + # originally from: https://github.com/compnerd/swift-build/blob/master/.github/workflows/swift-argument-parser.yml + test-windows: + runs-on: windows-latest + + strategy: + matrix: + include: + - tag: swift-5.4.3-RELEASE + branch: swift-5.4.3-release + + steps: + - uses: actions/checkout@v2 + + - name: Install Swift ${{ matrix.tag }} + run: | + function Update-EnvironmentVariables { + foreach ($level in "Machine", "User") { + [Environment]::GetEnvironmentVariables($level).GetEnumerator() | % { + # For Path variables, append the new values, if they're not already in there + if ($_.Name -Match 'Path$') { + $_.Value = ($((Get-Content "Env:$($_.Name)") + ";$($_.Value)") -Split ';' | Select -Unique) -Join ';' + } + $_ + } | Set-Content -Path { "Env:$($_.Name)" } + } + } + + Install-Binary -Url "https://swift.org/builds/${{ matrix.branch }}/windows10/swift-${{ matrix.tag }}/swift-${{ matrix.tag }}-windows10.exe" -Name "installer.exe" -ArgumentList ("-q") + Update-EnvironmentVariables + # Reset Path and environment + echo "$env:Path" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 + Get-ChildItem Env: | % { echo "$($_.Name)=$($_.Value)" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append } + + - name: Run tests + run: swift test -v --enable-test-discovery diff --git a/Tests/ReportingTests/LintResultsTests.swift b/Tests/ReportingTests/LintResultsTests.swift index ae91449..c30eefa 100644 --- a/Tests/ReportingTests/LintResultsTests.swift +++ b/Tests/ReportingTests/LintResultsTests.swift @@ -334,7 +334,6 @@ final class LintResultsTests: XCTestCase { XCTAssert(encodedString.contains(#""discoverDate" : "2001-01-01T01:00:00Z","#)) XCTAssert(encodedString.contains(#""matchedString" : "A""#)) XCTAssert(encodedString.contains(#""filePath" : "\/some\/path""#)) - XCTAssert(encodedString.contains(#""discoverDate" : "2001-01-01T02:00:00Z","#)) let decodedLintResults = try JSONDecoder.iso.decode(LintResults.self, from: encodedData) XCTAssertNoDifference(decodedLintResults, lintResults)