Skip to content

Commit 936e6b9

Browse files
committed
updated workflow
1 parent d367153 commit 936e6b9

1 file changed

Lines changed: 35 additions & 22 deletions

File tree

.github/workflows/build.yml

Lines changed: 35 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,15 @@ jobs:
1515
include:
1616
- os: ubuntu-latest
1717
target: linux-amd64
18-
env: native
18+
env: linux-native
1919

2020
- os: ubuntu-latest
2121
target: linux-musl-aarch64
2222
env: alpine
2323

2424
- os: windows-latest
2525
target: windows-amd64
26-
env: native
26+
env: windows-native
2727

2828
- os: ubuntu-latest
2929
target: linux-bionic-aarch64
@@ -33,53 +33,70 @@ jobs:
3333
- name: Checkout Source Code
3434
uses: actions/checkout@v4
3535

36-
# --- NATIVE ENVIRONMENTS (Linux x86_64, Windows x86_64) ---
36+
# --- SETUP PYTHON FOR NATIVE RUNNERS ---
3737
- name: Set up Python
38-
if: ${{ matrix.env == 'native' }}
38+
if: ${{ matrix.env == 'linux-native' || matrix.env == 'windows-native' }}
3939
uses: actions/setup-python@v5
4040
with:
4141
python-version: '3.11'
4242

43-
- name: Build Native Binaries
44-
if: ${{ matrix.env == 'native' }}
43+
# --- LINUX NATIVE BUILD ---
44+
- name: Build Linux AMD64 Binary
45+
if: ${{ matrix.env == 'linux-native' }}
4546
run: |
4647
pip install pyinstaller click rich
47-
if [ "${{ matrix.os }}" = "windows-latest" ]; then
48-
pyinstaller --onefile --name=warpshare-windows-amd64 cli.py
49-
else
50-
pyinstaller --onefile --name=warpshare-linux-amd64 cli.py
51-
fi
48+
pyinstaller --onefile --name=warpshare-linux-amd64 cli.py
49+
50+
# --- WINDOWS NATIVE BUILD (Using PowerShell syntax) ---
51+
- name: Build Windows AMD64 Binary
52+
if: ${{ matrix.env == 'windows-native' }}
53+
shell: pwsh
54+
run: |
55+
pip install pyinstaller click rich
56+
pyinstaller --onefile --name=warpshare-windows-amd64 cli.py
5257
53-
# --- ALPINE ENVIROMENT (ARM64 / musl) ---
54-
- name: Set up QEMU Emulation
58+
# --- ALPINE ENVIRONMENT (ARM64 / musl) ---
59+
- name: Set up QEMU Emulation for Alpine
5560
if: ${{ matrix.env == 'alpine' }}
5661
uses: docker/setup-qemu-action@v3
5762

5863
- name: Build Alpine Binary
5964
if: ${{ matrix.env == 'alpine' }}
6065
run: |
61-
docker run --rm -v ${{ github.workspace }}:/work -w /work arm64v8/alpine:latest sh -c "
66+
docker run --rm --platform linux/arm64 -v ${{ github.workspace }}:/work -w /work arm64v8/alpine:latest sh -c "
6267
apk add --no-cache python3 py3-pip binutils build-essential python3-dev &&
6368
python3 -m venv venv &&
6469
./venv/bin/pip install pyinstaller click rich &&
6570
./venv/bin/pyinstaller --onefile --name=warpshare-linux-musl-aarch64 cli.py
6671
"
6772
6873
# --- TERMUX ENVIRONMENT (ARM64 / bionic) ---
74+
- name: Set up QEMU Emulation for Termux
75+
if: ${{ matrix.env == 'termux' }}
76+
uses: docker/setup-qemu-action@v3
77+
6978
- name: Build Termux Binary
7079
if: ${{ matrix.env == 'termux' }}
7180
run: |
72-
docker run --rm -v ${{ github.workspace }}:/work -w /work termux/termux-docker:aarch64 sh -c "
81+
docker run --rm --platform linux/arm64 -v ${{ github.workspace }}:/work -w /work termux/termux-docker:aarch64 sh -c "
7382
pkg update && pkg install -y python binutils build-essential clang &&
7483
pip install pyinstaller click rich &&
7584
pyinstaller --onefile --name=warpshare-linux-bionic-aarch64 cli.py
7685
"
7786
7887
# --- STAGE BINARIES ---
79-
- name: Stage Artifacts
88+
- name: Stage Artifacts (Linux)
89+
if: ${{ matrix.os == 'ubuntu-latest' }}
8090
run: |
8191
mkdir -p staging_binaries
82-
cp dist/warpshare-* staging_binaries/ 2>/dev/null || cp dist/warpshare-*.exe staging_binaries/ 2>/dev/null
92+
cp dist/warpshare-* staging_binaries/ 2>/dev/null || true
93+
94+
- name: Stage Artifacts (Windows)
95+
if: ${{ matrix.os == 'windows-latest' }}
96+
shell: pwsh
97+
run: |
98+
New-Item -ItemType Directory -Force -Path staging_binaries
99+
Copy-Item -Path dist\warpshare-*.exe -Destination staging_binaries\ -ErrorAction SilentlyContinue
83100
84101
- name: Upload Intermediary Artifacts
85102
uses: actions/upload-artifact@v4
@@ -105,19 +122,15 @@ jobs:
105122
- name: Organize and Commit to Binaries Folder
106123
run: |
107124
mkdir -p binaries
108-
109-
# Flatten downloaded artifacts into the target binaries directory
110125
find tmp_binaries -type f -exec cp {} binaries/ \;
111126
112-
# Configure Git
113127
git config --global user.name "github-actions[bot]"
114128
git config --global user.email "github-actions[bot]@users.noreply.github.com"
115129
116-
# Commit modifications directly back to the active repository branch
117130
git add binaries/
118131
if git diff --staged --quiet; then
119132
echo "No new changes detected in compiled binaries."
120133
else
121134
git commit -m "chore: automated compilation update for project binaries [skip ci]"
122135
git push origin HEAD:${{ github.ref_name }}
123-
find
136+
fi

0 commit comments

Comments
 (0)