-
Notifications
You must be signed in to change notification settings - Fork 79
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
83 changed files
with
513 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
name: Client_Compile with PyInstaller | ||
|
||
on: | ||
release: | ||
types: [created] | ||
|
||
jobs: | ||
build: | ||
runs-on: windows-latest | ||
defaults: | ||
run: | ||
working-directory: ./YuYuWechatV2_Client | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Set up Python | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: '3.11' | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install -r requirements.txt | ||
- name: Compile with PyInstaller | ||
run: | | ||
pip install pyinstaller | ||
pyinstaller YuYuWechatV2_Client.spec | ||
- name: Upload release exe | ||
uses: actions/upload-release-asset@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }} | ||
with: | ||
upload_url: ${{ github.event.release.upload_url }} | ||
asset_path: D:\a\YuYuWechatV2\YuYuWechatV2\YuYuWechatV2_Client\dist\YuYuWechatV2_Client.exe | ||
asset_name: YuYuWechatV2_Client.exe | ||
asset_content_type: application/octet-stream | ||
- name: Upload release bat | ||
uses: actions/upload-release-asset@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }} | ||
with: | ||
upload_url: ${{ github.event.release.upload_url }} | ||
asset_path: D:\a\YuYuWechatV2\YuYuWechatV2\YuYuWechatV2_Client\dist\YuYuWechatV2_Client_run.bat | ||
asset_name: YuYuWechatV2_Client_run.bat | ||
asset_content_type: application/octet-stream |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
name: Client_Docker Test When commit.yml | ||
|
||
on: | ||
push: | ||
branches: [ main ] | ||
pull_request: | ||
branches: [ main ] | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
defaults: | ||
run: | ||
working-directory: ./YuYuWechatV2_Client | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v1 | ||
|
||
- name: Build Docker image | ||
run: docker build -t my-python-app . | ||
|
||
- name: Run Docker container | ||
run: docker run -d -p 7500:7500 --name my-python-app-container my-python-app | ||
|
||
- name: Wait for the server to start | ||
run: sleep 10 | ||
|
||
- name: Display Docker logs | ||
run: docker logs my-python-app-container | ||
|
||
- name: Test main endpoint | ||
run: curl --fail http://127.0.0.1:7500 | ||
|
||
- name: Test admin endpoint | ||
run: curl --fail http://127.0.0.1:7500/admin | ||
|
||
- name: Test send_message_management endpoint | ||
run: curl --fail http://127.0.0.1:7500/send_message_management/ | ||
|
||
- name: Test schedule_management endpoint | ||
run: curl --fail http://127.0.0.1:7500/schedule_management/ |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
name: Client_Push Docker image | ||
|
||
on: | ||
release: | ||
types: [created] | ||
|
||
jobs: | ||
build-and-test-and-upload: | ||
runs-on: ubuntu-latest | ||
defaults: | ||
run: | ||
working-directory: ./YuYuWechatV2_Client | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v2 | ||
with: | ||
driver-opts: image=moby/buildkit:buildx-stable-1 | ||
|
||
- name: Build Docker image | ||
run: docker build -t yuyuwechatv2_client . | ||
|
||
- name: Run Docker container | ||
run: docker run -d -p 7500:7500 --name yuyuwechatv2_client-container yuyuwechatv2_client | ||
|
||
- name: Wait for the server to start | ||
run: sleep 10 | ||
|
||
- name: Display Docker logs | ||
run: docker logs yuyuwechatv2_client-container | ||
|
||
- name: Test main endpoint | ||
run: curl --fail http://127.0.0.1:7500 | ||
|
||
- name: Test admin endpoint | ||
run: curl --fail http://127.0.0.1:7500/admin | ||
|
||
- name: Test send_message_management endpoint | ||
run: curl --fail http://127.0.0.1:7500/send_message_management/ | ||
|
||
- name: Test schedule_management endpoint | ||
run: curl --fail http://127.0.0.1:7500/schedule_management/ | ||
|
||
- name: Stop and remove Docker container | ||
run: docker rm -f yuyuwechatv2_client-container | ||
|
||
- name: Save Docker image to tar file | ||
run: docker save yuyuwechatv2_client -o yuyuwechatv2_client.tar | ||
|
||
- name: Compress Docker image tar file | ||
run: gzip yuyuwechatv2_client.tar | ||
|
||
- name: Modify permissions of the compressed file | ||
run: chmod 777 yuyuwechatv2_client.tar.gz | ||
|
||
- name: Check generated files and permissions | ||
run: | | ||
ls -lh | ||
ls -lh yuyuwechatv2_client.tar.gz | ||
- name: Upload release asset | ||
uses: actions/upload-release-asset@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }} | ||
with: | ||
upload_url: ${{ github.event.release.upload_url }} | ||
asset_path: /home/runner/work/YuYuWechatV2/YuYuWechatV2/YuYuWechatV2_Client/yuyuwechatv2_client.tar.gz | ||
asset_name: yuyuwechatv2_client.tar.gz | ||
asset_content_type: application/gzip | ||
|
||
- name: Upload release asset | ||
uses: actions/upload-release-asset@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }} | ||
with: | ||
upload_url: ${{ github.event.release.upload_url }} | ||
asset_path: /home/runner/work/YuYuWechatV2/YuYuWechatV2/YuYuWechatV2_Client/docker-compose.yml | ||
asset_name: docker-compose.yml | ||
asset_content_type: application/yaml | ||
|
||
|
||
- name: Log in to Docker Hub | ||
uses: docker/login-action@v2 | ||
with: | ||
username: ${{ secrets.DOCKER_USERNAME }} | ||
password: ${{ secrets.DOCKER_PASSWORD }} | ||
|
||
- name: Build and push Docker image | ||
uses: docker/build-push-action@v4 | ||
with: | ||
context: ./YuYuWechatV2_Client | ||
push: true | ||
tags: | | ||
${{ secrets.DOCKER_USERNAME }}/yuyuwechatv2_client:latest | ||
${{ secrets.DOCKER_USERNAME }}/yuyuwechatv2_client:${{ github.ref_name }} | ||
platforms: linux/amd64,linux/arm64 |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
name: Client_Unit Test When commit.yml | ||
|
||
on: | ||
push: | ||
branches: [ main ] | ||
pull_request: | ||
branches: [ main ] | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
defaults: | ||
run: | ||
working-directory: ./YuYuWechatV2_Client | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Set up Python 3.11 | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: 3.11 | ||
|
||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install -r requirements.txt | ||
pip install coverage | ||
- name: Run migrations | ||
run: python manage.py migrate | ||
|
||
- name: Run tests with coverage | ||
run: | | ||
coverage run --source='.' manage.py test --verbosity=3 | ||
coverage report | ||
coverage xml -o coverage.xml | ||
- name: Upload coverage reports to Codecov | ||
uses: codecov/[email protected] | ||
with: | ||
token: ${{ secrets.CODECOV_TOKEN }} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
name: server_Compile with PyInstaller | ||
|
||
on: | ||
release: | ||
types: [created] | ||
|
||
jobs: | ||
build: | ||
runs-on: windows-latest | ||
defaults: | ||
run: | ||
working-directory: ./YuYuWechatV2_Server | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Set up Python | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: '3.11' | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install -r requirements.txt | ||
- name: Compile with PyInstaller | ||
run: | | ||
pip install pyinstaller | ||
pyinstaller YuYuWechatV2_Server.spec | ||
- name: Run bat file and test | ||
id: run_test | ||
run: | | ||
Start-Process -FilePath "D:\a\YuYuWechatV2\YuYuWechatV2\YuYuWechatV2_Server\dist\YuYuWechatV2_Server_run.bat" -NoNewWindow | ||
Start-Sleep -Seconds 10 # 等待服务器启动 | ||
$response = Invoke-RestMethod -Uri http://127.0.0.1:8000/wechat/ping/ -UseBasicParsing | ||
Write-Output "Response: $response" | ||
if ($response.status -eq "pong") { | ||
Write-Output "Test passed" | ||
echo "test_passed=true" >> $env:GITHUB_ENV | ||
} else { | ||
Write-Output "Test failed" | ||
exit 1 | ||
} | ||
- name: Upload release exe | ||
if: env.test_passed == 'true' | ||
uses: actions/upload-release-asset@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }} | ||
with: | ||
upload_url: ${{ github.event.release.upload_url }} | ||
asset_path: D:\a\YuYuWechatV2\YuYuWechatV2\YuYuWechatV2_Server\dist\YuYuWechatV2_Server.exe | ||
asset_name: YuYuWechatV2_Server.exe | ||
asset_content_type: application/octet-stream | ||
- name: Upload release bat | ||
if: env.test_passed == 'true' | ||
uses: actions/upload-release-asset@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }} | ||
with: | ||
upload_url: ${{ github.event.release.upload_url }} | ||
asset_path: D:\a\YuYuWechatV2\YuYuWechatV2\YuYuWechatV2_Server\dist\YuYuWechatV2_Server_run.bat | ||
asset_name: YuYuWechatV2_Server_run.bat | ||
asset_content_type: application/octet-stream |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
name: server_Test When commit.yml | ||
|
||
on: | ||
push: | ||
pull_request: | ||
|
||
jobs: | ||
build: | ||
runs-on: windows-latest | ||
defaults: | ||
run: | ||
working-directory: ./YuYuWechatV2_Server | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Set up Python | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: '3.11' | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install -r requirements.txt | ||
- name: Compile with PyInstaller | ||
run: | | ||
pip install pyinstaller | ||
pyinstaller YuYuWechatV2_Server.spec | ||
- name: Run bat file and test | ||
id: run_test | ||
run: | | ||
Start-Process -FilePath "D:\a\YuYuWechatV2\YuYuWechatV2\YuYuWechatV2_Server\dist\YuYuWechatV2_Server_run.bat" -NoNewWindow | ||
Start-Sleep -Seconds 10 # 等待服务器启动 | ||
$response = Invoke-RestMethod -Uri http://127.0.0.1:8000/wechat/ping/ -UseBasicParsing | ||
Write-Output "Response: $response" | ||
if ($response.status -eq "pong") { | ||
Write-Output "Test passed" | ||
echo "test_passed=true" >> $env:GITHUB_ENV | ||
} else { | ||
Write-Output "Test failed" | ||
exit 1 | ||
} |
Oops, something went wrong.