From f67eefbfe01e65c20bc69dd8ff49749a91bac691 Mon Sep 17 00:00:00 2001 From: "Artem V. Ageev" Date: Tue, 14 Jan 2025 10:19:03 +0200 Subject: [PATCH 01/17] Rewrote CI to Pascal --- .github/workflows/make.json | 7 -- .github/workflows/make.pas | 174 +++++++++++++++++++++++++++++++++ .github/workflows/make.ps1 | 187 ------------------------------------ .github/workflows/make.sh | 112 --------------------- .github/workflows/make.yml | 22 +++-- 5 files changed, 187 insertions(+), 315 deletions(-) delete mode 100644 .github/workflows/make.json create mode 100644 .github/workflows/make.pas delete mode 100644 .github/workflows/make.ps1 delete mode 100644 .github/workflows/make.sh diff --git a/.github/workflows/make.json b/.github/workflows/make.json deleted file mode 100644 index d79b0f0..0000000 --- a/.github/workflows/make.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "app" : "SimpleBaseLib.Benchmark/FreePascal.Benchmark", - "lib" : "SimpleBaseLib/src/Packages/FPC/", - "tst" : "SimpleBaseLib.Tests/FreePascal.Tests/SimpleBaseLibConsole.Tests.lpi", - "pkg" : [ - ] -} diff --git a/.github/workflows/make.pas b/.github/workflows/make.pas new file mode 100644 index 0000000..a4ef829 --- /dev/null +++ b/.github/workflows/make.pas @@ -0,0 +1,174 @@ +program Make; +{$mode objfpc}{$H+} + +uses + Classes, + SysUtils, + StrUtils, + FileUtil, + Zipper, + fphttpclient, + openssl, + opensslsockets, + Process; + +const + Src: string = 'SimpleBaseLib.Benchmark/FreePascal.Benchmark'; + Use: string = 'SimpleBaseLib/src/Packages/FPC/'; + Tst: string = 'SimpleBaseLibConsole.Tests.lpi'; + Pkg: array of string = (); + +var + Each, Item, PackagePath, TempFile, Url: string; + Output, Line: ansistring; + List: TStringList; + Zip: TStream; + +begin + InitSSLInterface; + if FileExists('.gitmodules') then + if RunCommand('git', ['submodule', 'update', '--init', '--recursive', + '--force', '--remote'], Output) then + Writeln(#27'[33m', Output, #27'[0m') + else + begin + ExitCode += 1; + Writeln(#27'[31m', Output, #27'[0m'); + end; + List := FindAllFiles(Use, '*.lpk', True); + try + for Each in List do + if RunCommand('lazbuild', ['--add-package-link', Each], Output) then + Writeln(#27'[33m', 'added ', Each, #27'[0m') + else + begin + ExitCode += 1; + Writeln(#27'[31m', 'added ', Each, #27'[0m'); + end; + finally + List.Free; + end; + for Each in Pkg do + begin + PackagePath := + {$IFDEF MSWINDOWS} + GetEnvironmentVariable('APPDATA') + '\.lazarus\onlinepackagemanager\packages\' + {$ELSE} + GetEnvironmentVariable('HOME') + '/.lazarus/onlinepackagemanager/packages/' + {$ENDIF} + + Each; + TempFile := GetTempFileName; + Url := 'https://packages.lazarus-ide.org/' + Each + '.zip'; + if not DirectoryExists(PackagePath) then + begin + Zip := TFileStream.Create(TempFile, fmCreate or fmOpenWrite); + with TFPHttpClient.Create(nil) do + begin + try + AddHeader('User-Agent', 'Mozilla/5.0 (compatible; fpweb)'); + AllowRedirect := True; + Get(Url, Zip); + WriteLn('Download from ', Url, ' to ', TempFile); + finally + Free; + end; + end; + Zip.Free; + CreateDir(PackagePath); + with TUnZipper.Create do + begin + try + FileName := TempFile; + OutputPath := PackagePath; + Examine; + UnZipAllFiles; + WriteLn('Unzip from ', TempFile, ' to ', PackagePath); + finally + Free; + end; + end; + DeleteFile(TempFile); + List := FindAllFiles(PackagePath, '*.lpk', True); + try + for Item in List do + try + if RunCommand('lazbuild', ['--add-package-link', Item], Output) then + Writeln(#27'[33m', 'added ', Item, #27'[0m') + else + begin + ExitCode += 1; + Writeln(#27'[31m', 'added ', Item, #27'[0m'); + end; + except + on E: Exception do + WriteLn('Error: ' + E.ClassName + #13#10 + E.Message); + end; + finally + List.Free; + end; + end; + end; + List := FindAllFiles('.', Tst, True); + try + for Each in List do + begin + Writeln(#27'[33m', 'build ', Each, #27'[0m'); + try + if RunCommand('lazbuild', ['--build-all', '--recursive', + '--no-write-project', Each], Output) then + for Line in SplitString(Output, LineEnding) do + begin + if Pos('Linking', Line) <> 0 then + begin + if not RunCommand( + {$IFDEF MSWINDOWS} + '&' + {$ELSE} + 'command' + {$ENDIF} + , [SplitString(Line, ' ')[2], '--all', '--format=plain', '--progress'], + Output) then + ExitCode += 1; + WriteLn(Output); + end; + end + else + for Line in SplitString(Output, LineEnding) do + if Pos('Fatal', Line) <> 0 or Pos('Error', Line) then + Writeln(#27'[31m', Line, #27'[0m'); + except + on E: Exception do + WriteLn('Error: ' + E.ClassName + #13#10 + E.Message); + end; + end; + finally + List.Free; + end; + List := FindAllFiles(Src, '*.lpi', True); + try + for Each in List do + begin + Write(#27'[33m', 'build from ', Each, #27'[0m'); + if RunCommand('lazbuild', ['--build-all', '--recursive', + '--no-write-project', Each], Output) then + for Line in SplitString(Output, LineEnding) do + begin + if Pos('Linking', Line) <> 0 then + Writeln(#27'[32m', ' to ', SplitString(Line, ' ')[2], #27'[0m'); + end + else + begin + ExitCode += 1; + for Line in SplitString(Output, LineEnding) do + if Pos('Fatal:', Line) <> 0 or Pos('Error:', Line) then + begin + WriteLn(); + Writeln(#27'[31m', Line, #27'[0m'); + end; + end; + end; + finally + List.Free; + end; + WriteLn('Errors: ', ExitCode); +end. diff --git a/.github/workflows/make.ps1 b/.github/workflows/make.ps1 deleted file mode 100644 index 5458c87..0000000 --- a/.github/workflows/make.ps1 +++ /dev/null @@ -1,187 +0,0 @@ -#!/usr/bin/env pwsh -############################################################################################################## - -Function Show-Usage { - " -vagrant = 'it-gro/win10-ltsc-eval' -download = 'https://microsoft.com/en-us/evalcenter' -package = 'https://learn.microsoft.com/en-us/mem/configmgr/develop/apps/how-to-create-the-windows-installer-file-msi' -shell = 'https://learn.microsoft.com/en-us/powershell' - -Usage: pwsh -File $($PSCommandPath) [OPTIONS] -Options: - build - lint -" | Out-Host -} - -Function Build-Project { - New-Variable -Option Constant -Name VAR -Value (Get-Content -Path $PSCommandPath.Replace('ps1', 'json') | ConvertFrom-Json) - If (! (Test-Path -Path $Var.app)) { - "$([char]27)[31m.... $($Var.app) did not find!$([char]27)[0m" | Out-Host - Exit 1 - } - If (Test-Path -Path '.gitmodules') { - & git submodule update --init --recursive --force --remote | Out-Host - "$([char]27)[33m.... [[$($LastExitCode)]] git submodule update$([char]27)[0m" | Out-Host - } - @( - @{ - Cmd = 'lazbuild' - Url = 'https://fossies.org/windows/misc/lazarus-3.6-fpc-3.2.2-win64.exe' - Path = "C:\Lazarus" - } - ) | Where-Object { - ! (Test-Path -Path $_.Path) - } | ForEach-Object { - $_.Url | Request-File | Install-Program - $Env:PATH+=";$($_.Path)" - Return (Get-Command $_.Cmd).Source - } | Out-Host - $VAR.Pkg | ForEach-Object { - @{ - Name = $_ - Uri = "https://packages.lazarus-ide.org/$($_).zip" - Path = "$($Env:HOME)\.lazarus\onlinepackagemanager\packages\$($_)" - OutFile = (New-TemporaryFile).FullName - } - } | Where-Object { - ! (Test-Path -Path $_.Path) && - ! (& lazbuild --verbose-pkgsearch $_.Name ) && - ! (& lazbuild --add-package $_.Name) - } | ForEach-Object -Parallel { - Invoke-WebRequest -OutFile $_.OutFile -Uri $_.Uri - New-Item -Type Directory -Path $_.Path | Out-Null - Expand-Archive -Path $_.OutFile -DestinationPath $_.Path - Remove-Item $_.OutFile - (Get-ChildItem -Filter '*.lpk' -Recurse -File –Path $_.Path).FullName | - ForEach-Object { - & lazbuild --add-package-link $_ | Out-Null - Return "$([char]27)[33m.... [$($LastExitCode)] add package link $($_)$([char]27)[0m" - } - } | Out-Host - If (Test-Path -Path $VAR.lib) { - (Get-ChildItem -Filter '*.lpk' -Recurse -File –Path $VAR.lib).FullName | - ForEach-Object { - & lazbuild --add-package-link $_ | Out-Null - Return "$([char]27)[33m.... [$($LastExitCode)] add package link $($_)$([char]27)[0m" - } | Out-Host - } - Exit $(Switch (Test-Path -Path $Var.tst) { - true { - $Output = ( - & lazbuild --build-all --recursive --no-write-project $VAR.tst | - Where-Object { - $_.Contains('Linking') - } | ForEach-Object { - $_.Split(' ')[2].Replace('bin', 'bin\.') - } - ) - $Output = (& $Output --all --format=plain --progress) - $exitCode = Switch ($LastExitCode) { - 0 {0} - Default { - 1 - } - } - $Output | Out-Host - Return $exitCode -K } - Default {0} - }) + ( - (Get-ChildItem -Filter '*.lpi' -Recurse -File –Path $Var.app).FullName | - ForEach-Object { - $Output = (& lazbuild --build-all --recursive --no-write-project $_) - $Result = @("$([char]27)[32m.... [$($LastExitCode)] build project $($_)$([char]27)[0m") - $exitCode = $(Switch ($LastExitCode) { - 0 { - $Result += $Output | Select-String -Pattern 'Linking' - 0 - } - Default { - $Result += $Output | Select-String -Pattern 'Error:', 'Fatal:' - 1 - } - }) - $Result | Out-Host - Return $exitCode - } | Measure-Object -Sum - ).Sum -} - -Function Request-File { - While ($Input.MoveNext()) { - New-Variable -Option Constant -Name VAR -Value @{ - Uri = $Input.Current - OutFile = (Split-Path -Path $Input.Current -Leaf).Split('?')[0] - } - Invoke-WebRequest @VAR - Return $VAR.OutFile - } -} - -Function Install-Program { - While ($Input.MoveNext()) { - Switch ((Split-Path -Path $Input.Current -Leaf).Split('.')[-1]) { - 'msi' { - & msiexec /passive /package $Input.Current | Out-Null - } - Default { - & ".\$($Input.Current)" /SP- /VERYSILENT /SUPPRESSMSGBOXES /NORESTART | Out-Null - } - } - Remove-Item $Input.Current - } -} - -Function Request-URL([Switch] $Post) { - $VAR = Switch ($Post) { - true { - @{ - Method = 'POST' - Headers = @{ - ContentType = 'application/json' - } - Uri = 'https://postman-echo.com/post' - Body = @{ - One = '1' - } | ConvertTo-Json - } - } - false { - @{ - Uri = 'https://postman-echo.com/get' - } - } - } - Return (Invoke-WebRequest @VAR | ConvertFrom-Json).Headers -} - -Function Switch-Action { - $ErrorActionPreference = 'stop' - Set-PSDebug -Strict #-Trace 1 - Invoke-ScriptAnalyzer -EnableExit -Path $PSCommandPath - If ($args.count -gt 0) { - Switch ($args[0]) { - 'lint' { - Invoke-ScriptAnalyzer -EnableExit -Recurse -Path '.' - (Get-ChildItem -Filter '*.ps1' -Recurse -Path '.').FullName | - ForEach-Object { - Invoke-Formatter -ScriptDefinition $(Get-Content -Path $_ | Out-String) | - Set-Content -Path $_ - } - } - 'build' { - Build-Project - } - Default { - Show-Usage - } - } - } Else { - Show-Usage - } -} - -############################################################################################################## -Switch-Action @args diff --git a/.github/workflows/make.sh b/.github/workflows/make.sh deleted file mode 100644 index 04643b4..0000000 --- a/.github/workflows/make.sh +++ /dev/null @@ -1,112 +0,0 @@ -#!/usr/bin/env bash -############################################################################################################## - -function priv_clippit -( - cat <&2 - if [[ -f '.gitmodules' ]]; then - git submodule update --init --recursive --force --remote & - fi - if ! (command -v lazbuild); then - # shellcheck source=/dev/null - source '/etc/os-release' - case ${ID:?} in - debian | ubuntu) - sudo apt-get update - sudo apt-get install -y lazarus{-ide-qt5,} & - ;; - esac - fi &>/dev/null - wait - while read -r; do - ( - declare -rA TMP=( - [url]="https://packages.lazarus-ide.org/${REPLY}.zip" - [dir]="${HOME}/.lazarus/onlinepackagemanager/packages/${REPLY}" - [out]=$(mktemp) - ) - if ! [[ -d "${TMP[dir]}" ]] && - ! (lazbuild --verbose-pkgsearch "${REPLY}") && - ! (lazbuild --add-package "${REPLY}"); then - wget --quiet --output-document "${TMP[out]}" "${TMP[url]}" - mkdir --parents "${TMP[dir]}" - unzip -o "${TMP[out]}" -d "${TMP[dir]}" - rm --verbose "${TMP[out]}" - find "${TMP[dir]}" -type 'f' -name '*.lpk' -printf '\033[33m\tadd package link\t%p\033[0m\n' -exec \ - lazbuild --add-package-link {} + >&2 - fi - ) & - done < <(jq --raw-output --exit-status '.pkg[]' <<< "${MAPFILE[@]}") - wait - if [[ -d "${VAR[lib]}" ]]; then - find "${VAR[lib]}" -type 'f' -name '*.lpk' -printf '\033[33m\tadd package link\t%p\033[0m\n' -exec \ - lazbuild --add-package-link {} + >&2 - fi - declare -i exitCode=0 - if [[ -f "${VAR[tst]}" ]]; then - declare -A TMP=( - [tst]=$( - lazbuild --build-all --recursive --no-write-project "${VAR[tst]}" | - awk '/Linking/{print $3}' - ) - ) - if ! ("${TMP[tst]}" --all --format=plain --progress >&2); then - ((exitCode+=1)) - fi - fi - while read -r; do - declare -A TMP=( - [out]=$(mktemp) - ) - if (lazbuild --build-all --recursive --no-write-project "${REPLY}" > "${TMP[out]}"); then - printf '\x1b[32m\t[%s]\t%s\x1b[0m\n' "${?}" "${REPLY}" - grep --color='always' 'Linking' "${TMP[out]}" - else - printf '\x1b[31m\t[%s]\t%s\x1b[0m\n' "${?}" "${REPLY}" - grep --color='always' --extended-regexp '(Error|Fatal):' "${TMP[out]}" - ((exitCode+=1)) - fi >&2 - rm "${TMP[out]}" - done < <(find "${VAR[app]}" -type 'f' -name '*.lpi') - exit "${exitCode}" -) - -function priv_main -( - set -euo pipefail - if ((${#})); then - case ${1} in - build) priv_lazbuild ;; - *) priv_clippit ;; - esac - else - priv_clippit - fi -) - -############################################################################################################## -priv_main "${@}" >/dev/null diff --git a/.github/workflows/make.yml b/.github/workflows/make.yml index 006d55c..fe86e6c 100644 --- a/.github/workflows/make.yml +++ b/.github/workflows/make.yml @@ -34,16 +34,20 @@ jobs: - name: Build on Linux if: runner.os == 'Linux' shell: bash - run: bash .github/workflows/make.sh build + run: | + sudo bash -c 'apt-get update; apt-get install -y lazarus' >/dev/null + instantfpc -Fu/usr/lib/lazarus/*/components/lazutils .github/workflows/make.pas - name: Build on Windows if: runner.os == 'Windows' shell: powershell - run: pwsh -File .github/workflows/make.ps1 build - - - name: Archive - if: runner.os == 'Windows' - uses: actions/upload-artifact@v4 - with: - retention-days: 1 - path: src\bin\*.exe + run: | + New-Variable -Option Constant -Name VAR -Value @{ + Uri = 'https://fossies.org/windows/misc/lazarus-3.6-fpc-3.2.2-win64.exe' + OutFile = (New-TemporaryFile).FullName + } + Invoke-WebRequest @VAR + & $_.OutFile.Replace('Temp', 'Temp\.') /SP- /VERYSILENT /SUPPRESSMSGBOXES /NORESTART | Out-Null + $Env:PATH+=';C:\Lazarus' + (Get-Command 'lazbuild').Source | Out-Host + instantfpc '-FuC:\Lazarus\components\lazutils' .github/workflows/make.pas From 71b9573dfe6031d2d6460e5d1edf21e3338f0a44 Mon Sep 17 00:00:00 2001 From: "Artem V. Ageev" Date: Tue, 14 Jan 2025 10:23:05 +0200 Subject: [PATCH 02/17] on log --- .github/workflows/make.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/make.yml b/.github/workflows/make.yml index fe86e6c..f758cdd 100644 --- a/.github/workflows/make.yml +++ b/.github/workflows/make.yml @@ -35,6 +35,7 @@ jobs: if: runner.os == 'Linux' shell: bash run: | + set -xeuo pipefail sudo bash -c 'apt-get update; apt-get install -y lazarus' >/dev/null instantfpc -Fu/usr/lib/lazarus/*/components/lazutils .github/workflows/make.pas From 44aa6e6f11a6ae9c9fd75a74b7312bd844f1d2a1 Mon Sep 17 00:00:00 2001 From: "Artem V. Ageev" Date: Tue, 14 Jan 2025 10:36:21 +0200 Subject: [PATCH 03/17] fix github-actions --- .github/workflows/make.pas | 59 +++++++++++++++++++++----------------- 1 file changed, 32 insertions(+), 27 deletions(-) diff --git a/.github/workflows/make.pas b/.github/workflows/make.pas index a4ef829..e731c83 100644 --- a/.github/workflows/make.pas +++ b/.github/workflows/make.pas @@ -29,21 +29,21 @@ if FileExists('.gitmodules') then if RunCommand('git', ['submodule', 'update', '--init', '--recursive', '--force', '--remote'], Output) then - Writeln(#27'[33m', Output, #27'[0m') + Writeln(stderr, #27'[33m', Output, #27'[0m') else begin ExitCode += 1; - Writeln(#27'[31m', Output, #27'[0m'); + Writeln(stderr, #27'[31m', Output, #27'[0m'); end; List := FindAllFiles(Use, '*.lpk', True); try for Each in List do if RunCommand('lazbuild', ['--add-package-link', Each], Output) then - Writeln(#27'[33m', 'added ', Each, #27'[0m') + Writeln(stderr, #27'[33m', 'added ', Each, #27'[0m') else begin ExitCode += 1; - Writeln(#27'[31m', 'added ', Each, #27'[0m'); + Writeln(stderr, #27'[31m', 'added ', Each, #27'[0m'); end; finally List.Free; @@ -68,7 +68,7 @@ AddHeader('User-Agent', 'Mozilla/5.0 (compatible; fpweb)'); AllowRedirect := True; Get(Url, Zip); - WriteLn('Download from ', Url, ' to ', TempFile); + WriteLn(stderr, 'Download from ', Url, ' to ', TempFile); finally Free; end; @@ -82,7 +82,7 @@ OutputPath := PackagePath; Examine; UnZipAllFiles; - WriteLn('Unzip from ', TempFile, ' to ', PackagePath); + WriteLn(stderr, 'Unzip from ', TempFile, ' to ', PackagePath); finally Free; end; @@ -93,15 +93,15 @@ for Item in List do try if RunCommand('lazbuild', ['--add-package-link', Item], Output) then - Writeln(#27'[33m', 'added ', Item, #27'[0m') + Writeln(stderr, #27'[33m', 'added ', Item, #27'[0m') else begin ExitCode += 1; - Writeln(#27'[31m', 'added ', Item, #27'[0m'); + Writeln(stderr, #27'[31m', 'added ', Item, #27'[0m'); end; except on E: Exception do - WriteLn('Error: ' + E.ClassName + #13#10 + E.Message); + WriteLn(stderr, 'Error: ' + E.ClassName + #13#10 + E.Message); end; finally List.Free; @@ -112,33 +112,38 @@ try for Each in List do begin - Writeln(#27'[33m', 'build ', Each, #27'[0m'); + Writeln(stderr, #27'[33m', 'build ', Each, #27'[0m'); try if RunCommand('lazbuild', ['--build-all', '--recursive', '--no-write-project', Each], Output) then for Line in SplitString(Output, LineEnding) do begin if Pos('Linking', Line) <> 0 then - begin - if not RunCommand( - {$IFDEF MSWINDOWS} - '&' - {$ELSE} - 'command' - {$ENDIF} - , [SplitString(Line, ' ')[2], '--all', '--format=plain', '--progress'], - Output) then - ExitCode += 1; - WriteLn(Output); + try + begin + if not RunCommand( + {$IFDEF MSWINDOWS} + '&' + {$ELSE} + 'command' + {$ENDIF} + , [SplitString(Line, ' ')[2], '--all', '--format=plain', '--progress'], + Output) then + ExitCode += 1; + WriteLn(stderr, Output); + end; + except + on E: Exception do + WriteLn(stderr, 'Error: ' + E.ClassName + #13#10 + E.Message); end; end else for Line in SplitString(Output, LineEnding) do if Pos('Fatal', Line) <> 0 or Pos('Error', Line) then - Writeln(#27'[31m', Line, #27'[0m'); + Writeln(stderr, #27'[31m', Line, #27'[0m'); except on E: Exception do - WriteLn('Error: ' + E.ClassName + #13#10 + E.Message); + WriteLn(stderr, 'Error: ' + E.ClassName + #13#10 + E.Message); end; end; finally @@ -154,7 +159,7 @@ for Line in SplitString(Output, LineEnding) do begin if Pos('Linking', Line) <> 0 then - Writeln(#27'[32m', ' to ', SplitString(Line, ' ')[2], #27'[0m'); + Writeln(stderr, #27'[32m', ' to ', SplitString(Line, ' ')[2], #27'[0m'); end else begin @@ -162,13 +167,13 @@ for Line in SplitString(Output, LineEnding) do if Pos('Fatal:', Line) <> 0 or Pos('Error:', Line) then begin - WriteLn(); - Writeln(#27'[31m', Line, #27'[0m'); + WriteLn(stderr); + Writeln(stderr, #27'[31m', Line, #27'[0m'); end; end; end; finally List.Free; end; - WriteLn('Errors: ', ExitCode); + WriteLn(stderr, 'Errors: ', ExitCode); end. From bedc92c0bbc90f8856c699cecf3d0ab132c0df35 Mon Sep 17 00:00:00 2001 From: "Artem V. Ageev" Date: Tue, 14 Jan 2025 10:38:29 +0200 Subject: [PATCH 04/17] fix github-actions --- .github/workflows/make.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/make.yml b/.github/workflows/make.yml index f758cdd..3440a7b 100644 --- a/.github/workflows/make.yml +++ b/.github/workflows/make.yml @@ -23,7 +23,7 @@ jobs: strategy: matrix: os: - - ubuntu-latest + # - ubuntu-latest - windows-latest steps: - name: Checkout From 6e4d456e82427a6a378359cfee2ca1abac2c181c Mon Sep 17 00:00:00 2001 From: "Artem V. Ageev" Date: Tue, 14 Jan 2025 13:19:54 +0200 Subject: [PATCH 05/17] fix github-actions --- .github/workflows/make.pas | 250 ++++++++++++++++++++----------------- 1 file changed, 137 insertions(+), 113 deletions(-) diff --git a/.github/workflows/make.pas b/.github/workflows/make.pas index e731c83..bed123f 100644 --- a/.github/workflows/make.pas +++ b/.github/workflows/make.pas @@ -18,162 +18,186 @@ Tst: string = 'SimpleBaseLibConsole.Tests.lpi'; Pkg: array of string = (); +type + Output = record + Code: integer; + Output: ansistring; + end; + var Each, Item, PackagePath, TempFile, Url: string; - Output, Line: ansistring; + Line: ansistring; + Answer: Output; List: TStringList; Zip: TStream; -begin - InitSSLInterface; - if FileExists('.gitmodules') then - if RunCommand('git', ['submodule', 'update', '--init', '--recursive', - '--force', '--remote'], Output) then - Writeln(stderr, #27'[33m', Output, #27'[0m') - else - begin - ExitCode += 1; - Writeln(stderr, #27'[31m', Output, #27'[0m'); - end; - List := FindAllFiles(Use, '*.lpk', True); - try - for Each in List do - if RunCommand('lazbuild', ['--add-package-link', Each], Output) then - Writeln(stderr, #27'[33m', 'added ', Each, #27'[0m') + procedure CheckModules; + begin + if FileExists('.gitmodules') then + if RunCommand('git', ['submodule', 'update', '--init', '--recursive', + '--force', '--remote'], Answer.Output) then + Writeln(stderr, #27'[33m', Answer.Output, #27'[0m') else begin ExitCode += 1; - Writeln(stderr, #27'[31m', 'added ', Each, #27'[0m'); + Writeln(stderr, #27'[31m', Answer.Output, #27'[0m'); end; - finally - List.Free; end; - for Each in Pkg do + + procedure AddPackage(Path: string); begin - PackagePath := - {$IFDEF MSWINDOWS} - GetEnvironmentVariable('APPDATA') + '\.lazarus\onlinepackagemanager\packages\' - {$ELSE} - GetEnvironmentVariable('HOME') + '/.lazarus/onlinepackagemanager/packages/' - {$ENDIF} - + Each; - TempFile := GetTempFileName; - Url := 'https://packages.lazarus-ide.org/' + Each + '.zip'; - if not DirectoryExists(PackagePath) then - begin - Zip := TFileStream.Create(TempFile, fmCreate or fmOpenWrite); - with TFPHttpClient.Create(nil) do - begin - try - AddHeader('User-Agent', 'Mozilla/5.0 (compatible; fpweb)'); - AllowRedirect := True; - Get(Url, Zip); - WriteLn(stderr, 'Download from ', Url, ' to ', TempFile); - finally - Free; + List := FindAllFiles(Use, '*.lpk', True); + try + for Each in List do + if RunCommand('lazbuild', ['--add-package-link', Each], Answer.Output) then + Writeln(stderr, #27'[33m', 'added ', Each, #27'[0m') + else + begin + ExitCode += 1; + Writeln(stderr, #27'[31m', 'added ', Each, #27'[0m'); end; - end; - Zip.Free; - CreateDir(PackagePath); - with TUnZipper.Create do + finally + List.Free; + end; + end; + + procedure AddOPM; + begin + InitSSLInterface; + for Each in Pkg do + begin + PackagePath := + {$IFDEF MSWINDOWS} + GetEnvironmentVariable('APPDATA') + '\.lazarus\onlinepackagemanager\packages\' + {$ELSE} + GetEnvironmentVariable('HOME') + '/.lazarus/onlinepackagemanager/packages/' + {$ENDIF} + + Each; + TempFile := GetTempFileName; + Url := 'https://packages.lazarus-ide.org/' + Each + '.zip'; + if not DirectoryExists(PackagePath) then begin - try - FileName := TempFile; - OutputPath := PackagePath; - Examine; - UnZipAllFiles; - WriteLn(stderr, 'Unzip from ', TempFile, ' to ', PackagePath); - finally - Free; + Zip := TFileStream.Create(TempFile, fmCreate or fmOpenWrite); + with TFPHttpClient.Create(nil) do + begin + try + AddHeader('User-Agent', 'Mozilla/5.0 (compatible; fpweb)'); + AllowRedirect := True; + Get(Url, Zip); + WriteLn(stderr, 'Download from ', Url, ' to ', TempFile); + finally + Free; + end; end; - end; - DeleteFile(TempFile); - List := FindAllFiles(PackagePath, '*.lpk', True); - try - for Item in List do - try - if RunCommand('lazbuild', ['--add-package-link', Item], Output) then - Writeln(stderr, #27'[33m', 'added ', Item, #27'[0m') - else - begin - ExitCode += 1; - Writeln(stderr, #27'[31m', 'added ', Item, #27'[0m'); + Zip.Free; + CreateDir(PackagePath); + with TUnZipper.Create do + begin + try + FileName := TempFile; + OutputPath := PackagePath; + Examine; + UnZipAllFiles; + WriteLn(stderr, 'Unzip from ', TempFile, ' to ', PackagePath); + finally + Free; end; - except - on E: Exception do - WriteLn(stderr, 'Error: ' + E.ClassName + #13#10 + E.Message); end; - finally - List.Free; + DeleteFile(TempFile); + AddPackage(PackagePath); end; end; end; - List := FindAllFiles('.', Tst, True); - try - for Each in List do - begin - Writeln(stderr, #27'[33m', 'build ', Each, #27'[0m'); - try - if RunCommand('lazbuild', ['--build-all', '--recursive', - '--no-write-project', Each], Output) then - for Line in SplitString(Output, LineEnding) do - begin + + procedure BuildProject(Path: string); + begin + Write(#27'[33m', 'build from ', Each, #27'[0m'); + try + if RunCommand('lazbuild', ['--build-all', '--recursive', + '--no-write-project', Each], Answer.Output) then + Answer.Code := 0 + else + begin + Answer.Code := 1; + ExitCode += Answer.Code; + end; + except + on E: Exception do + WriteLn(stderr, 'Error: ' + E.ClassName + #13#10 + E.Message); + end; + end; + + procedure RunTest; + begin + List := FindAllFiles('.', Tst, True); + try + for Each in List do + begin + BuildProject(Each); + WriteLn(stderr); + if Answer.Code <> 0 then + begin + for Line in SplitString(Answer.Output, LineEnding) do + if Pos('Fatal:', Line) <> 0 or Pos('Error:', Line) then + begin + WriteLn(stderr); + Writeln(stderr, #27'[31m', Line, #27'[0m'); + end; + end + else + for Line in SplitString(Answer.Output, LineEnding) do if Pos('Linking', Line) <> 0 then try begin - if not RunCommand( - {$IFDEF MSWINDOWS} - '&' - {$ELSE} - 'command' - {$ENDIF} - , [SplitString(Line, ' ')[2], '--all', '--format=plain', '--progress'], - Output) then + if not RunCommand('command', + [SplitString(Line, ' ')[2], '--all', '--format=plain', + '--progress'], Answer.Output) then ExitCode += 1; - WriteLn(stderr, Output); + WriteLn(stderr, Answer.Output); + break; end; except on E: Exception do WriteLn(stderr, 'Error: ' + E.ClassName + #13#10 + E.Message); end; - end - else - for Line in SplitString(Output, LineEnding) do - if Pos('Fatal', Line) <> 0 or Pos('Error', Line) then - Writeln(stderr, #27'[31m', Line, #27'[0m'); - except - on E: Exception do - WriteLn(stderr, 'Error: ' + E.ClassName + #13#10 + E.Message); end; + finally + List.Free; end; - finally - List.Free; end; + +begin + CheckModules; + AddPackage(Use); + AddOPM; + {$IFDEF LINUX} + RunTest; + {$ENDIF} List := FindAllFiles(Src, '*.lpi', True); try for Each in List do begin - Write(#27'[33m', 'build from ', Each, #27'[0m'); - if RunCommand('lazbuild', ['--build-all', '--recursive', - '--no-write-project', Each], Output) then - for Line in SplitString(Output, LineEnding) do - begin - if Pos('Linking', Line) <> 0 then - Writeln(stderr, #27'[32m', ' to ', SplitString(Line, ' ')[2], #27'[0m'); - end - else + BuildProject(Each); + if Answer.Code <> 0 then begin - ExitCode += 1; - for Line in SplitString(Output, LineEnding) do + for Line in SplitString(Answer.Output, LineEnding) do if Pos('Fatal:', Line) <> 0 or Pos('Error:', Line) then begin WriteLn(stderr); Writeln(stderr, #27'[31m', Line, #27'[0m'); end; - end; + end + else + for Line in SplitString(Answer.Output, LineEnding) do + if Pos('Linking', Line) <> 0 then + Writeln(stderr, #27'[32m', ' to ', SplitString(Line, ' ')[2], #27'[0m'); end; finally List.Free; end; - WriteLn(stderr, 'Errors: ', ExitCode); + WriteLn(stderr); + if ExitCode <> 0 then + WriteLn(stderr, #27'[31m', 'Errors: ', ExitCode, #27'[0m') + else + WriteLn(stderr, #27'[32m', 'Errors: ', ExitCode, #27'[0m'); end. From 3a8ffe84699dc5fce7f3796f5905fa4be8290fca Mon Sep 17 00:00:00 2001 From: "Artem V. Ageev" Date: Tue, 14 Jan 2025 13:20:56 +0200 Subject: [PATCH 06/17] fix github-actions --- .github/workflows/make.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/make.yml b/.github/workflows/make.yml index 3440a7b..f758cdd 100644 --- a/.github/workflows/make.yml +++ b/.github/workflows/make.yml @@ -23,7 +23,7 @@ jobs: strategy: matrix: os: - # - ubuntu-latest + - ubuntu-latest - windows-latest steps: - name: Checkout From 6bc8dff2c1177f6a1858e36fe22e094fcaf8ed30 Mon Sep 17 00:00:00 2001 From: "Artem V. Ageev" Date: Tue, 14 Jan 2025 15:36:23 +0200 Subject: [PATCH 07/17] fix github-actions --- .github/workflows/make.pas | 41 +++++++++++++++++++------------------- .github/workflows/make.yml | 16 --------------- 2 files changed, 21 insertions(+), 36 deletions(-) diff --git a/.github/workflows/make.pas b/.github/workflows/make.pas index bed123f..c154130 100644 --- a/.github/workflows/make.pas +++ b/.github/workflows/make.pas @@ -111,7 +111,7 @@ Output = record procedure BuildProject(Path: string); begin - Write(#27'[33m', 'build from ', Each, #27'[0m'); + Write(stderr, #27'[33m', 'build from ', Each, #27'[0m'); try if RunCommand('lazbuild', ['--build-all', '--recursive', '--no-write-project', Each], Answer.Output) then @@ -134,7 +134,6 @@ Output = record for Each in List do begin BuildProject(Each); - WriteLn(stderr); if Answer.Code <> 0 then begin for Line in SplitString(Answer.Output, LineEnding) do @@ -149,9 +148,10 @@ Output = record if Pos('Linking', Line) <> 0 then try begin - if not RunCommand('command', - [SplitString(Line, ' ')[2], '--all', '--format=plain', - '--progress'], Answer.Output) then + Writeln(stderr, #27'[32m', ' to ', SplitString(Line, ' ')[2], #27'[0m'); + if not RunCommand(ReplaceStr(SplitString(Line, ' ')[2], + SplitString(Tst, '.')[0], './' + SplitString(Tst, '.')[0]), + ['--all', '--format=plain', '--progress'], Answer.Output) then ExitCode += 1; WriteLn(stderr, Answer.Output); break; @@ -176,22 +176,23 @@ Output = record List := FindAllFiles(Src, '*.lpi', True); try for Each in List do - begin - BuildProject(Each); - if Answer.Code <> 0 then + if Pos(Tst, Each) = 0 then begin - for Line in SplitString(Answer.Output, LineEnding) do - if Pos('Fatal:', Line) <> 0 or Pos('Error:', Line) then - begin - WriteLn(stderr); - Writeln(stderr, #27'[31m', Line, #27'[0m'); - end; - end - else - for Line in SplitString(Answer.Output, LineEnding) do - if Pos('Linking', Line) <> 0 then - Writeln(stderr, #27'[32m', ' to ', SplitString(Line, ' ')[2], #27'[0m'); - end; + BuildProject(Each); + if Answer.Code <> 0 then + begin + for Line in SplitString(Answer.Output, LineEnding) do + if Pos('Fatal:', Line) <> 0 or Pos('Error:', Line) then + begin + WriteLn(stderr); + Writeln(stderr, #27'[31m', Line, #27'[0m'); + end; + end + else + for Line in SplitString(Answer.Output, LineEnding) do + if Pos('Linking', Line) <> 0 then + Writeln(stderr, #27'[32m', ' to ', SplitString(Line, ' ')[2], #27'[0m'); + end; finally List.Free; end; diff --git a/.github/workflows/make.yml b/.github/workflows/make.yml index f758cdd..d0e4bc0 100644 --- a/.github/workflows/make.yml +++ b/.github/workflows/make.yml @@ -24,7 +24,6 @@ jobs: matrix: os: - ubuntu-latest - - windows-latest steps: - name: Checkout uses: actions/checkout@v4 @@ -32,23 +31,8 @@ jobs: submodules: true - name: Build on Linux - if: runner.os == 'Linux' shell: bash run: | set -xeuo pipefail sudo bash -c 'apt-get update; apt-get install -y lazarus' >/dev/null instantfpc -Fu/usr/lib/lazarus/*/components/lazutils .github/workflows/make.pas - - - name: Build on Windows - if: runner.os == 'Windows' - shell: powershell - run: | - New-Variable -Option Constant -Name VAR -Value @{ - Uri = 'https://fossies.org/windows/misc/lazarus-3.6-fpc-3.2.2-win64.exe' - OutFile = (New-TemporaryFile).FullName - } - Invoke-WebRequest @VAR - & $_.OutFile.Replace('Temp', 'Temp\.') /SP- /VERYSILENT /SUPPRESSMSGBOXES /NORESTART | Out-Null - $Env:PATH+=';C:\Lazarus' - (Get-Command 'lazbuild').Source | Out-Host - instantfpc '-FuC:\Lazarus\components\lazutils' .github/workflows/make.pas From 8d064e136e39cb94781a74a831d2048c4176c474 Mon Sep 17 00:00:00 2001 From: "Artem V. Ageev" Date: Tue, 14 Jan 2025 15:38:25 +0200 Subject: [PATCH 08/17] fix github-actions --- .github/workflows/make.yml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/.github/workflows/make.yml b/.github/workflows/make.yml index d0e4bc0..f758cdd 100644 --- a/.github/workflows/make.yml +++ b/.github/workflows/make.yml @@ -24,6 +24,7 @@ jobs: matrix: os: - ubuntu-latest + - windows-latest steps: - name: Checkout uses: actions/checkout@v4 @@ -31,8 +32,23 @@ jobs: submodules: true - name: Build on Linux + if: runner.os == 'Linux' shell: bash run: | set -xeuo pipefail sudo bash -c 'apt-get update; apt-get install -y lazarus' >/dev/null instantfpc -Fu/usr/lib/lazarus/*/components/lazutils .github/workflows/make.pas + + - name: Build on Windows + if: runner.os == 'Windows' + shell: powershell + run: | + New-Variable -Option Constant -Name VAR -Value @{ + Uri = 'https://fossies.org/windows/misc/lazarus-3.6-fpc-3.2.2-win64.exe' + OutFile = (New-TemporaryFile).FullName + } + Invoke-WebRequest @VAR + & $_.OutFile.Replace('Temp', 'Temp\.') /SP- /VERYSILENT /SUPPRESSMSGBOXES /NORESTART | Out-Null + $Env:PATH+=';C:\Lazarus' + (Get-Command 'lazbuild').Source | Out-Host + instantfpc '-FuC:\Lazarus\components\lazutils' .github/workflows/make.pas From 9e64558ce22b024fd997e2627563abe574ac7580 Mon Sep 17 00:00:00 2001 From: "Artem V. Ageev" Date: Tue, 14 Jan 2025 15:45:08 +0200 Subject: [PATCH 09/17] fix github-actions --- .github/workflows/make.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/make.yml b/.github/workflows/make.yml index f758cdd..eac7eee 100644 --- a/.github/workflows/make.yml +++ b/.github/workflows/make.yml @@ -48,7 +48,7 @@ jobs: OutFile = (New-TemporaryFile).FullName } Invoke-WebRequest @VAR - & $_.OutFile.Replace('Temp', 'Temp\.') /SP- /VERYSILENT /SUPPRESSMSGBOXES /NORESTART | Out-Null + & $VAR.OutFile.Replace('Temp', 'Temp\.') /SP- /VERYSILENT /SUPPRESSMSGBOXES /NORESTART | Out-Null $Env:PATH+=';C:\Lazarus' (Get-Command 'lazbuild').Source | Out-Host instantfpc '-FuC:\Lazarus\components\lazutils' .github/workflows/make.pas From 97868178bffe2bfe21b54fc50d108d5f2b8d28b4 Mon Sep 17 00:00:00 2001 From: "Artem V. Ageev" Date: Tue, 14 Jan 2025 15:51:19 +0200 Subject: [PATCH 10/17] fix github-actions --- .github/workflows/make.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/make.yml b/.github/workflows/make.yml index eac7eee..f25144a 100644 --- a/.github/workflows/make.yml +++ b/.github/workflows/make.yml @@ -45,7 +45,7 @@ jobs: run: | New-Variable -Option Constant -Name VAR -Value @{ Uri = 'https://fossies.org/windows/misc/lazarus-3.6-fpc-3.2.2-win64.exe' - OutFile = (New-TemporaryFile).FullName + OutFile = (New-TemporaryFile).FullName + '.exe' } Invoke-WebRequest @VAR & $VAR.OutFile.Replace('Temp', 'Temp\.') /SP- /VERYSILENT /SUPPRESSMSGBOXES /NORESTART | Out-Null From b6746fe0d83350441277cf3b28e6ccad69abb538 Mon Sep 17 00:00:00 2001 From: "Artem V. Ageev" Date: Tue, 14 Jan 2025 20:29:06 +0200 Subject: [PATCH 11/17] fix github-actions --- .github/workflows/make.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/make.yml b/.github/workflows/make.yml index f25144a..9cdedd0 100644 --- a/.github/workflows/make.yml +++ b/.github/workflows/make.yml @@ -23,7 +23,7 @@ jobs: strategy: matrix: os: - - ubuntu-latest + # - ubuntu-latest - windows-latest steps: - name: Checkout @@ -51,4 +51,5 @@ jobs: & $VAR.OutFile.Replace('Temp', 'Temp\.') /SP- /VERYSILENT /SUPPRESSMSGBOXES /NORESTART | Out-Null $Env:PATH+=';C:\Lazarus' (Get-Command 'lazbuild').Source | Out-Host - instantfpc '-FuC:\Lazarus\components\lazutils' .github/workflows/make.pas + dir C:\Lazarus\fpc\bin + # instantfpc '-FuC:\Lazarus\components\lazutils' .github/workflows/make.pas From dea6dc34ca16ce77ad5fc229cfbdc776d6ef5130 Mon Sep 17 00:00:00 2001 From: "Artem V. Ageev" Date: Tue, 14 Jan 2025 20:50:53 +0200 Subject: [PATCH 12/17] fix github-actions --- .github/workflows/make.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/make.yml b/.github/workflows/make.yml index 9cdedd0..e131936 100644 --- a/.github/workflows/make.yml +++ b/.github/workflows/make.yml @@ -51,5 +51,5 @@ jobs: & $VAR.OutFile.Replace('Temp', 'Temp\.') /SP- /VERYSILENT /SUPPRESSMSGBOXES /NORESTART | Out-Null $Env:PATH+=';C:\Lazarus' (Get-Command 'lazbuild').Source | Out-Host - dir C:\Lazarus\fpc\bin + dir C:\Lazarus # instantfpc '-FuC:\Lazarus\components\lazutils' .github/workflows/make.pas From 669d580c544494ab6fefa8be7bd0aae0a513c347 Mon Sep 17 00:00:00 2001 From: "Artem V. Ageev" Date: Tue, 14 Jan 2025 20:58:59 +0200 Subject: [PATCH 13/17] fix github-actions --- .github/workflows/make.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/make.yml b/.github/workflows/make.yml index e131936..fe4f1ff 100644 --- a/.github/workflows/make.yml +++ b/.github/workflows/make.yml @@ -51,5 +51,6 @@ jobs: & $VAR.OutFile.Replace('Temp', 'Temp\.') /SP- /VERYSILENT /SUPPRESSMSGBOXES /NORESTART | Out-Null $Env:PATH+=';C:\Lazarus' (Get-Command 'lazbuild').Source | Out-Host - dir C:\Lazarus + dir C:\Lazarus\fpc + dir C:\Lazarus\components # instantfpc '-FuC:\Lazarus\components\lazutils' .github/workflows/make.pas From eccacf5cdb312b4924e67278e762c04242d1255a Mon Sep 17 00:00:00 2001 From: "Artem V. Ageev" Date: Tue, 14 Jan 2025 21:08:55 +0200 Subject: [PATCH 14/17] fix github-actions --- .github/workflows/make.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/make.yml b/.github/workflows/make.yml index fe4f1ff..e6669a8 100644 --- a/.github/workflows/make.yml +++ b/.github/workflows/make.yml @@ -51,6 +51,5 @@ jobs: & $VAR.OutFile.Replace('Temp', 'Temp\.') /SP- /VERYSILENT /SUPPRESSMSGBOXES /NORESTART | Out-Null $Env:PATH+=';C:\Lazarus' (Get-Command 'lazbuild').Source | Out-Host - dir C:\Lazarus\fpc - dir C:\Lazarus\components + dir C:\Lazarus\fpc\3.2.2\ # instantfpc '-FuC:\Lazarus\components\lazutils' .github/workflows/make.pas From b3af62ac633899da5d39830b78d68cf49f1f9aed Mon Sep 17 00:00:00 2001 From: "Artem V. Ageev" Date: Tue, 14 Jan 2025 21:20:32 +0200 Subject: [PATCH 15/17] fix github-actions --- .github/workflows/make.pas | 1 + .github/workflows/make.yml | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/make.pas b/.github/workflows/make.pas index c154130..463f8b8 100644 --- a/.github/workflows/make.pas +++ b/.github/workflows/make.pas @@ -8,6 +8,7 @@ FileUtil, Zipper, fphttpclient, + RegExpr, openssl, opensslsockets, Process; diff --git a/.github/workflows/make.yml b/.github/workflows/make.yml index e6669a8..8248668 100644 --- a/.github/workflows/make.yml +++ b/.github/workflows/make.yml @@ -50,6 +50,7 @@ jobs: Invoke-WebRequest @VAR & $VAR.OutFile.Replace('Temp', 'Temp\.') /SP- /VERYSILENT /SUPPRESSMSGBOXES /NORESTART | Out-Null $Env:PATH+=';C:\Lazarus' + $Env:PATH+=';C:\Lazarus\fpc\3.2.2\bin' (Get-Command 'lazbuild').Source | Out-Host - dir C:\Lazarus\fpc\3.2.2\ - # instantfpc '-FuC:\Lazarus\components\lazutils' .github/workflows/make.pas + dir C:\Lazarus\fpc\3.2.2\bin\ + instantfpc '-FuC:\Lazarus\components\lazutils' .github/workflows/make.pas From 853ee78dc2a2be60fbb114fc5f38d6eb017463d0 Mon Sep 17 00:00:00 2001 From: "Artem V. Ageev" Date: Tue, 14 Jan 2025 21:29:50 +0200 Subject: [PATCH 16/17] fix github-actions --- .github/workflows/make.pas | 22 ++++++++++++++++------ .github/workflows/make.yml | 4 ++-- 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/.github/workflows/make.pas b/.github/workflows/make.pas index 463f8b8..bc2c5f9 100644 --- a/.github/workflows/make.pas +++ b/.github/workflows/make.pas @@ -138,10 +138,15 @@ Output = record if Answer.Code <> 0 then begin for Line in SplitString(Answer.Output, LineEnding) do - if Pos('Fatal:', Line) <> 0 or Pos('Error:', Line) then + with TRegExpr.Create do begin - WriteLn(stderr); - Writeln(stderr, #27'[31m', Line, #27'[0m'); + Expression := '(Fatal|Error):'; + if Exec(Line) then + begin + WriteLn(stderr); + Writeln(stderr, #27'[31m', Line, #27'[0m'); + end; + Free; end; end else @@ -183,10 +188,15 @@ Output = record if Answer.Code <> 0 then begin for Line in SplitString(Answer.Output, LineEnding) do - if Pos('Fatal:', Line) <> 0 or Pos('Error:', Line) then + with TRegExpr.Create do begin - WriteLn(stderr); - Writeln(stderr, #27'[31m', Line, #27'[0m'); + Expression := '(Fatal|Error):'; + if Exec(Line) then + begin + WriteLn(stderr); + Writeln(stderr, #27'[31m', Line, #27'[0m'); + end; + Free; end; end else diff --git a/.github/workflows/make.yml b/.github/workflows/make.yml index 8248668..f0624b1 100644 --- a/.github/workflows/make.yml +++ b/.github/workflows/make.yml @@ -50,7 +50,7 @@ jobs: Invoke-WebRequest @VAR & $VAR.OutFile.Replace('Temp', 'Temp\.') /SP- /VERYSILENT /SUPPRESSMSGBOXES /NORESTART | Out-Null $Env:PATH+=';C:\Lazarus' - $Env:PATH+=';C:\Lazarus\fpc\3.2.2\bin' + $Env:PATH+=';C:\Lazarus\fpc\3.2.2\bin\x86_64-win64' (Get-Command 'lazbuild').Source | Out-Host - dir C:\Lazarus\fpc\3.2.2\bin\ + dir C:\Lazarus\fpc\3.2.2\bin\x86_64-win64 instantfpc '-FuC:\Lazarus\components\lazutils' .github/workflows/make.pas From faeeed66f214d9151a967adb2a5a300d2b635dd3 Mon Sep 17 00:00:00 2001 From: "Artem V. Ageev" Date: Tue, 14 Jan 2025 21:37:53 +0200 Subject: [PATCH 17/17] fix github-actions --- .github/workflows/make.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/make.yml b/.github/workflows/make.yml index f0624b1..cc34f43 100644 --- a/.github/workflows/make.yml +++ b/.github/workflows/make.yml @@ -23,7 +23,7 @@ jobs: strategy: matrix: os: - # - ubuntu-latest + - ubuntu-latest - windows-latest steps: - name: Checkout @@ -52,5 +52,5 @@ jobs: $Env:PATH+=';C:\Lazarus' $Env:PATH+=';C:\Lazarus\fpc\3.2.2\bin\x86_64-win64' (Get-Command 'lazbuild').Source | Out-Host - dir C:\Lazarus\fpc\3.2.2\bin\x86_64-win64 + (Get-Command 'instantfpc').Source | Out-Host instantfpc '-FuC:\Lazarus\components\lazutils' .github/workflows/make.pas