mirror of
https://github.com/Orange-OpenSource/hurl.git
synced 2024-11-23 00:44:55 +03:00
Convert windows ci jobs commands to powershell scripts
This commit is contained in:
parent
6da63deaa9
commit
f3a641ee6d
46
.github/workflows/release.yml
vendored
46
.github/workflows/release.yml
vendored
@ -60,8 +60,7 @@ jobs:
|
||||
uses: actions/checkout@v3
|
||||
- uses: actions/cache@v3
|
||||
with:
|
||||
path: |
|
||||
C:\vcpkg\installed
|
||||
path: C:\vcpkg\installed
|
||||
key: ${{ runner.os }}-release-windows-x64-${{ github.sha }}
|
||||
restore-keys: ${{ runner.os }}-release-windows-x64-
|
||||
- name: Install Rust
|
||||
@ -72,44 +71,17 @@ jobs:
|
||||
profile: minimal
|
||||
- name: Environment
|
||||
run: |
|
||||
$Properties = 'Caption', 'CSName', 'Version', 'BuildType', 'OSArchitecture'
|
||||
Get-CimInstance Win32_OperatingSystem | Select-Object $Properties | Format-Table -AutoSize
|
||||
cargo --version
|
||||
.\bin\environment.ps1
|
||||
- name: Build
|
||||
run: |
|
||||
# vcpkg build prequisites
|
||||
(Get-Command vcpkg).Path
|
||||
if (Test-Path C:\vcpkg\installed\x64-windows\lib\libcurl.lib) {echo "curl already installed"} else {vcpkg install curl:x64-windows}
|
||||
if (Test-Path C:\vcpkg\installed\x64-windows\lib\libxml2.lib) {echo "libxml2 already installed"} else {vcpkg install libxml2:x64-windows}
|
||||
vcpkg update
|
||||
vcpkg upgrade
|
||||
vcpkg integrate install
|
||||
refreshenv
|
||||
# fix known win build bugs
|
||||
(Get-Content .\packages\hurl\src\runner\hurl_file.rs).replace('```', '') | Set-Content .\packages\hurl\src\runner\hurl_file.rs
|
||||
# build release
|
||||
cargo build --release --verbose
|
||||
New-Item -ItemType Directory -Name .\target\win-package
|
||||
Get-ChildItem -Path '.\target\release' -Recurse -Include *.dll -File | Copy-Item -Destination '.\target\win-package'
|
||||
Get-ChildItem -Path '.\target\release' -Recurse -Include hurl*.exe -File | Copy-Item -Destination '.\target\win-package'
|
||||
((.\target\win-package\hurl.exe --version) -Split " ")[1] > .\target\win-package\version.txt
|
||||
Get-ChildItem .\target\win-package
|
||||
Get-Content .\target\win-package\version.txt
|
||||
- name: Create Zip package and win64 installer
|
||||
.\bin\install_prerequisites_windows.ps1
|
||||
.\bin\release\release.ps1
|
||||
- name: Create windows64 Zip package
|
||||
run: |
|
||||
# create zip
|
||||
$hurl_package_version = Get-Content .\target\win-package\version.txt
|
||||
cd .\target\win-package
|
||||
Get-ChildItem -Path *.dll, *hurl.exe, *hurlfmt.exe, *.txt, ../../*.md -Exclude hex_literal* | Compress-Archive -DestinationPath hurl-${hurl_package_version}-win64.zip
|
||||
Get-ChildItem .\*win64.zip
|
||||
cd ..\..
|
||||
# create installer
|
||||
choco install --confirm --no-progress nsis
|
||||
refreshenv
|
||||
Get-Command Expand-Archive
|
||||
Expand-Archive -Path '.\bin\windows\EnVar_plugin.zip' -DestinationPath 'C:\Program Files (x86)\NSIS' -Verbose
|
||||
cd .\target\win-package
|
||||
makensis.exe /NOCD /V4 ..\..\bin\windows\hurl.nsi
|
||||
.\bin\release\create_windows64_zip_package.ps1
|
||||
- name: Create windows64 installer
|
||||
run: |
|
||||
.\bin\release\create_windows64_installer.ps1
|
||||
- name: Archive production artifacts
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
|
52
.github/workflows/test.yml
vendored
52
.github/workflows/test.yml
vendored
@ -232,8 +232,7 @@ jobs:
|
||||
uses: actions/checkout@v3
|
||||
- uses: actions/cache@v3
|
||||
with:
|
||||
path: |
|
||||
C:\vcpkg\installed
|
||||
path: C:\vcpkg\installed
|
||||
key: ${{ runner.os }}-test-windows-x64-${{ github.sha }}
|
||||
restore-keys: ${{ runner.os }}-test-windows-x64-
|
||||
- name: Install Rust
|
||||
@ -244,48 +243,14 @@ jobs:
|
||||
profile: minimal
|
||||
- name: Environment
|
||||
run: |
|
||||
$Properties = 'Caption', 'CSName', 'Version', 'BuildType', 'OSArchitecture'
|
||||
Get-CimInstance Win32_OperatingSystem | Select-Object $Properties | Format-Table -AutoSize
|
||||
cargo --version
|
||||
$PsVersionTable
|
||||
- name: Install build and tests prequisites
|
||||
.\bin\environment.ps1
|
||||
- name: Build and test
|
||||
run: |
|
||||
# vcpkg build prequisites
|
||||
(Get-Command vcpkg).Path
|
||||
if (Test-Path C:\vcpkg\installed\x64-windows\lib\libcurl.lib) {echo "curl already installed"} else {vcpkg install curl:x64-windows}
|
||||
if (Test-Path C:\vcpkg\installed\x64-windows\lib\libxml2.lib) {echo "libxml2 already installed"} else {vcpkg install libxml2:x64-windows}
|
||||
vcpkg update
|
||||
vcpkg upgrade
|
||||
vcpkg integrate install
|
||||
refreshenv
|
||||
# install proxy and server
|
||||
pip3 install --requirement bin/requirements-frozen.txt
|
||||
- name: Run Tests units
|
||||
run: |
|
||||
cd .\integration
|
||||
Start-Job -Name mitmdump -ScriptBlock { mitmdump --listen-port 8888 --modify-header "/From-Proxy/Hello" }
|
||||
Start-Job -Name server -ScriptBlock { python server.py > server.log }
|
||||
Start-Job -Name server -ScriptBlock { python ssl/server.py > server-ssl.log }
|
||||
Get-Job -Name server
|
||||
Get-Job -Name mitmdump
|
||||
Start-Sleep 5
|
||||
cd ..
|
||||
cargo test --features strict --tests
|
||||
- name: Run Integration tests
|
||||
run: |
|
||||
cargo build --release --verbose --locked
|
||||
target\release\hurl.exe --version
|
||||
$execdir=[System.Environment]::SystemDirectory
|
||||
Get-ChildItem -Path ".\target\release" -Recurse -Include *.dll -File | Copy-Item -Destination "${execdir}"
|
||||
Get-ChildItem -Path ".\target\release" -Recurse -Include hurl*.exe -File | Copy-Item -Destination "${execdir}"
|
||||
cd .\integration
|
||||
Start-Job -Name mitmdump -ScriptBlock { mitmdump --listen-port 8888 --modify-header "/From-Proxy/Hello" }
|
||||
Start-Job -Name server -ScriptBlock { python server.py > server.log }
|
||||
Start-Job -Name server -ScriptBlock { python ssl/server.py > server-ssl.log }
|
||||
Get-Job -Name server
|
||||
Get-Job -Name mitmdump
|
||||
Start-Sleep 5
|
||||
python integration.py
|
||||
.\bin\install_prerequisites_windows.ps1
|
||||
.\bin\test\test_prerequisites.ps1
|
||||
.\bin\test\test_unit.ps1
|
||||
.\bin\release\release.ps1
|
||||
.\bin\test\test_integ.ps1
|
||||
- name: Archive production artifacts
|
||||
uses: actions/upload-artifact@v3
|
||||
if: ${{ always() }}
|
||||
@ -294,4 +259,3 @@ jobs:
|
||||
path: |
|
||||
integration/server.log
|
||||
integration/server-ssl.log
|
||||
|
||||
|
13
bin/environment.ps1
Normal file
13
bin/environment.ps1
Normal file
@ -0,0 +1,13 @@
|
||||
echo "----- context -----"
|
||||
|
||||
# get windows infos
|
||||
Get-ComputerInfo -Property WindowsProductName,WindowsVersion,OsHardwareAbstractionLayer
|
||||
|
||||
# get vcpkg infos
|
||||
vcpkg --version
|
||||
|
||||
# get python infos
|
||||
python -V
|
||||
|
||||
# get cargo info
|
||||
cargo --version
|
12
bin/install_prerequisites_windows.ps1
Normal file
12
bin/install_prerequisites_windows.ps1
Normal file
@ -0,0 +1,12 @@
|
||||
echo "----- install system prerequisites -----"
|
||||
|
||||
# install libxml and libcurl
|
||||
$vcpkg_dir=(Get-command vcpkg).Source
|
||||
if (Test-Path $vcpkg_dir\installed\x64-windows\lib\libcurl.lib) {echo "curl already installed"} else {vcpkg install curl:x64-windows}
|
||||
if (Test-Path $vcpkg_dir\installed\x64-windows\lib\libxml2.lib) {echo "libxml2 already installed"} else {vcpkg install libxml2:x64-windows}
|
||||
vcpkg update
|
||||
vcpkg upgrade
|
||||
vcpkg integrate install
|
||||
|
||||
# update pip
|
||||
python -m pip install --upgrade pip --quiet
|
14
bin/release/create_windows64_installer.ps1
Normal file
14
bin/release/create_windows64_installer.ps1
Normal file
@ -0,0 +1,14 @@
|
||||
echo "----- create windows64 installer -----"
|
||||
|
||||
$actual_dir=(Get-Location).Path
|
||||
|
||||
# install NSIS
|
||||
if (Get-Command makensis) {echo "makensis already installed"} else {choco install --confirm --no-progress nsis}
|
||||
$nsis_dir=(Get-Command makensis).path | Split-Path -Parent
|
||||
Expand-Archive -Path "$PSScriptRoot\..\..\bin\windows\EnVar_plugin.zip" -DestinationPath "$nsis_dir" -Verbose
|
||||
|
||||
# create win64 installer
|
||||
cd $PSScriptRoot\..\..\target\win-package
|
||||
makensis.exe /NOCD /V4 ..\..\bin\windows\hurl.nsi
|
||||
|
||||
cd $actual_dir
|
13
bin/release/create_windows64_zip_package.ps1
Normal file
13
bin/release/create_windows64_zip_package.ps1
Normal file
@ -0,0 +1,13 @@
|
||||
echo "----- create windows64 zip package -----"
|
||||
|
||||
$actual_dir=(Get-Location).Path
|
||||
|
||||
# get built hurl version
|
||||
$hurl_package_version = Get-Content .\target\win-package\version.txt
|
||||
|
||||
# create windows64 zip package
|
||||
cd $PSScriptRoot\..\..\target\win-package
|
||||
Get-ChildItem -Path *.dll, *hurl.exe, *hurlfmt.exe, *.txt, ../../*.md -Exclude hex_literal* | Compress-Archive -DestinationPath hurl-${hurl_package_version}-win64.zip
|
||||
Get-ChildItem .\*win64.zip
|
||||
|
||||
cd $actual_dir
|
22
bin/release/release.ps1
Normal file
22
bin/release/release.ps1
Normal file
@ -0,0 +1,22 @@
|
||||
echo "----- build release -----"
|
||||
|
||||
# build
|
||||
cargo build --release --verbose --locked
|
||||
|
||||
# create final package
|
||||
New-Item -ItemType Directory -Name .\target\win-package
|
||||
Get-ChildItem -Path '.\target\release' -Recurse -Include *.dll -File | Copy-Item -Destination '.\target\win-package'
|
||||
Get-ChildItem -Path '.\target\release' -Recurse -Include hurl*.exe -File | Copy-Item -Destination '.\target\win-package'
|
||||
((.\target\win-package\hurl.exe --version) -Split " ")[1] > .\target\win-package\version.txt
|
||||
Get-Content .\target\win-package\version.txt
|
||||
|
||||
# add hurl to PATH
|
||||
$hurl_dir=(Get-Location).path
|
||||
$oldpath=(Get-ItemProperty -Path HKCU:\Environment -Name Path).Path
|
||||
$newpath="$hurl_dir\target\win-package;$oldpath"
|
||||
Set-ItemProperty -Path HKCU:\Environment -Name Path -Value $newpath
|
||||
$env:Path = [System.Environment]::GetEnvironmentVariable("Path","Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path","User")
|
||||
(Get-Command hurl).Path
|
||||
|
||||
# test hurl execution
|
||||
hurl --version
|
9
bin/test/test_integ.ps1
Normal file
9
bin/test/test_integ.ps1
Normal file
@ -0,0 +1,9 @@
|
||||
echo "----- integration tests -----"
|
||||
|
||||
$actual_dir=(Get-Location).Path
|
||||
|
||||
# run integration tests
|
||||
cd $PSScriptRoot\..\..\integration
|
||||
python ./integration.py
|
||||
|
||||
cd $actual_dir
|
17
bin/test/test_prerequisites.ps1
Normal file
17
bin/test/test_prerequisites.ps1
Normal file
@ -0,0 +1,17 @@
|
||||
echo "----- install tests prerequisites -----"
|
||||
|
||||
$actual_dir=(Get-Location).Path
|
||||
|
||||
# install python libs
|
||||
pip3 install --requirement bin\requirements-frozen.txt
|
||||
|
||||
# start mock servers
|
||||
cd $PSScriptRoot\..\..\integration
|
||||
Start-Job -Name mitmdump -ScriptBlock { mitmdump --listen-port 8888 --modify-header "/From-Proxy/Hello" }
|
||||
Start-Job -Name server -ScriptBlock { python server.py > server.log }
|
||||
Start-Job -Name server -ScriptBlock { python ssl/server.py > server-ssl.log }
|
||||
Get-Job -Name server
|
||||
Get-Job -Name mitmdump
|
||||
Start-Sleep 5
|
||||
|
||||
cd $actual_dir
|
4
bin/test/test_unit.ps1
Normal file
4
bin/test/test_unit.ps1
Normal file
@ -0,0 +1,4 @@
|
||||
echo "----- unit tests -----"
|
||||
|
||||
# run test units
|
||||
cargo test --release --features strict --tests
|
Loading…
Reference in New Issue
Block a user