Skip to content

Merge pull request #9 from liulifox233/master #36

Merge pull request #9 from liulifox233/master

Merge pull request #9 from liulifox233/master #36

Workflow file for this run

name: build
on:
workflow_dispatch:
push:
branches:
- master
jobs:
build-windows:
runs-on: windows-latest
env:
PYTHONIOENCODING: utf-8
PYTHONOPTIMIZE: 1
steps:
- uses: actions/checkout@v3
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: "3.10"
cache: pip
cache-dependency-path: requirements.txt
- name: Setup MSVC
uses: ilammy/msvc-dev-cmd@v1
- name: Cache nuitka dependencies
uses: actions/cache@v3
with:
path: ~/AppData/Local/Nuitka/Nuitka/Cache
key: windows-nuitka
- name: Install pip dependencies
run: |
pip install -U -r requirements.txt
pip install -U nuitka zstandard ordered-set
- name: Build executable
run: |
'COMMIT_HASH = "' + (git rev-parse HEAD) + '"' | Out-File -Encoding ascii xdnmb/version.py
nuitka --standalone --assume-yes-for-downloads main.py
mv main.dist/main.exe main.dist/xdcmd.exe
rm -r main.dist/zstandard -ErrorAction SilentlyContinue
rm main.dist/api-ms-win-*.dll -ErrorAction SilentlyContinue
rm main.dist/ucrtbase.dll -ErrorAction SilentlyContinue
rm main.dist/_asyncio.pyd -ErrorAction SilentlyContinue
rm main.dist/_bz2.pyd -ErrorAction SilentlyContinue
rm main.dist/_decimal.pyd -ErrorAction SilentlyContinue
rm main.dist/_elementtree.pyd -ErrorAction SilentlyContinue
rm main.dist/_hashlib.pyd -ErrorAction SilentlyContinue
rm main.dist/_lzma.pyd -ErrorAction SilentlyContinue
rm main.dist/_multiprocessing.pyd -ErrorAction SilentlyContinue
rm main.dist/_queue.pyd -ErrorAction SilentlyContinue
rm main.dist/_uuid.pyd -ErrorAction SilentlyContinue
cp README.md main.dist/README.md
- name: Upload result
uses: actions/upload-artifact@v3
with:
if-no-files-found: error
name: xdcmd-windows
path: main.dist
- name: Setup UPX
run: choco install --no-progress upx
- name: Compress with UPX
run: |
foreach ($f in (Get-ChildItem -Include ("*.pyd", "*.dll", "*.exe") -Exclude "vcruntime140.dll" -Recurse "main.dist")) {
upx --ultra-brute --no-progress $f.FullName
}
- name: Upload result (upx)
uses: actions/upload-artifact@v3
with:
if-no-files-found: error
name: xdcmd-windows-upx
path: main.dist
- name: Build executable (onefile)
run: |
nuitka --standalone --onefile --assume-yes-for-downloads --output-filename=xdcmd.exe main.py
- name: Upload result (onefile)
uses: actions/upload-artifact@v3
with:
if-no-files-found: error
name: xdcmd-windows-onefile
path: |
xdcmd.exe
README.md
build-ubuntu:
runs-on: ubuntu-latest
env:
PYTHONIOENCODING: utf-8
PYTHONOPTIMIZE: 1
steps:
- uses: actions/checkout@v3
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: "3.10"
cache: pip
cache-dependency-path: requirements.txt
- name: Cache nuitka dependencies
uses: actions/cache@v3
with:
path: ~/.cache/Nuitka
key: ubuntu-nuitka
- name: Install pip dependencies
run: |
pip install -U -r requirements.txt
pip install -U nuitka zstandard ordered-set
sudo apt install patchelf ccache
- name: Build executable
run: |
echo COMMIT_HASH = \"$(git rev-parse HEAD)\" > xdnmb/version.py
python3 -m nuitka --standalone --assume-yes-for-downloads main.py
mv main.dist/main.bin main.dist/xdcmd
chmod +x main.dist/xdcmd
rm -rf main.dist/zstandard
rm -f main.dist/audioop.so
rm -f main.dist/_asyncio.so
rm -f main.dist/_bisect.so
rm -f main.dist/_bz2.so
rm -f main.dist/_codecs_*.so
rm -f main.dist/_crypt.so
rm -f main.dist/_csv.so
rm -f main.dist/_ctypes.so
rm -f main.dist/_datetime.so
rm -f main.dist/_dbm.so
rm -f main.dist/_decimal.so
rm -f main.dist/_elementtree.so
rm -f main.dist/_heapq.so
rm -f main.dist/_lzma.so
rm -f main.dist/_multiprocessing.so
rm -f main.dist/_opcode.so
rm -f main.dist/_pickle.so
rm -f main.dist/_posixshmem.so
rm -f main.dist/_queue.so
rm -f main.dist/_sha512.so
rm -f main.dist/_statistics.so
rm -f main.dist/_uuid.so
rm -f main.dist/fcntl.so
rm -f main.dist/grp.so
rm -f main.dist/libbz2.so.*
rm -f main.dist/libcrypto.so.*
rm -f main.dist/libffi.so.*
rm -f main.dist/libgdbm.so.*
rm -f main.dist/libgdbm_compat.so.*
rm -f main.dist/liblzma.so.*
rm -f main.dist/libreadline.so.*
rm -f main.dist/libssl.so.*
rm -f main.dist/libtinfo.so.*
rm -f main.dist/libuuid.so.*
rm -f main.dist/mmap.so
rm -f main.dist/readline.so
cp README.md main.dist/README.md
mv main.dist xdcmd-ubuntu
XZ_OPT=-9e tar Jcf xdcmd-ubuntu.tar.xz xdcmd-ubuntu
- name: Upload result
uses: actions/upload-artifact@v3
with:
if-no-files-found: error
name: xdcmd-ubuntu
path: xdcmd-ubuntu.tar.xz
- name: Build executable (onefile)
run: |
python3 -m nuitka --standalone --onefile --assume-yes-for-downloads --output-filename=xdcmd main.py
mkdir xdcmd-ubuntu-onefile
mv xdcmd xdcmd-ubuntu-onefile/xdcmd
chmod +x xdcmd-ubuntu-onefile/xdcmd
cp README.md xdcmd-ubuntu-onefile/README.md
XZ_OPT=-9e tar Jcf xdcmd-ubuntu-onefile.tar.xz xdcmd-ubuntu-onefile
- name: Upload result (onefile)
uses: actions/upload-artifact@v3
with:
if-no-files-found: error
name: xdcmd-ubuntu-onefile
path: xdcmd-ubuntu-onefile.tar.xz
build-macos-arm64:
runs-on: macos-latest
env:
PYTHONIOENCODING: utf-8
PYTHONOPTIMIZE: 1
steps:
- uses: actions/checkout@v3
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: "3.10"
cache: pip
cache-dependency-path: requirements.txt
- name: Cache nuitka dependencies
uses: actions/cache@v3
with:
path: ~/.cache/xdcmd
key: macos-arm64-nuitka
- name: Install pip dependencies
run: |
pip install -U -r requirements.txt
pip install -U nuitka zstandard ordered-set
brew install patchelf ccache
- name: Build executable
run: |
echo COMMIT_HASH = \"$(git rev-parse HEAD)\" > xdnmb/version.py
python3 -m nuitka --standalone --assume-yes-for-downloads main.py
mv main.dist/main.bin main.dist/xdcmd
chmod +x main.dist/xdcmd
cp README.md main.dist/README.md
mv main.dist xdcmd-macos-arm64
XZ_OPT=-9e tar Jcf xdcmd-macos-arm64.tar.xz xdcmd-macos-arm64
- name: Upload result
uses: actions/upload-artifact@v3
with:
if-no-files-found: error
name: xdcmd-macos-arm64
path: xdcmd-macos-arm64.tar.xz
- name: Build executable (onefile)
run: |
python3 -m nuitka --standalone --onefile --assume-yes-for-downloads --output-filename=xdcmd main.py
mkdir xdcmd-macos-arm64-onefile
mv xdcmd xdcmd-macos-arm64-onefile/xdcmd
chmod +x xdcmd-macos-arm64-onefile/xdcmd
cp README.md xdcmd-macos-arm64-onefile/README.md
XZ_OPT=-9e tar Jcf xdcmd-macos-arm64-onefile.tar.xz xdcmd-macos-arm64-onefile
- name: Upload result (onefile)
uses: actions/upload-artifact@v3
with:
if-no-files-found: error
name: xdcmd-macos-arm64-onefile
path: xdcmd-macos-arm64-onefile.tar.xz
build-macos-x86:
runs-on: macos-13
env:
PYTHONIOENCODING: utf-8
PYTHONOPTIMIZE: 1
steps:
- uses: actions/checkout@v3
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: "3.10"
cache: pip
cache-dependency-path: requirements.txt
- name: Cache nuitka dependencies
uses: actions/cache@v3
with:
path: ~/.cache/xdcmd
key: macos-x86-nuitka
- name: Install pip dependencies
run: |
pip install -U -r requirements.txt
pip install -U nuitka zstandard ordered-set
brew install patchelf ccache
- name: Build executable
run: |
echo COMMIT_HASH = \"$(git rev-parse HEAD)\" > xdnmb/version.py
python3 -m nuitka --standalone --assume-yes-for-downloads main.py
mv main.dist/main.bin main.dist/xdcmd
chmod +x main.dist/xdcmd
cp README.md main.dist/README.md
mv main.dist xdcmd-macos-x86
XZ_OPT=-9e tar Jcf xdcmd-macos-x86.tar.xz xdcmd-macos-x86
- name: Upload result
uses: actions/upload-artifact@v3
with:
if-no-files-found: error
name: xdcmd-macos-x86
path: xdcmd-macos-x86.tar.xz
- name: Build executable (onefile)
run: |
python3 -m nuitka --standalone --onefile --assume-yes-for-downloads --output-filename=xdcmd main.py
mkdir xdcmd-macos-x86-onefile
mv xdcmd xdcmd-macos-x86-onefile/xdcmd
chmod +x xdcmd-macos-x86-onefile/xdcmd
cp README.md xdcmd-macos-x86-onefile/README.md
XZ_OPT=-9e tar Jcf xdcmd-macos-x86-onefile.tar.xz xdcmd-macos-x86-onefile
- name: Upload result (onefile)
uses: actions/upload-artifact@v3
with:
if-no-files-found: error
name: xdcmd-macos-x86-onefile
path: xdcmd-macos-x86-onefile.tar.xz