Update CI #12
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
name: build CI | |
on: | |
push: | |
branches: [master,main] | |
workflow_dispatch: | |
workflow_call: | |
jobs: | |
build: | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [macos-latest,ubuntu-latest,windows-latest,macos-13] | |
runs-on: ${{matrix.os}} | |
if: false | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: 3.8 | |
cache: 'pip' | |
cache-dependency-path: '**/requirements.txt' | |
- name: Cache | |
uses: actions/cache@v4 | |
with: | |
path: build/ | |
key: build-cache-${{ matrix.os }} | |
- name: Cache apt dependencies(for linux) | |
if: ${{runner.os == 'Linux'}} | |
uses: awalsh128/cache-apt-pkgs-action@latest | |
with: | |
packages: python3-tk | |
execute_install_scripts: true | |
- name: Install dependencies | |
run: pip install -r requirements.txt | |
- name: Build | |
run: pyinstaller -F --hidden-import=PIL._tkinter_finder --additional-hooks-dir=hooks main.py -n vcbot-bili -i .res/icon.ico | |
- name: Copy plugins | |
run: cp -r plugins ./dist | |
- name: pack | |
run: 7z a -tzip vcbots-bili-${{runner.os}}-${{runner.arch}}.zip ./dist | |
- name: Upload | |
uses: actions/upload-artifact@v4 | |
with: | |
name: build-${{matrix.os}} | |
path: ./vcbots-bili-${{runner.os}}-${{runner.arch}}.zip | |
make_bundle: | |
name: Make bundle | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [macos-latest,ubuntu-latest,macos-13] | |
runs-on: ${{matrix.os}} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Download Python | |
uses: robinraju/release-downloader@v1 | |
with: | |
repository: luyanci/python-prebuilt | |
tag: Python-v3.8.19-2024-09-30.28 | |
fileName: python-${{runner.os}}-${{runner.arch}}.zip | |
- name: Unzip | |
run: | | |
unzip python-${{runner.os}}-${{runner.arch}}.zip | |
mv python-build runtime | |
rm python-${{runner.os}}-${{runner.arch}}.zip | |
- name: Clean | |
run: rm -rf .env.example .gitignore README.md .github .git .res run.bat | |
- name: Install requirements | |
run: | | |
./runtime/bin/python3 -m pip install --upgrade pip | |
./runtime/bin/python3 -m pip install -r requirements.txt | |
- name: Pack | |
run: 7z a -tzip vcbots-bili-${{matrix.os}}-${{runner.arch}}.zip . | |
- name: Upload | |
uses: actions/upload-artifact@v4 | |
with: | |
name: bundle-${{matrix.os}} | |
path: ./vcbots-bili-${{matrix.os}}-${{runner.arch}}.zip | |
make_bundle_win: | |
name: Make bundle(windows) | |
runs-on: windows-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Download Python | |
run: Invoke-Webrequest https://www.python.org/ftp/python/3.8.10/python-3.8.10-embed-amd64.zip -OutFile python-3.8.10-embed-amd64.zip | |
- name: Unzip | |
run: | | |
Expand-Archive python-3.8.10-embed-amd64.zip -DestinationPath runtime | |
- name: Clean | |
run: | | |
Remove-Item -Path .github -Recurse | |
cmd /c "del .gitignore /s /q" | |
cmd /c "del README.md /s /q" | |
cmd /c "del .env.example /s /q" | |
cmd /c "del run.sh /s /q" | |
- name: Get pip | |
run: | | |
Invoke-Webrequest https://bootstrap.pypa.io/get-pip.py -OutFile get-pip.py | |
runtime/python.exe get-pip.py --no-warn-script-location --target runtime | |
- name: Install requirements | |
run: | | |
runtime/python.exe -m pip install --upgrade pip | |
runtime/python.exe -m pip install -r requirements.txt | |
- name: Pack | |
run: 7z a -tzip vcbots-bili-${{runner.os}}-${{runner.arch}}.zip . | |
- name: Upload | |
uses: actions/upload-artifact@v4 | |
with: | |
name: bundle-win | |
path: ./vcbots-bili-${{runner.os}}-${{runner.arch}}.zip | |
make_bundle_no_runtime: | |
name: Make bundle(No Runtime) | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Clean | |
run: | | |
rm -rf .env.example .gitignore README.md .github .git .res | |
rm -rf run.bat | |
rm -rf run.sh | |
- name: Pack | |
run: 7z a -tzip vcbots-bili-source.zip . | |
- name: Upload | |
uses: actions/upload-artifact@v4 | |
with: | |
name: bundle-source | |
path: ./vcbots-bili-source.zip |