Skip to content

Commit 220c308

Browse files
Copilotgfauredev
andcommitted
Implement all problem statement requirements
- flake.nix: add androidBuilder package + androidBuild app (build & sign APK) - flake.nix: add androidE2eTester package + androidE2eTest app (Maestro Android) - flake.nix: expand coverage --ignore-filename-regex to exclude non-project files - ci.yml: coverage PR comment now shows COVERED/TOTAL line count - ci.yml: lighthouse table now includes PWA column - cd.yml: use nix run .#androidBuild instead of nix develop -c dx build + sign.sh - weekly.yml: use nix run .#androidE2eTest instead of nix develop -c maestro test Co-authored-by: gfauredev <19304085+gfauredev@users.noreply.github.com>
1 parent 231617c commit 220c308

4 files changed

Lines changed: 46 additions & 15 deletions

File tree

.github/workflows/cd.yml

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -90,9 +90,7 @@ jobs:
9090
fileName: 'logout.jks'
9191
encodedString: ${{ secrets.ANDROID_KEYSTORE_B64 }}
9292
id: keystore
93-
- run: |
94-
nix develop -c dx build --android --release --target aarch64-linux-android # --locked --offline
95-
scripts/android-sign.sh # Sign APK(s) and copy here, with architecture
93+
- run: nix run .#androidBuild
9694
env:
9795
ANDROID_KEYSTORE_PATH: ${{ steps.keystore.outputs.filePath }}
9896
ANDROID_KEY_PASSWORD: ${{ secrets.ANDROID_KEY_PASSWORD }}
@@ -155,9 +153,7 @@ jobs:
155153
fileName: 'logout.jks'
156154
encodedString: ${{ secrets.ANDROID_KEYSTORE_B64 }}
157155
id: keystore
158-
- run: |
159-
nix develop -c dx build --android --release --target aarch64-linux-android # --locked --offline
160-
scripts/android-sign.sh # Sign APK(s) and copy here, with architecture
156+
- run: nix run .#androidBuild
161157
env:
162158
ANDROID_KEYSTORE_PATH: ${{ steps.keystore.outputs.filePath }}
163159
ANDROID_KEY_PASSWORD: ${{ secrets.ANDROID_KEY_PASSWORD }}

.github/workflows/ci.yml

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,15 @@ jobs:
4848
- run: | # Process Coverage
4949
REPORT=$(grep -o "<table>.*</table>" coverage/html/index.html)
5050
PERCENT=$(jq '.data[0].totals.lines.percent' coverage/coverage.json)
51+
COVERED=$(jq '.data[0].totals.lines.covered' coverage/coverage.json)
52+
TOTAL=$(jq '.data[0].totals.lines.count' coverage/coverage.json)
5153
echo "REPORT<<EOF" >> $GITHUB_OUTPUT
5254
echo -e "$REPORT" >> $GITHUB_OUTPUT
5355
echo "EOF" >> $GITHUB_OUTPUT
5456
echo "PERCENT=$PERCENT" >> $GITHUB_OUTPUT
55-
echo "Coverage is $PERCENT%"
57+
echo "COVERED=$COVERED" >> $GITHUB_OUTPUT
58+
echo "TOTAL=$TOTAL" >> $GITHUB_OUTPUT
59+
echo "Coverage is $PERCENT% ($COVERED/$TOTAL lines)"
5660
if (( $(echo "$PERCENT < 80" | bc -l) )); then
5761
echo "❌ Coverage below 80%"
5862
echo "FAILED=true" >> $GITHUB_OUTPUT # Store failure for next step
@@ -66,7 +70,9 @@ jobs:
6670
issue-number: ${{ github.event.pull_request.number }}
6771
body: |
6872
### 📊 Coverage Report
69-
73+
74+
**Lines: ${{ steps.coverage_report.outputs.COVERED }}/${{ steps.coverage_report.outputs.TOTAL }} (${{ steps.coverage_report.outputs.PERCENT }}%)**
75+
7076
${{ steps.coverage_report.outputs.REPORT }}
7177
- run: |
7278
if [ "${{ steps.coverage_report.outputs.FAILED }}" == "true" ]; then
@@ -103,15 +109,16 @@ jobs:
103109
echo "### 🚀 Lighthouse Audit" > "$TMPFILE"
104110
if [ -f .lighthouseci/manifest.json ]; then
105111
echo "" >> "$TMPFILE"
106-
echo "| URL | Performance | Accessibility | Best Practices | SEO |" >> "$TMPFILE"
107-
echo "| --- | --- | --- | --- | --- |" >> "$TMPFILE"
112+
echo "| URL | Performance | Accessibility | Best Practices | SEO | PWA |" >> "$TMPFILE"
113+
echo "| --- | --- | --- | --- | --- | --- |" >> "$TMPFILE"
108114
jq -r '.[] |
109115
(.url | sub("http://localhost:[0-9]*/"; "")) as $url |
110116
(.summary.performance // 0 | . * 100 | floor) as $perf |
111117
(.summary.accessibility // 0 | . * 100 | floor) as $a11y |
112118
(.summary["best-practices"] // 0 | . * 100 | floor) as $bp |
113119
(.summary.seo // 0 | . * 100 | floor) as $seo |
114-
"| `\($url)` | \($perf) | \($a11y) | \($bp) | \($seo) |"
120+
(.summary.pwa // 0 | . * 100 | floor) as $pwa |
121+
"| `\($url)` | \($perf) | \($a11y) | \($bp) | \($seo) | \($pwa) |"
115122
' .lighthouseci/manifest.json >> "$TMPFILE"
116123
fi
117124
LINKS='${{ steps.lighthouse_audit.outputs.links }}'

.github/workflows/weekly.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,7 @@ jobs:
7878
disable-animations: true
7979
script: |
8080
adb install -r LogOut.arm64-v8a.apk
81-
# $HOME/.maestro/bin/maestro test --headless maestro/android
82-
nix develop -c maestro test --headless maestro/android
81+
nix run .#androidE2eTest
8382
- if: failure()
8483
uses: actions/upload-artifact@v7
8584
with:

flake.nix

Lines changed: 31 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,25 @@
200200
maestro test --headless "${self}/maestro/web"
201201
'';
202202
};
203+
androidBuilder = env.pkgs.writeShellApplication {
204+
name = "logout-android-builder";
205+
runtimeInputs = env.commonNativeBuildInputs ++ env.androidNativeBuildInputs;
206+
text = ''
207+
export ANDROID_HOME="${env.androidComposition.androidsdk}/libexec/android-sdk"
208+
export ANDROID_NDK_HOME="${env.androidComposition.ndk-bundle}/libexec/android-sdk/ndk-bundle"
209+
export GRADLE_USER_HOME="''${GRADLE_USER_HOME:-$PWD/.gradle}"
210+
export HOME="''${HOME:-$TMPDIR}"
211+
dx build --android --release --target aarch64-linux-android
212+
"${self}/scripts/android-sign.sh"
213+
'';
214+
};
215+
androidE2eTester = env.pkgs.writeShellApplication {
216+
name = "logout-android-e2e-tester";
217+
runtimeInputs = [ env.pkgs.maestro ];
218+
text = ''
219+
maestro test --headless "${self}/maestro/android"
220+
'';
221+
};
203222
default = env.pkgs.symlinkJoin {
204223
name = "logout-all";
205224
paths = [
@@ -220,6 +239,16 @@
220239
program = "${self.packages.${system}.pagesE2eTester}/bin/logout-pages-e2e-tester";
221240
meta.description = "Run E2E tests against PWA";
222241
};
242+
androidBuild = {
243+
type = "app";
244+
program = "${self.packages.${system}.androidBuilder}/bin/logout-android-builder";
245+
meta.description = "Build and sign Android APK";
246+
};
247+
androidE2eTest = {
248+
type = "app";
249+
program = "${self.packages.${system}.androidE2eTester}/bin/logout-android-e2e-tester";
250+
meta.description = "Run Maestro Android E2E tests";
251+
};
223252
default = {
224253
type = "app";
225254
program = "${self.packages.${system}.pagesServer}/bin/logout-pages";
@@ -309,10 +338,10 @@
309338
export HOME=$TMPDIR
310339
mkdir -p $out
311340
cargo llvm-cov --bin log-out \
312-
--ignore-filename-regex "src/components/" \
341+
--ignore-filename-regex "(src/components/|\.cargo/registry/|/rustc/)" \
313342
--html --output-dir $out # /html auto added
314343
cargo llvm-cov --bin log-out \
315-
--ignore-filename-regex "src/components/" \
344+
--ignore-filename-regex "(src/components/|\.cargo/registry/|/rustc/)" \
316345
--json > $out/coverage.json
317346
'';
318347
installPhase = "true";

0 commit comments

Comments
 (0)