diff --git a/.github/workflows/on commit.yaml b/.github/workflows/on commit.yaml new file mode 100644 index 00000000..a387d08e --- /dev/null +++ b/.github/workflows/on commit.yaml @@ -0,0 +1,151 @@ +name: Pack and test + +on: + push: + branches-ignore: + - 'win-pack-changes/*' + - 'ubuntu-pack-changes/*' + pull_request: + repository_dispatch: + +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + +permissions: + contents: write + +jobs: + pack-win: + runs-on: windows-latest + + steps: + - uses: actions/checkout@v3 + + - name: Install OpenCL driver for Intel CPU + run: | + + # https://www.intel.com/content/www/us/en/developer/articles/technical/intel-cpu-runtime-for-opencl-applications-with-sycl-support.html + Invoke-WebRequest -Uri 'https://registrationcenter-download.intel.com/akdlm/IRC_NAS/f8f09106-6d86-41b5-83c8-02892bbb7f29/w_opencl_runtime_p_2023.1.0.46319.exe' -OutFile 'D:\igfx.exe' + + 7z x "D:\igfx.exe" -o"D:\igfx" -y + + D:\igfx\w_opencl_runtime_p_2023.1.0.46319.msi /quiet + + - name: Download and unpack Pascal compiler + run: | + + Invoke-WebRequest -Uri 'https://github.com/SunSerega/pascalabcnet/releases/download/unstable/PABCNETC.zip' -OutFile 'D:\PABCNETC.zip' + + Expand-Archive -Path 'D:\PABCNETC.zip' -DestinationPath 'D:\PABCNETC' -Force + + - name: PackAll + run: | + + ".\PackAll-0 FIRST PACK.bat" "PasCompPath=D:\PABCNETC\pabcnetcclear.exe" + + - name: Check for changes + run: | + + git push origin --delete "win-pack-changes/$(git rev-parse --abbrev-ref HEAD)" > nul 2>&1 + if ($?) { + Write-Host "Old changes branch deleted" + } else { + Write-Host "Old changes branch not found" + } + + if ((git diff --name-only) -or (git ls-files --others --exclude-standard)) { + Write-Host "Changes detected" + git checkout -B "win-pack-changes/$(git rev-parse --abbrev-ref HEAD)" + + git add -A + git config --global user.name "sun pack bot" + git config --global user.email "sunserega2@gmail.com" + git commit -m "win changes" + git push -f --set-upstream origin "$(git rev-parse --abbrev-ref HEAD)" + } else { + Write-Host "No changes detected" + } + + pack-ubuntu: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + + - name: apt-gen update + run: sudo apt-get update + + - name: Download Pascal Compiler + run: | + + ( + cd ../ + curl -L -O https://github.com/SunSerega/pascalabcnet/releases/download/unstable/PABCNETC.zip + #file -i PABCNETC.zip + ) + + #7z -scsWIN -sccWIN x PABCNETC.zip -oPABCNETC + + #unzip -j PABCNETC.zip -d PABCNETC + + sudo apt-get install -y minizip + mkdir ../PABCNETC + miniunzip ../PABCNETC.zip -d usr/PABCNETC + + - name: Install Mono + run: | + + sudo apt-get install -y mono-complete + #sudo apt-get install -y gdb lldb + + - name: Install OpenCL Drivers + run: | + + sudo apt-get install -y ocl-icd-opencl-dev + sudo apt-get install -y pocl-opencl-icd + + - name: Build and run OpenCL program + run: | + + mono "usr/PABCNETC/pabcnetcclear.exe" "PackAll.pas" + mono "PackAll.exe" "Stages= FirstPack + Reference + Dummy + OpenCL+OpenCLABC + OpenGL+OpenGLABC + Compile + Test + Release" "PasCompPath=usr/PABCNETC/pabcnetcclear.exe" + + - name: Check for changes + run: | + + if git push origin --delete "ubuntu-pack-changes/$(git rev-parse --abbrev-ref HEAD)" &> /dev/null; then + echo "Old changes branch deleted" + else + echo "Old changes branch not found" + fi + + if [[ $(git diff --name-only) || $(git ls-files --others --exclude-standard) ]]; then + echo "Changes detected" + git checkout -B "ubuntu-pack-changes/$(git rev-parse --abbrev-ref HEAD)" + + git add -A + git config --global user.name 'pack bot' + git config --global user.email 'sunserega2@gmail.com' + git commit -m "ubuntu changes" + git push -f --set-upstream origin "$(git rev-parse --abbrev-ref HEAD)" + + else + echo "No changes detected" + fi + + Trigger dependant: + runs-on: ubuntu-latest + needs: [pack-win, pack-ubuntu] + + steps: uses: actions/github-script@v5 + with: + script: | + + await github.rest.actions.createWorkflowDispatch({ + owner: 'SunSerega', + repo: 'OpenCL-test', + workflow_id: 'windows on commit.yaml', + ref: 'main', + }); + \ No newline at end of file diff --git a/PackAll-0 FIRST PACK.bat b/PackAll-0 FIRST PACK.bat index 24051eeb..8665b33c 100644 --- a/PackAll-0 FIRST PACK.bat +++ b/PackAll-0 FIRST PACK.bat @@ -8,6 +8,6 @@ IF NOT EXIST "PackAll.exe" ( DEL "PackAll.pdb" ) -start PackAll.exe "Stages= FirstPack + Reference + Dummy + OpenCL+OpenCLABC + OpenGL+OpenGLABC + Compile + Test + Release" +start PackAll.exe "Stages= FirstPack + Reference + Dummy + OpenCL+OpenCLABC + OpenGL+OpenGLABC + Compile + Test + Release" %* diff --git a/PackAll-0 Just First Pack.bat b/PackAll-0 Just First Pack.bat index 69254edb..c5ea019a 100644 --- a/PackAll-0 Just First Pack.bat +++ b/PackAll-0 Just First Pack.bat @@ -3,6 +3,6 @@ -start PackAll.exe "Stages=FirstPack" +start PackAll.exe "Stages=FirstPack" %* diff --git a/PackAll-1 CL+GL.bat b/PackAll-1 CL+GL.bat index 80eee5cf..d48e1c64 100644 --- a/PackAll-1 CL+GL.bat +++ b/PackAll-1 CL+GL.bat @@ -3,6 +3,6 @@ -start PackAll.exe "Stages= Reference + Dummy+OpenCL+OpenGL + Compile + Test + Release" +start PackAll.exe "Stages= Reference + Dummy+OpenCL+OpenGL + Compile + Test + Release" %* diff --git a/PackAll-2 CLABC Full.bat b/PackAll-2 CLABC Full.bat index 22aada5d..70aa4119 100644 --- a/PackAll-2 CLABC Full.bat +++ b/PackAll-2 CLABC Full.bat @@ -3,6 +3,6 @@ -start PackAll.exe "Stages= Dummy+OpenCL+OpenCLABC + Compile + Test + Release" +start PackAll.exe "Stages= Dummy+OpenCL+OpenCLABC + Compile + Test + Release" %* diff --git a/PackAll-2 GLABC Full.bat b/PackAll-2 GLABC Full.bat index 16da17cf..01d771ec 100644 --- a/PackAll-2 GLABC Full.bat +++ b/PackAll-2 GLABC Full.bat @@ -3,6 +3,6 @@ -start PackAll.exe "Stages= Dummy+OpenGL+OpenGLABC + Compile + Test + Release" +start PackAll.exe "Stages= Dummy+OpenGL+OpenGLABC + Compile + Test + Release" %* diff --git a/PackAll-3 CLABC Only.bat b/PackAll-3 CLABC Only.bat index 4e9cc312..65f5a401 100644 --- a/PackAll-3 CLABC Only.bat +++ b/PackAll-3 CLABC Only.bat @@ -3,6 +3,6 @@ -start PackAll.exe "Stages= OpenCLABC + Compile + Test + Release" +start PackAll.exe "Stages= OpenCLABC + Compile + Test + Release" %* diff --git a/PackAll-3 GLABC Only.bat b/PackAll-3 GLABC Only.bat index 9ee8619f..45b81d4b 100644 --- a/PackAll-3 GLABC Only.bat +++ b/PackAll-3 GLABC Only.bat @@ -3,6 +3,6 @@ -start PackAll.exe "Stages= OpenGLABC + Compile + Test + Release" +start PackAll.exe "Stages= OpenGLABC + Compile + Test + Release" %* diff --git a/PackAll-4 Release Only.bat b/PackAll-4 Release Only.bat index 6717a366..b2faf958 100644 --- a/PackAll-4 Release Only.bat +++ b/PackAll-4 Release Only.bat @@ -3,6 +3,6 @@ -start PackAll.exe "Stages=Reference+Release" +start PackAll.exe "Stages=Reference+Release" %* diff --git a/PackAll.pas b/PackAll.pas index 45435526..f35295c1 100644 --- a/PackAll.pas +++ b/PackAll.pas @@ -1,17 +1,23 @@  // АРГУМЕНТЫ КОМАНДНОЙ СТРОКИ: // -// - "Stages=...+...+..." | запускает только указанные стадии упаковки -// - "FirstPack" - Датаскрапинг данных о исходных модулях. Единственная по умолчанию выключенная стадия -// - "Reference" - Упаковка справок -// - "Dummy" - Упаковка модуля Dummy.pas (тест кодогенерации) -// - "OpenCL" - Упаковка модуля OpenCL.pas -// - "OpenCLABC" - Упаковка модуля OpenCLABC.pas -// - "OpenGL" - Упаковка модуля OpenGL.pas -// - "OpenGLABC" - Упаковка модуля OpenGLABC.pas -// - "Compile" - Компиляция всех упакованных модулей -// - "Test" - Тестирование (то же что запуск "Tests\Tester.exe" напрямую, но с указанными модулями) -// - "Release" - Создание и наполнение папки Release, а так же копирование чего надо в ProgramFiles +// - "PasCompPath=path\PABCNETC\pabcnetcclear.exe" +// === Использует указанный компилятор для .pas файлов +// === Если не указать - используется "C:\Program Files (x86)\PascalABC.NET\pabcnetcclear.exe" +// === Можно указать несколько, будет использован первый существующий .exe файл компилятора +// +// - "Stages=...+...+..." +// === Запускает только указанные стадии упаковки +// - "FirstPack" | Датаскрапинг данных о исходных модулях. Единственная по умолчанию выключенная стадия +// - "Reference" | Упаковка справок +// - "Dummy" | Упаковка модуля Dummy.pas (тест кодогенерации) +// - "OpenCL" | Упаковка модуля OpenCL.pas +// - "OpenCLABC" | Упаковка модуля OpenCLABC.pas +// - "OpenGL" | Упаковка модуля OpenGL.pas +// - "OpenGLABC" | Упаковка модуля OpenGLABC.pas +// - "Compile" | Компиляция всех упакованных модулей +// - "Test" | Тестирование (то же что запуск "Tests\Tester.exe" напрямую, но с указанными модулями) +// - "Release" | Создание и наполнение папки Release, а так же копирование чего надо в ProgramFiles // === К примеру: "Stages= OpenCLABC + Compile + Test + Release" // === Лишние пробелы по краям имён стадий допускаются, но "Stages=" должно быть слитно и без пробелов в начале // diff --git a/Utils/SubExecuters.pas b/Utils/SubExecuters.pas index d7873e5c..329bc7e9 100644 --- a/Utils/SubExecuters.pas +++ b/Utils/SubExecuters.pas @@ -63,7 +63,7 @@ Result := false; if not FileExists(path) then begin - Otp($'WARNING: pas_comp_path "{path}" did not refer to a file'); + Otp(new OtpLine($'WARNING: pas_comp_path "{path}" did not refer to a file', true)); exit; end; if pas_comp_path<>nil then