diff --git a/.github/workflows/pyinstaller.yml b/.github/workflows/pyinstaller.yml index c4960a2da..3682a21d8 100644 --- a/.github/workflows/pyinstaller.yml +++ b/.github/workflows/pyinstaller.yml @@ -35,79 +35,78 @@ jobs: # Steps represent a sequence of tasks that will be executed as part of the job steps: # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it - - uses: actions/checkout@v4 - - - name: Fetch tags - run: git fetch --prune --unshallow --tags - - - name: Setup Python 3.8 - uses: actions/setup-python@v5 - with: - python-version: 3.8 - - - name: Install dependencies - run: | - python -m pip install --upgrade pip - python -m pip install -r requirements.txt - python -m pip install pyinstaller - - - name: Build with PyInstaller for windows - run: cmd.exe /c 'make.bat' - - - name: Install pytest - run: | - python -m pip install pytest - - - name: Setup clash proxy - env: - CLASH_SUBSCRIPTION_URL: ${{ secrets.CLASH_SUBSCRIPTION_URL }} - run: | - Invoke-WebRequest -Uri "https://github.com/Kuingsmile/clash-core/releases/download/1.18/clash-windows-amd64-v3-v1.18.0.zip" -OutFile "clash.zip" - Expand-Archive -Path "clash.zip" - Invoke-WebRequest -Uri "$env:CLASH_SUBSCRIPTION_URL" -OutFile "clash\clash.yaml" - Start-Process -FilePath "clash\clash-windows-amd64-v3.exe" -ArgumentList "-f clash\clash.yaml" - $iniContent = Get-Content -Path "core\config.ini" -Raw - $iniContent = $iniContent -replace "use_proxy = no", "use_proxy = yes" - $iniContent = $iniContent -replace "proxy = http://127.0.0.1:1080", "proxy = http://127.0.0.1:7890" - $iniContent | Set-Content -Path "core\config.ini" -Encoding UTF8 - - - name: Test JavSP.exe - run: | - chcp 65001 - if (Test-Path "core\config.ini") { Copy-Item "core\config.ini" "dist\config.ini" } - pytest unittest/test_exe.py - - - name: Set VERSION variable for windows - if: ${{ !cancelled() }} - run: | - echo "VERSION=$(python make\gen_ver_hook.py)" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append - - - name: Upload build artifact - uses: actions/upload-artifact@v4 - if: ${{ !cancelled() }} - with: - name: JavSP-${{ env.VERSION }}-Windows-amd64 - path: dist/JavSP.exe - - - name: Setup Remote Desktop - env: - RDP_PASSWORD: ${{ secrets.RDP_PASSWORD }} - CF_TUNNEL_TOKEN: ${{ secrets.CF_TUNNEL_TOKEN }} - if: ${{ !cancelled() && github.event_name == 'workflow_dispatch' && inputs.setup_rdp }} - run: | - Set-ItemProperty -Path 'HKLM:\System\CurrentControlSet\Control\Terminal Server'-name "fDenyTSConnections" -Value 0 - Enable-NetFirewallRule -DisplayGroup "Remote Desktop" - Set-ItemProperty -Path 'HKLM:\System\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp' -name "UserAuthentication" -Value 1 - Set-LocalUser -Name "runneradmin" -Password (ConvertTo-SecureString -AsPlainText "$env:RDP_PASSWORD" -Force) - - choco feature disable -n=showDownloadProgress - choco install cloudflared - Start-Process -FilePath "cloudflared" -ArgumentList "-f tunnel run --token $env:CF_TUNNEL_TOKEN" - echo "Cloudflared tunnel started" - - choco install vscode - Import-Module $env:ChocolateyInstall\helpers\chocolateyProfile.psm1 - refreshenv - code --install-extension ms-python.python - - $null = Read-Host "Remote Desktop setup complete, you can connect now ..." + - uses: actions/checkout@v4 + + - name: Fetch tags + run: git fetch --prune --unshallow --tags + + - name: Setup Python 3.8 + uses: actions/setup-python@v5 + with: + python-version: 3.8 + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + python -m pip install -r requirements.txt + python -m pip install pyinstaller + + - name: Build with PyInstaller for windows + run: cmd.exe /c 'make.bat' + + - name: Install pytest + run: | + python -m pip install pytest + + - name: Setup clash proxy + env: + CLASH_SUBSCRIPTION_URL: ${{ secrets.CLASH_SUBSCRIPTION_URL }} + run: | + Invoke-WebRequest -Uri "https://github.com/Kuingsmile/clash-core/releases/download/1.18/clash-windows-amd64-v3-v1.18.0.zip" -OutFile "clash.zip" + Expand-Archive -Path "clash.zip" + Invoke-WebRequest -Uri "$env:CLASH_SUBSCRIPTION_URL" -OutFile "clash\clash.yaml" + Start-Process -FilePath "clash\clash-windows-amd64-v3.exe" -ArgumentList "-f clash\clash.yaml" + $iniContent = Get-Content -Path "core\config.ini" -Raw + $iniContent = $iniContent -replace "use_proxy = no", "use_proxy = yes" + $iniContent = $iniContent -replace "proxy = http://127.0.0.1:1080", "proxy = http://127.0.0.1:7890" + $iniContent | Set-Content -Path "core\config.ini" -Encoding UTF8 + + - name: Test JavSP.exe + run: | + chcp 65001 + if (Test-Path "core\config.ini") { Copy-Item "core\config.ini" "dist\config.ini" } + pytest unittest/test_exe.py + + - name: Set VERSION variable for windows + if: ${{ !cancelled() }} + run: | + echo "VERSION=$(python make\gen_ver_hook.py)" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append + + - name: Upload build artifact + uses: actions/upload-artifact@v4 + if: ${{ !cancelled() }} + with: + name: JavSP-${{ env.VERSION }}-Windows-amd64 + path: dist/JavSP.exe + + - name: Setup Remote Desktop + env: + RDP_PASSWORD: ${{ secrets.RDP_PASSWORD }} + CF_TUNNEL_TOKEN: ${{ secrets.CF_TUNNEL_TOKEN }} + if: ${{ !cancelled() && github.event_name == 'workflow_dispatch' && inputs.setup_rdp }} + run: | + Set-ItemProperty -Path 'HKLM:\System\CurrentControlSet\Control\Terminal Server'-name "fDenyTSConnections" -Value 0 + Enable-NetFirewallRule -DisplayGroup "Remote Desktop" + Set-ItemProperty -Path 'HKLM:\System\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp' -name "UserAuthentication" -Value 1 + Set-LocalUser -Name "runneradmin" -Password (ConvertTo-SecureString -AsPlainText "$env:RDP_PASSWORD" -Force) + + choco feature disable -n=showDownloadProgress + choco install cloudflared + Start-Process -FilePath "cloudflared" -ArgumentList "-f tunnel run --token $env:CF_TUNNEL_TOKEN" + echo "Cloudflared tunnel started" + + choco install vscode + Import-Module $env:ChocolateyInstall\helpers\chocolateyProfile.psm1 + refreshenv + code --install-extension ms-python.python + code --wait . diff --git a/.github/workflows/test-web-funcs.yml b/.github/workflows/test-web-funcs.yml index 675a2792a..347a67c2a 100644 --- a/.github/workflows/test-web-funcs.yml +++ b/.github/workflows/test-web-funcs.yml @@ -90,5 +90,4 @@ jobs: Import-Module $env:ChocolateyInstall\helpers\chocolateyProfile.psm1 refreshenv code --install-extension ms-python.python - - $null = Read-Host "Remote Desktop setup complete, you can connect now ..." + code --wait .