Skip to content

Commit

Permalink
split npm compatibility tests into npm/npx tests (icloud-photos-downl…
Browse files Browse the repository at this point in the history
  • Loading branch information
AndreyNikiforov committed Apr 16, 2024
1 parent 285a3ec commit 7459671
Show file tree
Hide file tree
Showing 11 changed files with 644 additions and 18 deletions.
627 changes: 619 additions & 8 deletions .github/workflows/build-package.yml

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion npm/@icloudpd/darwin-arm64/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
},
"license": "MIT",
"engines": {
"node": ">=12"
"node": ">=6"
},
"preferUnplugged": true,
"os": [
Expand Down
2 changes: 1 addition & 1 deletion npm/@icloudpd/darwin-x64/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
},
"license": "MIT",
"engines": {
"node": ">=12"
"node": ">=6"
},
"preferUnplugged": true,
"os": [
Expand Down
2 changes: 1 addition & 1 deletion npm/@icloudpd/linux-arm/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
},
"license": "MIT",
"engines": {
"node": ">=12"
"node": ">=6"
},
"preferUnplugged": true,
"os": [
Expand Down
2 changes: 1 addition & 1 deletion npm/@icloudpd/linux-arm64/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
},
"license": "MIT",
"engines": {
"node": ">=12"
"node": ">=6"
},
"preferUnplugged": true,
"os": [
Expand Down
2 changes: 1 addition & 1 deletion npm/@icloudpd/linux-ia32/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
},
"license": "MIT",
"engines": {
"node": ">=12"
"node": ">=6"
},
"preferUnplugged": true,
"os": [
Expand Down
2 changes: 1 addition & 1 deletion npm/@icloudpd/linux-x64/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
},
"license": "MIT",
"engines": {
"node": ">=12"
"node": ">=6"
},
"preferUnplugged": true,
"os": [
Expand Down
2 changes: 1 addition & 1 deletion npm/@icloudpd/win32-x64/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"license": "MIT",
"preferUnplugged": true,
"engines": {
"node": ">=12"
"node": ">=6"
},
"os": [
"win32"
Expand Down
2 changes: 1 addition & 1 deletion npm/icloudpd/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"version": "0.0.1",
"description": "iCloud Photo Downloader",
"engines": {
"node": ">=12"
"node": ">=6"
},
"bin": {
"icloudpd": "bin/icloudpd.js"
Expand Down
8 changes: 6 additions & 2 deletions scripts/compile_compatibility
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,13 @@ import os
import sys
import itertools

def normalize(files):
presort = [ "pass", "fail", "na" ]
return [(list(g) + [ [0, k.split('.')[0], k.split('.')[1], k.split('.')[2], 'na'] ])[0] for (k, g) in itertools.groupby(sorted(files, key = lambda k: f"{k[1]}.{k[2]}.{k[3]}.{presort.index(k[4]) if k[4] in presort else 9}"), key = lambda k: f"{k[1]}.{k[2]}.{k[3]}")]

def stats(files):
""" Print statistics """
total = len(files)
total = len([f for f in files if f[4] != 'na'])
passed = len([f for f in files if f[4] == 'pass'])
print(f"Compatibility rate: {round(100*passed/total,1) if total > 0 else 0}% ({passed} passed out of {total})")
print("")
Expand All @@ -25,7 +29,7 @@ def matrix(files):
oses = [k for k, _ in itertools.groupby(sorted(files, key = lambda ft: ft[2]), key = lambda ft: ft[2])]
for o in oses:
results_raw = [list(filter(lambda ft: ft[2] == o and ft[3] == a, files)) for a in archs_sorted]
results = ["N/A" if len(r) == 0 else (r[0][4] + ("" if r[0][0] == 0 else " (src)")) for r in results_raw]
results = ["N/A" if len(r) == 0 or r[0][4] == "na" else (r[0][4] + ("" if r[0][0] == 0 else " (src)")) for r in results_raw]
print('|'.join([o] + results))

def main():
Expand Down
11 changes: 11 additions & 0 deletions scripts/npx_optional
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/bash
set -euo pipefail

if [ `which npx` ]; then
echo "test icloudpd..." &&
npx ${@:3} &&
touch $1
else
echo "No npx available"
touch $2
fi

0 comments on commit 7459671

Please sign in to comment.