Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Yuukiy committed Sep 21, 2024
1 parent 58b29b3 commit 84884f4
Show file tree
Hide file tree
Showing 2 changed files with 76 additions and 78 deletions.
151 changes: 75 additions & 76 deletions .github/workflows/pyinstaller.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 .
3 changes: 1 addition & 2 deletions .github/workflows/test-web-funcs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 .

0 comments on commit 84884f4

Please sign in to comment.