修复构建 #575
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build Windows Executable | |
on: | |
push: | |
# Sequence of patterns matched against refs/tags | |
tags: | |
- 'v*' | |
jobs: | |
build: | |
name: Build exe with launcher | |
runs-on: windows-latest | |
env: | |
PYTHONIOENCODING: 'UTF-8' | |
strategy: | |
matrix: | |
python-version: [ 3.12 ] | |
steps: | |
- name: Configure git | |
run: | | |
[Console]::OutputEncoding = [System.Text.Encoding]::UTF8 | |
git config --global core.autocrlf false | |
git config --global core.eol lf | |
git config --global user.email "[email protected]" | |
git config --global user.name "ok-oldking" | |
echo "action_state=yellow" >> $env:GITHUB_ENV | |
echo "${{ env.action_state }}" | |
- uses: actions/checkout@v4 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v2 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Set UTF-8 encoding | |
run: | | |
set PYTHONIOENCODING=utf-8 | |
set PYTHONLEGACYWINDOWSSTDIO=utf-8 | |
echo PYTHONIOENCODING=utf-8 >> $GITHUB_ENV | |
- name: Get Changes between Tags | |
id: changes | |
uses: simbo/changes-between-tags-action@v1 | |
with: | |
include-hashes: false | |
validate-tag: false | |
- name: Get tag name | |
id: tagName | |
uses: olegtarasov/[email protected] | |
- name: Install Dependencies | |
run: | | |
pip install -r requirements.txt | |
pip install -r requirements-dev.txt | |
- name: Copy ok-script lib | |
run: | | |
python -m ok.update.copy_ok_folder | |
- name: Rename .py files to .pyx | |
run: | | |
Get-ChildItem -Path .\src -Recurse -Filter *.py -Exclude '__init__.py' | ForEach-Object { Rename-Item $_.FullName -NewName ($_.FullName -replace '\.py$', '.pyx') } | |
- name: build cython | |
run: | | |
python setup.py build_ext --inplace | |
Get-ChildItem -Path .\src -Recurse -Filter *.pyx | ForEach-Object { Remove-Item $_.FullName } | |
Get-ChildItem -Path .\src -Recurse -Filter *.cpp | ForEach-Object { Remove-Item $_.FullName } | |
- name: Run tests | |
run: | | |
Get-ChildItem -Path ".\tests\*.py" | ForEach-Object { | |
Write-Host "Running tests in $($_.FullName)" | |
try { | |
# Run the Python unittest command | |
python -m unittest $_.FullName | |
# Check if the previous command succeeded | |
if ($LASTEXITCODE -ne 0) { | |
throw "Tests failed in $($_.FullName)" | |
} | |
} catch { | |
# Stop the loop and return the error | |
Write-Error $_ | |
exit 1 | |
} | |
} | |
- name: Build Executable | |
run: | | |
echo "tag: ${{ steps.changes.outputs.tag }}" | |
echo "changes: ${{ steps.changes.outputs.changes }}" | |
python -m ok.update.package_launcher ${{ steps.tagName.outputs.tag }} deploy.txt | |
Copy-Item -Path "dist" -Destination "ok-ww" -Recurse | |
7z a -t7z -r "ok-ww-${{ steps.tagName.outputs.tag }}.7z" "ok-ww" | |
Remove-Item -Path "ok-ww" -Recurse -Force | |
shell: pwsh | |
- name: Release | |
uses: softprops/action-gh-release@v2 | |
if: startsWith(github.ref, 'refs/tags/') | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
body: | | |
下载 ok-ww.7z, Download ok-ww.7z | |
不要下载SourceCode Do Not Download the SourceCode | |
draft: false | |
prerelease: false | |
files: | | |
ok-ww-${{ steps.tagName.outputs.tag }}.7z | |
- name: push to ok-ww-update | |
run: | | |
python -m ok.update.push_repos --repos https://ok-oldking:${{ secrets.OK_GH }}@github.com/ok-oldking/ok-ww-update --files deploy.txt --tag ${{ steps.tagName.outputs.tag }} | |
- name: push to cnb | |
run: | | |
python -m ok.update.push_repos --repos https://cnb:${{ secrets.CNB_TOKEN }}@cnb.cool/ok-oldking/ok-wuthering-waves.git --files deploy.txt --tag ${{ steps.tagName.outputs.tag }} |