Skip to content

Commit eef59e5

Browse files
committed
Simplify and improve GitHub Actions workflow reliability
1 parent e1ad364 commit eef59e5

File tree

1 file changed

+57
-37
lines changed

1 file changed

+57
-37
lines changed

.github/workflows/build-release.yml

Lines changed: 57 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ jobs:
1010
build:
1111
runs-on: ${{ matrix.os }}
1212
strategy:
13+
fail-fast: false
1314
matrix:
1415
include:
1516
- os: windows-latest
@@ -35,46 +36,53 @@ jobs:
3536
python -m pip install --upgrade pip
3637
pip install pyinstaller
3738
39+
- name: Test Python application first
40+
run: |
41+
echo "Testing Python application..."
42+
python main.py --test &
43+
sleep 5
44+
pkill -f "python main.py" || true
45+
echo "Python test completed"
46+
shell: bash
47+
3848
- name: Create PyInstaller spec file
39-
run: python build_spec.py
49+
run: |
50+
echo "Creating spec file..."
51+
python build_spec.py
52+
echo "Spec file created. Contents:"
53+
cat android-bloatware-remover.spec
4054
4155
- name: Build with PyInstaller
4256
run: |
4357
echo "Building with PyInstaller..."
44-
echo "Current directory: $(pwd)"
45-
echo "Files in current directory:"
46-
ls -la
47-
echo "Building executable..."
48-
pyinstaller android-bloatware-remover.spec --clean --log-level INFO
58+
pyinstaller android-bloatware-remover.spec --clean --noconfirm
4959
echo "Build completed. Checking dist directory:"
50-
ls -la dist/ || echo "dist directory not found"
60+
ls -la dist/
5161
52-
- name: Test executable (Windows)
53-
if: matrix.os == 'windows-latest'
54-
run: |
55-
echo "Testing Windows executable..."
56-
if (Test-Path "dist/android-bloatware-remover.exe") {
57-
echo "Executable exists, running test..."
58-
Start-Process -FilePath "dist/android-bloatware-remover.exe" -ArgumentList "--test" -Wait -NoNewWindow -PassThru
59-
} else {
60-
echo "Executable not found!"
61-
exit 1
62-
}
63-
shell: powershell
64-
timeout-minutes: 2
65-
66-
- name: Test executable (Unix)
67-
if: matrix.os != 'windows-latest'
62+
- name: Test executable
6863
run: |
69-
echo "Testing Unix executable..."
70-
if [ -f "dist/android-bloatware-remover" ]; then
71-
echo "Executable exists, running test..."
72-
chmod +x dist/android-bloatware-remover
73-
timeout 30s dist/android-bloatware-remover --test || echo "Test completed with timeout"
64+
echo "Testing executable..."
65+
if [ "${{ matrix.os }}" = "windows-latest" ]; then
66+
if [ -f "dist/android-bloatware-remover.exe" ]; then
67+
echo "Windows executable found"
68+
# Just check if it starts without hanging
69+
timeout 10s dist/android-bloatware-remover.exe --test || echo "Test completed"
70+
else
71+
echo "Windows executable not found!"
72+
exit 1
73+
fi
7474
else
75-
echo "Executable not found!"
76-
exit 1
75+
if [ -f "dist/android-bloatware-remover" ]; then
76+
echo "Unix executable found"
77+
chmod +x dist/android-bloatware-remover
78+
# Just check if it starts without hanging
79+
timeout 10s dist/android-bloatware-remover --test || echo "Test completed"
80+
else
81+
echo "Unix executable not found!"
82+
exit 1
83+
fi
7784
fi
85+
shell: bash
7886

7987
- name: Upload artifact
8088
uses: actions/upload-artifact@v4
@@ -97,10 +105,25 @@ jobs:
97105
run: |
98106
echo "Current directory contents:"
99107
ls -la
100-
echo "Looking for artifact directories:"
108+
echo "Looking for executables:"
101109
find . -name "*android-bloatware-remover*" -type f
102-
echo "All files:"
103-
find . -type f
110+
echo "Preparing files for release..."
111+
112+
- name: Prepare release files
113+
run: |
114+
mkdir -p release
115+
# Copy and rename files for release
116+
if [ -f "android-bloatware-remover-windows.exe/android-bloatware-remover.exe" ]; then
117+
cp "android-bloatware-remover-windows.exe/android-bloatware-remover.exe" "release/android-bloatware-remover-windows.exe"
118+
fi
119+
if [ -f "android-bloatware-remover-linux/android-bloatware-remover" ]; then
120+
cp "android-bloatware-remover-linux/android-bloatware-remover" "release/android-bloatware-remover-linux"
121+
fi
122+
if [ -f "android-bloatware-remover-macos/android-bloatware-remover" ]; then
123+
cp "android-bloatware-remover-macos/android-bloatware-remover" "release/android-bloatware-remover-macos"
124+
fi
125+
echo "Release files prepared:"
126+
ls -la release/
104127
105128
- name: Create Release
106129
uses: softprops/action-gh-release@v2
@@ -140,8 +163,5 @@ jobs:
140163
Run with `--test` flag to try without a connected device.
141164
draft: false
142165
prerelease: false
143-
files: |
144-
android-bloatware-remover-windows.exe/*
145-
android-bloatware-remover-linux/*
146-
android-bloatware-remover-macos/*
166+
files: release/*
147167
fail_on_unmatched_files: false

0 commit comments

Comments
 (0)