Skip to content

Commit c616b08

Browse files
authored
Enhance CI workflows for Android and Python builds
Updated Android and Python workflows to enhance build and test processes, including stacktrace and warning-mode for Gradle commands. Added steps for lowercase Docker image naming and improved security audit execution. Signed-off-by: SpiralGang <Spiralgang@outlook.com>
1 parent faff43b commit c616b08

1 file changed

Lines changed: 36 additions & 25 deletions

File tree

.github/workflows/mobile-devops.yml

Lines changed: 36 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ permissions:
1111
contents: read
1212
actions: write
1313
security-events: write
14-
packages: write # Added this so the Docker job can actually push to GHCR
14+
packages: write # Required for pushing to GHCR
1515

1616
jobs:
1717
build-android:
@@ -20,20 +20,20 @@ jobs:
2020
steps:
2121
- name: Checkout repository
2222
uses: actions/checkout@v4
23-
23+
2424
- name: Setup JDK 17
2525
uses: actions/setup-java@v4
2626
with:
2727
distribution: 'temurin'
2828
java-version: '17'
29-
29+
3030
- name: Setup Android SDK
3131
uses: android-actions/setup-android@v3
3232
with:
3333
api-level: 34
3434
target: default
3535
arch: arm64-v8a
36-
36+
3737
- name: Cache Gradle dependencies
3838
uses: actions/cache@v4
3939
with:
@@ -42,18 +42,19 @@ jobs:
4242
~/.gradle/wrapper
4343
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
4444
restore-keys: ${{ runner.os }}-gradle-
45-
45+
4646
- name: Grant execute permission for gradlew
4747
run: chmod +x ./gradlew
48-
48+
49+
# FIXED: Added stacktrace and warning-mode to reveal build error details
4950
- name: Build Android App (ARM64)
5051
run: |
51-
./gradlew assembleDebug --info
52-
./gradlew assembleRelease --info
53-
52+
./gradlew assembleDebug --stacktrace --warning-mode=all
53+
./gradlew assembleRelease --stacktrace --warning-mode=all
54+
5455
- name: Run Android Tests
55-
run: ./gradlew test --info
56-
56+
run: ./gradlew test --stacktrace --warning-mode=all
57+
5758
- name: Archive APK artifacts
5859
uses: actions/upload-artifact@v4
5960
with:
@@ -68,35 +69,37 @@ jobs:
6869
steps:
6970
- name: Checkout repository
7071
uses: actions/checkout@v4
71-
72+
7273
- name: Setup Python 3.10
7374
uses: actions/setup-python@v4
7475
with:
7576
python-version: '3.10'
76-
77+
7778
- name: Cache Python dependencies
7879
uses: actions/cache@v4
7980
with:
8081
path: ~/.cache/pip
8182
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
8283
restore-keys: ${{ runner.os }}-pip-
83-
84+
8485
- name: Install Python dependencies
8586
run: |
8687
python -m pip install --upgrade pip
8788
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
88-
89+
8990
- name: Run Python mobile development tests
9091
run: |
9192
if [ -f scripts/test.py ]; then python scripts/test.py; fi
9293
if [ -f ai_dev_system.py ]; then python -m pytest ai_dev_system.py -v; fi
93-
94+
95+
# FIXED: Separated installation from execution.
96+
# Previously 'pip install ... safety check' tried to install a package named 'check'.
9497
- name: Security audit
9598
run: |
9699
pip install safety bandit
97100
safety check || true
98101
bandit -r . -f json -o bandit-report.json || true
99-
102+
100103
- name: Upload security report
101104
uses: actions/upload-artifact@v4
102105
with:
@@ -106,7 +109,6 @@ jobs:
106109
docker-image:
107110
name: Build ARM64 Docker Image
108111
runs-on: ubuntu-latest
109-
# FIXED: Removed the invalid 'hashFiles' check from here
110112
steps:
111113
- name: Checkout repository
112114
uses: actions/checkout@v4
@@ -120,6 +122,14 @@ jobs:
120122
echo "Dockerfile not found. Skipping build."
121123
echo "exists=false" >> $GITHUB_OUTPUT
122124
fi
125+
126+
# FIXED: New step to generate a lowercase repository name for Docker tags
127+
- name: Prepare Lowercase Image Name
128+
if: steps.check_docker.outputs.exists == 'true'
129+
id: prep
130+
run: |
131+
REPO_LOWER="$(echo "${{ github.repository }}" | tr '[:upper:]' '[:lower:]')"
132+
echo "image_name=$REPO_LOWER" >> $GITHUB_OUTPUT
123133
124134
- name: Set up Docker Buildx
125135
if: steps.check_docker.outputs.exists == 'true'
@@ -133,6 +143,7 @@ jobs:
133143
username: ${{ github.actor }}
134144
password: ${{ secrets.GITHUB_TOKEN }}
135145

146+
# FIXED: Using the lowercase name from the 'prep' step
136147
- name: Build and push ARM64 Docker image
137148
if: steps.check_docker.outputs.exists == 'true'
138149
uses: docker/build-push-action@v5
@@ -141,31 +152,31 @@ jobs:
141152
platforms: linux/arm64,linux/amd64
142153
push: true
143154
tags: |
144-
ghcr.io/${{ github.repository }}:latest
145-
ghcr.io/${{ github.repository }}:${{ github.sha }}
155+
ghcr.io/${{ steps.prep.outputs.image_name }}:latest
156+
ghcr.io/${{ steps.prep.outputs.image_name }}:${{ github.sha }}
146157
147158
mobile-compatibility-test:
148159
name: Mobile Compatibility & Performance Test
149160
runs-on: ubuntu-latest
150161
steps:
151162
- name: Checkout repository
152163
uses: actions/checkout@v4
153-
164+
154165
- name: Setup Node.js for mobile testing
155166
uses: actions/setup-node@v4
156167
with:
157168
node-version: '20'
158169
cache: 'npm'
159-
170+
160171
- name: Install dependencies
161172
run: npm ci
162-
173+
163174
- name: Run mobile compatibility checks
164175
run: |
165176
echo "Running mobile-first compatibility tests..."
166177
npm run lint --if-present
167178
npm run format --if-present
168-
179+
169180
- name: Test ARM64 compatibility
170181
run: |
171182
echo "Testing ARM64/AArch64 compatibility..."
@@ -184,7 +195,7 @@ jobs:
184195
steps:
185196
- name: Checkout repository
186197
uses: actions/checkout@v4
187-
198+
188199
- name: Archive comprehensive artifacts
189200
uses: actions/upload-artifact@v4
190201
with:

0 commit comments

Comments
 (0)