From d35efde454969425e9a89040300fff170ec450d9 Mon Sep 17 00:00:00 2001 From: Alexander-Block <47148212+Alexander-Block@users.noreply.github.com> Date: Sun, 24 Mar 2024 01:25:52 +0100 Subject: [PATCH 1/2] Add CI workflow for Windows --- .github/workflows/windowsCI.yml | 64 ++++++++++++++++++++++++++ APLSource/TestCases/Prepare.aplf | 6 +-- APLSource/TestCases/RunTestsForCI.aplf | 22 +++++++++ 3 files changed, 89 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/windowsCI.yml create mode 100644 APLSource/TestCases/RunTestsForCI.aplf diff --git a/.github/workflows/windowsCI.yml b/.github/workflows/windowsCI.yml new file mode 100644 index 00000000..49027051 --- /dev/null +++ b/.github/workflows/windowsCI.yml @@ -0,0 +1,64 @@ +name: Windows CI + +on: + workflow_dispatch: + + push: + branches: + - main + + pull_request: + branches: + -main + +env: + DYALOG_NETCORE: 1 + +jobs: + linux: + name: "CI - Windows - Dyalog APL 19.0 with .NET 8.x" + runs-on: windows-latest + timeout-minutes: + 10 + steps: + - name: Install Dyalog APL + run: | + $downloadLinks = (Invoke-WebRequest https://www.dyalog.com/download-zone.htm?p=download).Links.href + $winDownloadLink = $downloadLinks | Where-Object { $_ -match "19\.0.*Windows" } + $winDownloadLink -match "download\.dyalog\.com.*" > $null + $winDownloadLink = $matches[0] + $client = New-Object System.Net.WebClient + $client.DownloadFile("https:\\$($winDownloadLink)", ".\windows_64_19.0.48959_unicode.zip") + Expand-Archive -Force .\windows_64_19.0.48959_unicode.zip .\windows_64_19.0.48959_unicode + cd .\windows_64_19.0.48959_unicode + $curPath = (Get-Location).ToString() + $msiPath = "$($curPath)\setup_64_unicode.msi" + $logFile = "$($curPath)\install_log.txt" + $MSIArguments = @("ALLUSERS=1", "/passive", "FROMGUI=1", "/i $($msiPath)", "/qn", "/norestart", "/L*v $($logFile)" ) + Start-Process "msiexec.exe" -ArgumentList $MSIArguments -Wait -NoNewWindow + - name: Setup .NET + uses: actions/setup-dotnet@v4 + with: + dotnet-version: "8.x" + - name: Activate Tatin and Cider + run: | + C: + cd "C:\\Program Files\\Dyalog\\Dyalog APL-64 19.0 Unicode" + .\dyalog.exe -b -s LX="⎕SE.UCMD 'Tools.Activate all' ⋄ ⎕OFF" + - name: Checkout repository + uses: actions/checkout@v4 + - name: Run tests + run: | + runTest="⎕PW←500" + runTest="${runTest} ⋄ ⎕SE.UCMD 'Cider.Version'" + runTest="${runTest} ⋄ ⎕SE.Cider.DEVELOPMENT←1" + runTest="${runTest} ⋄ opts←⎕NS '' ⋄ opts.(batch checkPackageVersions folder)←1 0 '.'" + runTest="${runTest} ⋄ ⎕SE.Cider.OpenProject opts" + runTest="${runTest} ⋄ #.Cider.TestCases.RunTestsForCI ⋄ ⎕OFF 1" + LX="${runTest}" "C:\\Program Files\\Dyalog\\Dyalog APL-64 19.0 Unicode\\dyalog.exe" -b -s + shell: bash + - name: Upload code coverage report + uses: actions/upload-artifact@v4 + with: + name: code-coverage-report + path: .\TestResults\CodeCoverage.html \ No newline at end of file diff --git a/APLSource/TestCases/Prepare.aplf b/APLSource/TestCases/Prepare.aplf index 68b3bdf6..46506788 100644 --- a/APLSource/TestCases/Prepare.aplf +++ b/APLSource/TestCases/Prepare.aplf @@ -11,17 +11,17 @@ flag←0 :If ⎕NEXISTS testPath :If ⎕NEXISTS testFilename,'.profile' - ind←('Code Coverage' 0 1)CommTools.Select'Append' 'Replace' 'Neither' + ind←('CodeCoverageExists@Code Coverage' 0 1)CommTools.Select'Append' 'Replace' 'Neither' →(3=ind)/0 flag←1 :If 2=ind 1 CodeCoverage.DeleteFiles testFilename :EndIf :Else - flag←0 CommTools.YesOrNo'Code coverage?' + flag←0 CommTools.YesOrNo'CodeCoverage@Code coverage?' :EndIf :Else - flag←0 CommTools.YesOrNo'Code coverage?' + flag←0 CommTools.YesOrNo'CodeCoverage@Code coverage?' :EndIf :If flag 3 ⎕MKDIR testPath ⍝ diff --git a/APLSource/TestCases/RunTestsForCI.aplf b/APLSource/TestCases/RunTestsForCI.aplf new file mode 100644 index 00000000..6c6684d5 --- /dev/null +++ b/APLSource/TestCases/RunTestsForCI.aplf @@ -0,0 +1,22 @@ + RunTestsForCI;rc;log + ⍝ Runs all test with the batch flag on and the debug flag off, + ⍝ prints the messages from the test run + ⍝ and closes the APL session with return code 0 if the test run + ⍝ was successful and return code 1 if not.\\ + ⍝ This test runner function is meant to be used for a CI + ⍝ pipeline. + + ⍝ Always produce code coverage report + CommTools.YesOrNo_Answers←1 2⍴'CodeCoverage@' 'y' + ⍝ Always replace a code coverage report if it is already present + CommTools.Select_Choices←1 2⍴'CodeCoverageExists@' 2 + Prepare + (rc log)←T.RunBatchTests 0 + ⎕←↑log + + :If 0<≢T.codeCoverage + {}CodeCoverage.ProcessData T.codeCoverage.filename + {}1 CodeCoverage.CreateReport T.codeCoverage.filename + :EndIf + + ⎕OFF rc From 54663583182015b5a4332b964169452b4dd66001 Mon Sep 17 00:00:00 2001 From: Alexander-Block <47148212+Alexander-Block@users.noreply.github.com> Date: Sun, 24 Mar 2024 01:34:30 +0100 Subject: [PATCH 2/2] always upload code coverage report --- .github/workflows/windowsCI.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/windowsCI.yml b/.github/workflows/windowsCI.yml index 49027051..31e4a97f 100644 --- a/.github/workflows/windowsCI.yml +++ b/.github/workflows/windowsCI.yml @@ -58,6 +58,7 @@ jobs: LX="${runTest}" "C:\\Program Files\\Dyalog\\Dyalog APL-64 19.0 Unicode\\dyalog.exe" -b -s shell: bash - name: Upload code coverage report + if: always() uses: actions/upload-artifact@v4 with: name: code-coverage-report