From 7df2311a98f08417b7c29ad3580eadd9c748a4cd Mon Sep 17 00:00:00 2001 From: Andrey Nikiforov Date: Wed, 10 Jul 2024 21:30:03 -0700 Subject: [PATCH] Fix compat & tz/locale tests (#905) --- .github/workflows/build-package.yml | 897 ++++++++++++++++++++++++---- Dockerfile | 16 +- scripts/compile_compatibility | 57 -- scripts/compile_compatibility.py | 21 + scripts/compile_matrix.py | 68 +++ scripts/compile_tzlc.py | 35 ++ scripts/npx_optional | 3 +- scripts/npx_optional_touch | 11 + 8 files changed, 919 insertions(+), 189 deletions(-) delete mode 100755 scripts/compile_compatibility create mode 100755 scripts/compile_compatibility.py create mode 100755 scripts/compile_matrix.py create mode 100755 scripts/compile_tzlc.py create mode 100755 scripts/npx_optional_touch diff --git a/.github/workflows/build-package.yml b/.github/workflows/build-package.yml index 5885b0d6b..b4f46ed29 100644 --- a/.github/workflows/build-package.yml +++ b/.github/workflows/build-package.yml @@ -47,7 +47,45 @@ jobs: path: | dist/icloud*.whl - build_linux_1: + get_expected_version: + runs-on: ubuntu-22.04 + defaults: + run: + shell: bash + + steps: + - uses: actions/checkout@v4 + + - name: Download version info + uses: actions/download-artifact@v4 + with: + name: icloudpd-${{github.sha}}-version-info + path: | + src/foundation + + - name: Set up Python 3.12 + uses: actions/setup-python@v5 + with: + python-version: '3.12' + + - name: Install Dev dependencies + run: > + export DEBIAN_FRONTEND=noninteractive && sudo apt-get update && sudo apt-get install -y tzdata locales-all && + pip3 install --disable-pip-version-check -e . + + - name: Get Version + id: get_version + run: | + echo expected_version=$(TZ=America/Los_Angeles LC_ALL=ru_RU.UTF-8 icloudpd --use-os-locale --version) >> $GITHUB_OUTPUT + + - name: Log version + run: | + echo "expected_version=${{steps.get_version.outputs.expected_version}}" + + outputs: + expected_version: ${{steps.get_version.outputs.expected_version}} + + build_linux_apt: runs-on: ubuntu-22.04 strategy: fail-fast: false @@ -95,7 +133,7 @@ jobs: # TOOLCHAIN_NAME: ${{ matrix.BUILD_PROP[1] }} # SUFFIX: ${{ matrix.BUILD_PROP[2] }} - name: Build Linux Binary for "${{ matrix.BUILD_PROP[0] }}" with Debian + name: Build Linux ${{ matrix.BUILD_PROP[0] }} Debian defaults: run: shell: bash @@ -145,19 +183,20 @@ jobs: echo "convert to static binary..." && scripts/build_bin_linux_static ${{inputs.icloudpd_version}} ${{ matrix.BUILD_PROP[2] }} && echo "build binary dist..." && - scripts/build_binary_dist_linux ${{inputs.icloudpd_version}} ${{ matrix.BUILD_PROP[2] }} && - echo "add musl to binary dist..." && - scripts/build_binary_dist_linux_add_musl ${{ matrix.BUILD_PROP[3] }} + scripts/build_binary_dist_linux ${{inputs.icloudpd_version}} ${{ matrix.BUILD_PROP[2] }} + + # echo "add musl to binary dist..." && + # scripts/build_binary_dist_linux_add_musl ${{ matrix.BUILD_PROP[3] }} - name: Upload artifacts uses: actions/upload-artifact@v4 with: - name: icloudpd-${{github.sha}}-bin-linux-${{ matrix.BUILD_PROP[2] }} + name: icloudpd-${{github.sha}}-bin-linux-${{ matrix.BUILD_PROP[2] }}-apt if-no-files-found: error path: | dist/icloud* - build_linux_2: + build_linux_apk: runs-on: ubuntu-22.04 strategy: fail-fast: false @@ -205,7 +244,7 @@ jobs: # TOOLCHAIN_NAME: ${{ matrix.BUILD_PROP[1] }} # SUFFIX: ${{ matrix.BUILD_PROP[2] }} - name: Build Linux Binary for "${{ matrix.BUILD_PROP[0] }}" with Alpine + name: Build Linux ${{ matrix.BUILD_PROP[0] }} Alpine defaults: run: shell: bash @@ -254,7 +293,7 @@ jobs: - name: Upload artifacts uses: actions/upload-artifact@v4 with: - name: icloudpd-${{github.sha}}-bin-linux-${{ matrix.BUILD_PROP[2] }} + name: icloudpd-${{github.sha}}-bin-linux-${{ matrix.BUILD_PROP[2] }}-apk if-no-files-found: error path: | dist/icloud* @@ -345,7 +384,7 @@ jobs: build_docker: runs-on: ubuntu-22.04 - needs: [ build_linux_1, build_linux_2 ] + needs: [ build_linux_apt, build_linux_apk ] steps: - uses: actions/checkout@v4 @@ -390,7 +429,7 @@ jobs: build_npm: runs-on: ubuntu-22.04 - needs: [build_linux_1,build_macos,build_windows] + needs: [build_linux_apt,build_linux_apk,build_macos,build_windows] steps: - name: Checkout code uses: actions/checkout@v4 @@ -422,7 +461,7 @@ jobs: dist/npm/ compatibility_linux_pip_apt: - name: "Compatibility PIP on ${{ matrix.image[1] }} on linux/${{ matrix.prop[1] }} platform APT" + name: "Compat PIP ${{ matrix.image[1] }} ${{ matrix.prop[1] }} apt" strategy: fail-fast: false matrix: @@ -525,7 +564,7 @@ jobs: # "arm32v5/", # image prefix # ] runs-on: ubuntu-22.04 - needs: [ build_linux_1, build_linux_2, build_src ] + needs: [ build_linux_apt, build_linux_apk, build_src ] defaults: run: shell: bash @@ -542,6 +581,11 @@ jobs: run: | mkdir compatibility + - name: Make folder for tzlc + if: steps.get_image.outputs.digest != '' + run: | + mkdir tzlc + - name: Download artifacts (src) if: steps.get_image.outputs.digest != '' uses: actions/download-artifact@v4 @@ -554,7 +598,8 @@ jobs: if: steps.get_image.outputs.digest != '' uses: actions/download-artifact@v4 with: - name: icloudpd-${{github.sha}}-bin-linux-${{ matrix.prop[0] }} + pattern: icloudpd-${{github.sha}}-bin-linux-* + merge-multiple: true path: | dist @@ -588,7 +633,7 @@ jobs: echo "test icloud..." && icloud --version && echo "test icloudpd..." && - TZ=America/Los_Angeles LC_ALL=ru_RU.UTF-8 icloudpd --use-os-locale --version && + icloudpd --version && echo "check if src..." && (pip3 list --disable-pip-version-check | grep keyring | head -n 1 > /work/compatibility/pip.${{ matrix.image[0] }}.${{ matrix.prop[0] }}.pass) @@ -603,13 +648,51 @@ jobs: if: steps.get_image.outputs.digest != '' uses: actions/upload-artifact@v4 with: - name: icloudpd-${{github.sha}}-compatibility-linux-pip-${{ matrix.image[0] }}-${{ matrix.prop[0] }} + name: icloudpd-${{github.sha}}-compatibility-linux-pip-${{ matrix.image[0] }}-${{ matrix.prop[0] }}-apt if-no-files-found: error path: | compatibility/* + - name: Run tzlc for ${{ matrix.prop[2] }}${{ matrix.image[1] }} on ${{ matrix.prop[1] }} + if: steps.get_image.outputs.digest != '' + id: run_tzlc + uses: addnab/docker-run-action@v3 + continue-on-error: true + with: + image: ${{ matrix.prop[2] }}${{ matrix.image[1] }} + shell: bash + options: -v ${{ github.workspace }}:/work --platform linux/${{ matrix.prop[1] }} + run: > + echo "install default python, tzdata, locales..." && + export DEBIAN_FRONTEND=noninteractive && apt-get update -y && apt-get install -y python3 python3-venv tzdata locales-all && + echo "create venv and active..." && + cd /work && + python3 -m venv .venv && + . .venv/bin/activate && + echo "install icloudpd..." && + pip3 install --disable-pip-version-check --no-index --find-links /work/dist icloudpd==${{inputs.icloudpd_version}} && + echo "test icloud..." && + icloud --version && + echo "test icloudpd..." && + TZ=America/Los_Angeles LC_ALL=ru_RU.UTF-8 icloudpd --use-os-locale --version 1>.result && + mv .result /work/tzlc/pip.${{ matrix.image[0] }}.${{ matrix.prop[0] }}.pass + + - name: Record failure tzlc for ${{ matrix.prop[2] }}${{ matrix.image[1] }} on ${{ matrix.prop[1] }} + if: ${{ steps.run_tzlc.outcome == 'failure' }} + run: | + touch tzlc/pip.${{ matrix.image[0] }}.${{ matrix.prop[0] }}.fail + + - name: Upload tzlc result + if: steps.get_image.outputs.digest != '' + uses: actions/upload-artifact@v4 + with: + name: icloudpd-${{github.sha}}-tzlc-linux-pip-${{ matrix.image[0] }}-${{ matrix.prop[0] }}-apt + if-no-files-found: error + path: | + tzlc/* + compatibility_linux_pip_apk: - name: "Compatibility PIP on ${{ matrix.image[1] }} on linux/${{ matrix.prop[1] }} platform APK" + name: "Compat PIP ${{ matrix.image[1] }} ${{ matrix.prop[1] }} apk" strategy: fail-fast: false matrix: @@ -694,7 +777,7 @@ jobs: # "arm32v5/", # image prefix # ] runs-on: ubuntu-22.04 - needs: [ build_linux_1, build_linux_2, build_src ] + needs: [ build_linux_apt, build_linux_apk, build_src ] defaults: run: shell: bash @@ -711,6 +794,11 @@ jobs: run: | mkdir compatibility + - name: Make folder for tzlc + if: steps.get_image.outputs.digest != '' + run: | + mkdir tzlc + - name: Download artifacts (src) if: steps.get_image.outputs.digest != '' uses: actions/download-artifact@v4 @@ -723,7 +811,8 @@ jobs: if: steps.get_image.outputs.digest != '' uses: actions/download-artifact@v4 with: - name: icloudpd-${{github.sha}}-bin-linux-${{ matrix.prop[0] }} + pattern: icloudpd-${{github.sha}}-bin-linux-* + merge-multiple: true path: | dist @@ -746,7 +835,7 @@ jobs: options: -v ${{ github.workspace }}:/work --platform linux/${{ matrix.prop[1] }} run: > echo "install default python..." && - apk update && apk add python3 musl-locales musl-locales-lang && + apk update && apk add python3 && echo "create venv and active..." && cd /work && python3 -m venv .venv && @@ -756,7 +845,7 @@ jobs: echo "test icloud..." && icloud --version && echo "test icloudpd..." && - TZ=America/Los_Angeles LC_ALL=ru_RU.UTF-8 icloudpd --use-os-locale --version && + icloudpd --version && echo "check if src..." && (pip3 list --disable-pip-version-check | grep keyring | head -n 1 > /work/compatibility/pip.${{ matrix.image[0] }}.${{ matrix.prop[0] }}.pass) # touch /work/compatibility/pip.${{ matrix.image[0] }}.${{ matrix.prop[0] }}.pass @@ -770,13 +859,50 @@ jobs: if: steps.get_image.outputs.digest != '' uses: actions/upload-artifact@v4 with: - name: icloudpd-${{github.sha}}-compatibility-linux-pip-${{ matrix.image[0] }}-${{ matrix.prop[0] }} + name: icloudpd-${{github.sha}}-compatibility-linux-pip-${{ matrix.image[0] }}-${{ matrix.prop[0] }}-apk if-no-files-found: error path: | compatibility/* + - name: Run tzlc for ${{ matrix.prop[2] }}${{ matrix.image[1] }} on ${{ matrix.prop[1] }} + if: steps.get_image.outputs.digest != '' + id: run_tzlc + uses: addnab/docker-run-action@v3 + continue-on-error: true + with: + image: ${{ matrix.prop[2] }}${{ matrix.image[1] }} + shell: sh + options: -v ${{ github.workspace }}:/work --platform linux/${{ matrix.prop[1] }} + run: > + echo "install default python, tz, locale..." && + export MUSL_LOCPATH="/usr/share/i18n/locales/musl" && + apk update && apk add python3 tzdata musl-locales musl-locales-lang && + echo "create venv and active..." && + cd /work && + python3 -m venv .venv && + . .venv/bin/activate && + echo "install icloudpd..." && + pip3 install --disable-pip-version-check --no-index --find-links /work/dist icloudpd==${{inputs.icloudpd_version}} && + echo "test icloudpd..." && + TZ=America/Los_Angeles LC_ALL=ru_RU.UTF-8 icloudpd --use-os-locale --version 1>.result && + mv .result /work/tzlc/pip.${{ matrix.image[0] }}.${{ matrix.prop[0] }}.pass + + - name: Record tzlc failure for ${{ matrix.prop[2] }}${{ matrix.image[1] }} on ${{ matrix.prop[1] }} + if: ${{ steps.run_tzlc.outcome == 'failure' }} + run: | + touch tzlc/pip.${{ matrix.image[0] }}.${{ matrix.prop[0] }}.fail + + - name: Upload tzlc result + if: steps.get_image.outputs.digest != '' + uses: actions/upload-artifact@v4 + with: + name: icloudpd-${{github.sha}}-tzlc-linux-pip-${{ matrix.image[0] }}-${{ matrix.prop[0] }}-apk + if-no-files-found: error + path: | + tzlc/* + compatibility_macos_pip: - name: "Compatibility PIP on ${{ matrix.prop[0] }} on ${{ matrix.prop[1] }} platform" + name: "Compat PIP ${{ matrix.prop[0] }} ${{ matrix.prop[1] }}" strategy: fail-fast: false matrix: @@ -802,6 +928,10 @@ jobs: run: | mkdir compatibility + - name: Make folder for tzlc + run: | + mkdir tzlc + - name: Download artifacts (src) uses: actions/download-artifact@v4 with: @@ -825,7 +955,7 @@ jobs: . .venv/bin/activate && pip3 install --disable-pip-version-check --no-index --find-links dist icloudpd==${{inputs.icloudpd_version}} && icloud --version && - TZ=America/Los_Angeles LC_ALL=ru_RU.UTF-8 icloudpd --use-os-locale --version && + icloudpd --version && touch compatibility/pip.${{ matrix.prop[0] }}.${{ matrix.prop[1] }}.pass # && @@ -845,8 +975,36 @@ jobs: path: | compatibility/* + - name: Run tzlc for ${{ matrix.prop[0] }} on ${{ matrix.prop[1] }} + id: run_tzlc + continue-on-error: true + run: > + echo "create venv and active..." && + python3 -m venv .venv && + . .venv/bin/activate && + pip3 install --disable-pip-version-check --no-index --find-links dist icloudpd==${{inputs.icloudpd_version}} && + TZ=America/Los_Angeles LC_ALL=ru_RU.UTF-8 icloudpd --use-os-locale --version 1>.result && + mv .result tzlc/pip.${{ matrix.prop[0] }}.${{ matrix.prop[1] }}.pass + + # && + # echo "check if src..." && + # pip3 list --disable-pip-version-check | grep keyring | head -n 1 > compatibility/pip.${{ matrix.os }}.amd64.pass + + - name: Record failure tzlc for ${{ matrix.prop[0] }} on ${{ matrix.prop[1] }} + if: ${{ steps.run_tzlc.outcome == 'failure' }} + run: | + touch tzlc/pip.${{ matrix.prop[0] }}.${{ matrix.prop[1] }}.fail + + - name: Upload tzlc result + uses: actions/upload-artifact@v4 + with: + name: icloudpd-${{github.sha}}-tzlc-macos-pip-${{ matrix.prop[0] }}-${{ matrix.prop[1] }} + if-no-files-found: error + path: | + tzlc/* + compatibility_windows_pip: - name: "Compatibility PIP on ${{ matrix.os }} on amd64 platform" + name: "Compat PIP ${{ matrix.os }} on amd64" strategy: fail-fast: false matrix: @@ -882,7 +1040,7 @@ jobs: run: > pip3 install --disable-pip-version-check --no-index --find-links dist icloudpd==${{inputs.icloudpd_version}} && icloud --version && - TZ=America/Los_Angeles icloudpd --use-os-locale --version && + icloudpd --version && touch compatibility/pip.${{ matrix.os }}.amd64.pass # && @@ -902,56 +1060,12 @@ jobs: path: | compatibility/* - compatibility_linux_bin: - name: "Compatibility BIN on ${{ matrix.image[1] }} on linux/${{ matrix.prop[1] }} platform" + compatibility_linux_bin_apt: + name: "Compat BIN ${{ matrix.image[1] }} ${{ matrix.prop[1] }} apt" strategy: fail-fast: false matrix: image: - - [ - "alpine_3_20", #variant name - "alpine:3.20", #image - ] - - [ - "alpine_3_19", #variant name - "alpine:3.19", #image - ] - - [ - "alpine_3_18", #variant name - "alpine:3.18", #image - ] - - [ - "alpine_3_17", #variant name - "alpine:3.17", #image - ] - - [ - "alpine_3_16", #variant name - "alpine:3.16", #image - ] - - [ - "alpine_3_15", #variant name - "alpine:3.15", #image - ] - - [ - "alpine_3_14", #variant name - "alpine:3.14", #image - ] - - [ - "alpine_3_13", #variant name - "alpine:3.13", #image - ] - - [ - "alpine_3_12", #variant name - "alpine:3.12", #image - ] - - [ - "alpine_3_11", #variant name - "alpine:3.11", #image - ] - - [ - "alpine_3_10", #variant name - "alpine:3.10", #image - ] - [ "debian_6_squeeze", #variant name "debian:squeeze", #image @@ -1040,13 +1154,207 @@ jobs: # "arm32v5/", # image prefix # ] runs-on: ubuntu-22.04 - needs: [ build_linux_1, build_linux_2 ] + needs: [ build_linux_apt, build_linux_apk ] + defaults: + run: + shell: bash + + steps: + + - name: Get image + id: get_image + run: | + echo digest=$(docker pull --platform linux/${{ matrix.prop[1] }} ${{ matrix.prop[2] }}${{ matrix.image[1] }} | grep Digest | head -n 1 | cut -d: -f 2-3 | tr -d ' ') >> $GITHUB_OUTPUT + + - name: Make folder for compatibility + if: steps.get_image.outputs.digest != '' + run: | + mkdir compatibility + + - name: Make folder for tzlc + if: steps.get_image.outputs.digest != '' + run: | + mkdir tzlc + + - name: Download artifacts + if: steps.get_image.outputs.digest != '' + uses: actions/download-artifact@v4 + with: + pattern: icloudpd-${{github.sha}}-bin-linux-* + merge-multiple: true + path: | + dist + + # fails with "icloud: Failed to stat /proc/self/exe: Bad file descriptor" in bookwork arm64 + # - name: Set up QEMU + # if: matrix.prop[1] != 'amd64' && matrix.prop[1] != '386' + # uses: docker/setup-qemu-action@v3 + + - name: Set up QEMU + if: steps.get_image.outputs.digest != '' && matrix.prop[1] != 'amd64' && matrix.prop[1] != '386' + run: docker run --rm --privileged multiarch/qemu-user-static --reset -p yes + + - name: Run test for ${{ matrix.prop[2] }}${{ matrix.image[1] }} on ${{ matrix.prop[1] }} + if: steps.get_image.outputs.digest != '' + id: run_test + uses: addnab/docker-run-action@v3 + continue-on-error: true + with: + image: ${{ matrix.prop[2] }}${{ matrix.image[1] }} + shell: sh + options: -v ${{ github.workspace }}:/work --platform linux/${{ matrix.prop[1] }} + run: > + echo "prep test..." && + cd /work && + chmod +x dist/icloud-${{inputs.icloudpd_version}}-linux-${{ matrix.prop[0] }} && + chmod +x dist/icloudpd-${{inputs.icloudpd_version}}-linux-${{ matrix.prop[0] }} && + chmod +x dist/icloudpd-ex-${{inputs.icloudpd_version}}-linux-${{ matrix.prop[0] }} && + echo "test icloud..." && + dist/icloud-${{inputs.icloudpd_version}}-linux-${{ matrix.prop[0] }} --version && + echo "test icloudpd..." && + dist/icloudpd-${{inputs.icloudpd_version}}-linux-${{ matrix.prop[0] }} --version && + echo "test icloudpd-ex..." && + dist/icloudpd-ex-${{inputs.icloudpd_version}}-linux-${{ matrix.prop[0] }} --version && + touch /work/compatibility/bin.${{ matrix.image[0] }}.${{ matrix.prop[0] }}.pass + + - name: Record failure for ${{ matrix.prop[2] }}${{ matrix.image[1] }} on ${{ matrix.prop[1] }} + if: ${{ steps.run_test.outcome == 'failure' }} + run: | + touch compatibility/bin.${{ matrix.image[0] }}.${{ matrix.prop[0] }}.fail + + - name: Upload compatibility result + if: steps.get_image.outputs.digest != '' + uses: actions/upload-artifact@v4 + with: + name: icloudpd-${{github.sha}}-compatibility-linux-bin-${{ matrix.image[0] }}-${{ matrix.prop[0] }}-apt + if-no-files-found: error + path: | + compatibility/* + + - name: Run tzlc for ${{ matrix.prop[2] }}${{ matrix.image[1] }} on ${{ matrix.prop[1] }} + if: steps.get_image.outputs.digest != '' + id: run_tzlc + uses: addnab/docker-run-action@v3 + continue-on-error: true + with: + image: ${{ matrix.prop[2] }}${{ matrix.image[1] }} + shell: sh + options: -v ${{ github.workspace }}:/work --platform linux/${{ matrix.prop[1] }} + run: > + echo "install tzdata and locales..." && + export DEBIAN_FRONTEND=noninteractive && apt-get update && apt-get install -y tzdata locales-all && + echo "prep test..." && + cd /work && + chmod +x dist/icloud-${{inputs.icloudpd_version}}-linux-${{ matrix.prop[0] }} && + chmod +x dist/icloudpd-${{inputs.icloudpd_version}}-linux-${{ matrix.prop[0] }} && + chmod +x dist/icloudpd-ex-${{inputs.icloudpd_version}}-linux-${{ matrix.prop[0] }} && + echo "test icloudpd..." && + TZ=America/Los_Angeles LC_ALL=ru_RU.UTF-8 dist/icloudpd-${{inputs.icloudpd_version}}-linux-${{ matrix.prop[0] }} --use-os-locale --version 1>.result && + mv .result /work/tzlc/bin.${{ matrix.image[0] }}.${{ matrix.prop[0] }}.pass + + - name: Record failure tzlc for ${{ matrix.prop[2] }}${{ matrix.image[1] }} on ${{ matrix.prop[1] }} + if: ${{ steps.run_tzlc.outcome == 'failure' }} + run: | + touch tzlc/bin.${{ matrix.image[0] }}.${{ matrix.prop[0] }}.fail + + - name: Upload tzlc result + if: steps.get_image.outputs.digest != '' + uses: actions/upload-artifact@v4 + with: + name: icloudpd-${{github.sha}}-tzlc-linux-bin-${{ matrix.image[0] }}-${{ matrix.prop[0] }}-apt + if-no-files-found: error + path: | + tzlc/* + + compatibility_linux_bin_apk: + name: "Compat BIN ${{ matrix.image[1] }} ${{ matrix.prop[1] }} apk" + strategy: + fail-fast: false + matrix: + image: + - [ + "alpine_3_20", #variant name + "alpine:3.20", #image + ] + - [ + "alpine_3_19", #variant name + "alpine:3.19", #image + ] + - [ + "alpine_3_18", #variant name + "alpine:3.18", #image + ] + - [ + "alpine_3_17", #variant name + "alpine:3.17", #image + ] + - [ + "alpine_3_16", #variant name + "alpine:3.16", #image + ] + - [ + "alpine_3_15", #variant name + "alpine:3.15", #image + ] + - [ + "alpine_3_14", #variant name + "alpine:3.14", #image + ] + - [ + "alpine_3_13", #variant name + "alpine:3.13", #image + ] + - [ + "alpine_3_12", #variant name + "alpine:3.12", #image + ] + - [ + "alpine_3_11", #variant name + "alpine:3.11", #image + ] + - [ + "alpine_3_10", #variant name + "alpine:3.10", #image + ] + prop: + - [ + "amd64", # variant name + "amd64", # platform spec + "", # image prefix + ] + - [ + "386", # variant name + "386", # platform spec + "i386/", # image prefix + ] + - [ + "arm64", # variant name + "arm64", # platform spec + "", # image prefix + ] + - [ + "arm32v7", # variant name + "arm/v7", # platform spec + "arm32v7/", # image prefix + ] + - [ + "arm32v6", # variant name + "arm/v6", # platform spec + "arm32v6/", # image prefix + ] + # - [ + # "arm32v5", # variant name + # "arm/v5", # platform spec + # "arm32v5/", # image prefix + # ] + runs-on: ubuntu-22.04 + needs: [ build_linux_apt, build_linux_apk ] defaults: run: shell: bash - + steps: - + - name: Get image id: get_image run: | @@ -1056,24 +1364,30 @@ jobs: if: steps.get_image.outputs.digest != '' run: | mkdir compatibility - + + - name: Make folder for tzlc + if: steps.get_image.outputs.digest != '' + run: | + mkdir tzlc + - name: Download artifacts if: steps.get_image.outputs.digest != '' uses: actions/download-artifact@v4 with: - name: icloudpd-${{github.sha}}-bin-linux-${{ matrix.prop[0] }} + pattern: icloudpd-${{github.sha}}-bin-linux-* + merge-multiple: true path: | dist - + # fails with "icloud: Failed to stat /proc/self/exe: Bad file descriptor" in bookwork arm64 # - name: Set up QEMU # if: matrix.prop[1] != 'amd64' && matrix.prop[1] != '386' # uses: docker/setup-qemu-action@v3 - + - name: Set up QEMU if: steps.get_image.outputs.digest != '' && matrix.prop[1] != 'amd64' && matrix.prop[1] != '386' run: docker run --rm --privileged multiarch/qemu-user-static --reset -p yes - + - name: Run test for ${{ matrix.prop[2] }}${{ matrix.image[1] }} on ${{ matrix.prop[1] }} if: steps.get_image.outputs.digest != '' id: run_test @@ -1090,29 +1404,66 @@ jobs: chmod +x dist/icloudpd-${{inputs.icloudpd_version}}-linux-${{ matrix.prop[0] }} && chmod +x dist/icloudpd-ex-${{inputs.icloudpd_version}}-linux-${{ matrix.prop[0] }} && echo "test icloud..." && - dist/icloud-${{inputs.icloudpd_version}}-linux-${{ matrix.prop[0] }} -h && + dist/icloud-${{inputs.icloudpd_version}}-linux-${{ matrix.prop[0] }} --version && echo "test icloudpd..." && dist/icloudpd-${{inputs.icloudpd_version}}-linux-${{ matrix.prop[0] }} --version && echo "test icloudpd-ex..." && dist/icloudpd-ex-${{inputs.icloudpd_version}}-linux-${{ matrix.prop[0] }} --version && touch /work/compatibility/bin.${{ matrix.image[0] }}.${{ matrix.prop[0] }}.pass - + - name: Record failure for ${{ matrix.prop[2] }}${{ matrix.image[1] }} on ${{ matrix.prop[1] }} if: ${{ steps.run_test.outcome == 'failure' }} run: | touch compatibility/bin.${{ matrix.image[0] }}.${{ matrix.prop[0] }}.fail - + - name: Upload compatibility result if: steps.get_image.outputs.digest != '' uses: actions/upload-artifact@v4 with: - name: icloudpd-${{github.sha}}-compatibility-linux-bin-${{ matrix.image[0] }}-${{ matrix.prop[0] }} + name: icloudpd-${{github.sha}}-compatibility-linux-bin-${{ matrix.image[0] }}-${{ matrix.prop[0] }}-apk if-no-files-found: error path: | compatibility/* - + + - name: Run tzlc for ${{ matrix.prop[2] }}${{ matrix.image[1] }} on ${{ matrix.prop[1] }} + if: steps.get_image.outputs.digest != '' + id: run_tzlc + uses: addnab/docker-run-action@v3 + continue-on-error: true + with: + image: ${{ matrix.prop[2] }}${{ matrix.image[1] }} + shell: sh + options: -v ${{ github.workspace }}:/work --platform linux/${{ matrix.prop[1] }} + run: > + echo "install tzdata and locales ..." && + export MUSL_LOCPATH="/usr/share/i18n/locales/musl" && + apk update && apk add tzdata musl-locales musl-locales-lang && + echo "prep test..." && + cd /work && + chmod +x dist/icloud-${{inputs.icloudpd_version}}-linux-${{ matrix.prop[0] }} && + chmod +x dist/icloudpd-${{inputs.icloudpd_version}}-linux-${{ matrix.prop[0] }} && + chmod +x dist/icloudpd-ex-${{inputs.icloudpd_version}}-linux-${{ matrix.prop[0] }} && + echo "test icloudpd..." && + TZ=America/Los_Angeles LC_ALL=ru_RU.UTF-8 dist/icloudpd-${{inputs.icloudpd_version}}-linux-${{ matrix.prop[0] }} --use-os-locale --version 1>.result && + mv .result /work/tzlc/bin.${{ matrix.image[0] }}.${{ matrix.prop[0] }}.pass + + - name: Record failure tzlc for ${{ matrix.prop[2] }}${{ matrix.image[1] }} on ${{ matrix.prop[1] }} + if: ${{ steps.run_tzlc.outcome == 'failure' }} + run: | + touch tzlc/bin.${{ matrix.image[0] }}.${{ matrix.prop[0] }}.fail + + - name: Upload tzlc result + if: steps.get_image.outputs.digest != '' + uses: actions/upload-artifact@v4 + with: + name: icloudpd-${{github.sha}}-tzlc-linux-bin-${{ matrix.image[0] }}-${{ matrix.prop[0] }}-apk + if-no-files-found: error + path: | + tzlc/* + + compatibility_macos_bin: - name: "Compatibility BIN on ${{ matrix.prop[0] }} on ${{ matrix.prop[1] }} platform" + name: "Compat BIN ${{ matrix.prop[0] }} ${{ matrix.prop[1] }}" strategy: fail-fast: false matrix: @@ -1138,7 +1489,11 @@ jobs: - name: Make folder for compatibility run: | mkdir compatibility - + + - name: Make folder for tzlc + run: | + mkdir tzlc + - name: Download artifacts uses: actions/download-artifact@v4 with: @@ -1174,9 +1529,34 @@ jobs: if-no-files-found: error path: | compatibility/* - + + - name: Run tzlc for ${{ matrix.prop[0] }} on amd64 + id: run_tzlc + continue-on-error: true + run: > + echo "prep test..." && + chmod +x dist/icloud-${{inputs.icloudpd_version}}-macos-amd64 && + chmod +x dist/icloudpd-${{inputs.icloudpd_version}}-macos-amd64 && + chmod +x dist/icloudpd-ex-${{inputs.icloudpd_version}}-macos-amd64 && + echo "test icloudpd..." && + TZ=America/Los_Angeles LC_ALL=ru_RU.UTF-8 dist/icloudpd-${{inputs.icloudpd_version}}-macos-amd64 --use-os-locale --version 1>.result && + mv .result tzlc/bin.${{ matrix.prop[0] }}.${{ matrix.prop[1] }}.pass + + - name: Record failure tzlc for ${{ matrix.prop[0] }} on amd64 + if: ${{ steps.run_tzlc.outcome == 'failure' }} + run: | + touch tzlc/bin.${{ matrix.prop[0] }}.${{ matrix.prop[1] }}.fail + + - name: Upload tzlc result + uses: actions/upload-artifact@v4 + with: + name: icloudpd-${{github.sha}}-tzlc-macos-bin-${{ matrix.prop[0] }}-${{ matrix.prop[1] }} + if-no-files-found: error + path: | + tzlc/* + compatibility_windows_bin: - name: "Compatibility BIN on ${{ matrix.prop[0] }} on amd64 platform" + name: "Compat BIN ${{ matrix.prop[0] }} on amd64" strategy: fail-fast: false matrix: @@ -1232,7 +1612,7 @@ jobs: compatibility/* compatibility_docker: - name: "Compatibility DOCKER on ${{ matrix.image[1] }} on linux/${{ matrix.prop[1] }} platform" + name: "Compat DOCKER ${{ matrix.image[1] }} ${{ matrix.prop[1] }}" strategy: fail-fast: false matrix: @@ -1320,7 +1700,12 @@ jobs: if: steps.reload_docker.outcome != 'failure' run: | mkdir compatibility - + + - name: Make folder for tzlc + if: steps.reload_docker.outcome != 'failure' + run: | + mkdir tzlc + - name: Run skopeo if: steps.reload_docker.outcome != 'failure' uses: addnab/docker-run-action@v3 @@ -1345,8 +1730,8 @@ jobs: id: run_test continue-on-error: true run: > - (docker run --rm -i --platform linux/${{ matrix.prop[1] }} -e TZ=America/Los_Angeles -e LC_ALL=ru_RU.UTF-8 172.17.0.1:5000/icloudpd/icloudpd:commit-${{ github.sha }} icloudpd --use-os-locale --version) && - (docker run --rm -i --platform linux/${{ matrix.prop[1] }} -e TZ=America/Los_Angeles -e LC_ALL=ru_RU.UTF-8 172.17.0.1:5000/icloudpd/icloudpd:latest icloudpd --use-os-locale --version) + (docker run --rm -i --platform linux/${{ matrix.prop[1] }} 172.17.0.1:5000/icloudpd/icloudpd:commit-${{ github.sha }} icloudpd --version) && + (docker run --rm -i --platform linux/${{ matrix.prop[1] }} 172.17.0.1:5000/icloudpd/icloudpd:latest icloudpd --version) - name: Record success on ${{ matrix.prop[1] }} if: steps.reload_docker.outcome != 'failure' && steps.run_test.outcome != 'failure' @@ -1366,9 +1751,36 @@ jobs: if-no-files-found: error path: | compatibility/* + + - name: Run tzlc on ${{ matrix.prop[1] }} + if: steps.reload_docker.outcome != 'failure' + id: run_tzlc + continue-on-error: true + run: > + (docker run --rm -i --platform linux/${{ matrix.prop[1] }} -e TZ=America/Los_Angeles -e LC_ALL=ru_RU.UTF-8 172.17.0.1:5000/icloudpd/icloudpd:latest icloudpd --use-os-locale --version) 1>.result + + - name: Record success tzlc on ${{ matrix.prop[1] }} + if: steps.reload_docker.outcome != 'failure' && steps.run_tzlc.outcome != 'failure' + run: | + mv .result tzlc/docker.${{ matrix.image[0] }}.${{ matrix.prop[0] }}.pass + + - name: Record failure tzlc on ${{ matrix.prop[1] }} + if: steps.run_tzlc.outcome == 'failure' + run: | + touch tzlc/docker.${{ matrix.image[0] }}.${{ matrix.prop[0] }}.fail + - name: Upload tzlc result + if: steps.reload_docker.outcome != 'failure' + uses: actions/upload-artifact@v4 + with: + name: icloudpd-${{github.sha}}-tzlc-docker-${{ matrix.image[0] }}-${{ matrix.prop[0] }} + if-no-files-found: error + path: | + tzlc/* + + compatibility_linux_npm_apt: - name: "Compatibility NPM on ${{ matrix.image[1] }} on linux/${{ matrix.prop[1] }} platform APT" + name: "Compat NPM ${{ matrix.image[1] }} ${{ matrix.prop[1] }} apt" strategy: fail-fast: false matrix: @@ -1514,7 +1926,12 @@ jobs: if: steps.get_image.outputs.digest != '' run: | mkdir compatibility - + + - name: Make folder for tzlc + if: steps.get_image.outputs.digest != '' + run: | + mkdir tzlc + - name: Download artifacts if: steps.get_image.outputs.digest != '' uses: actions/download-artifact@v4 @@ -1561,10 +1978,10 @@ jobs: options: -v ${{ github.workspace }}:/work --platform linux/${{ matrix.prop[1] }} run: > echo "install npm..." && - export DEBIAN_FRONTEND=noninteractive && apt-get update && apt-get install -y npm locales-all && + export DEBIAN_FRONTEND=noninteractive && apt-get update && apt-get install -y npm && echo "test icloudpd..." && npm install -g --registry http://172.17.0.1:4873 icloudpd@${{inputs.icloudpd_version}} && - TZ=America/Los_Angeles LC_ALL=ru_RU.UTF-8 icloudpd --use-os-locale --version && + icloudpd --version && touch /work/compatibility/npm.${{ matrix.image[0] }}.${{ matrix.prop[0] }}.pass - name: Record failure for ${{ matrix.prop[2] }}${{ matrix.image[1] }} on ${{ matrix.prop[1] }} @@ -1576,13 +1993,44 @@ jobs: if: steps.get_image.outputs.digest != '' uses: actions/upload-artifact@v4 with: - name: icloudpd-${{github.sha}}-compatibility-linux-npm-${{ matrix.image[0] }}-${{ matrix.prop[0] }} + name: icloudpd-${{github.sha}}-compatibility-linux-npm-${{ matrix.image[0] }}-${{ matrix.prop[0] }}-apt if-no-files-found: error path: | compatibility/* + - name: Run tzlc for ${{ matrix.prop[2] }}${{ matrix.image[1] }} on ${{ matrix.prop[1] }} + if: steps.get_image.outputs.digest != '' + id: run_tzlc + uses: addnab/docker-run-action@v3 + continue-on-error: true + with: + image: ${{ matrix.prop[2] }}${{ matrix.image[1] }} + shell: sh + options: -v ${{ github.workspace }}:/work --platform linux/${{ matrix.prop[1] }} + run: > + echo "install npm, tzdata, locales..." && + export DEBIAN_FRONTEND=noninteractive && apt-get update && apt-get install -y npm tzdata locales-all&& + echo "test icloudpd..." && + npm install -g --registry http://172.17.0.1:4873 icloudpd@${{inputs.icloudpd_version}} && + TZ=America/Los_Angeles LC_ALL=ru_RU.UTF-8 icloudpd --use-os-locale --version 1>.result && + mv .result /work/tzlc/npm.${{ matrix.image[0] }}.${{ matrix.prop[0] }}.pass + + - name: Record failure tzlc for ${{ matrix.prop[2] }}${{ matrix.image[1] }} on ${{ matrix.prop[1] }} + if: ${{ steps.run_tzlc.outcome == 'failure' }} + run: | + touch tzlc/npm.${{ matrix.image[0] }}.${{ matrix.prop[0] }}.fail + + - name: Upload tzlc result + if: steps.get_image.outputs.digest != '' + uses: actions/upload-artifact@v4 + with: + name: icloudpd-${{github.sha}}-tzlc-linux-npm-${{ matrix.image[0] }}-${{ matrix.prop[0] }}-apt + if-no-files-found: error + path: | + tzlc/* + compatibility_linux_npx_apt: - name: "Compatibility NPX on ${{ matrix.image[1] }} on linux/${{ matrix.prop[1] }} platform APT" + name: "Compat NPX ${{ matrix.image[1] }} ${{ matrix.prop[1] }} apt" strategy: fail-fast: false matrix: @@ -1732,7 +2180,12 @@ jobs: if: steps.get_image.outputs.digest != '' run: | mkdir compatibility - + + - name: Make folder for tzlc + if: steps.get_image.outputs.digest != '' + run: | + mkdir tzlc + - name: Download artifacts if: steps.get_image.outputs.digest != '' uses: actions/download-artifact@v4 @@ -1780,7 +2233,7 @@ jobs: run: > echo "install npm..." && export DEBIAN_FRONTEND=noninteractive && apt-get update && apt-get install -y npm && - /work/scripts/npx_optional /work/compatibility/npx.${{ matrix.image[0] }}.${{ matrix.prop[0] }}.pass /work/compatibility/npx.${{ matrix.image[0] }}.${{ matrix.prop[0] }}.na -y --registry http://172.17.0.1:4873 icloudpd@${{inputs.icloudpd_version}} --version + /work/scripts/npx_optional_touch /work/compatibility/npx.${{ matrix.image[0] }}.${{ matrix.prop[0] }}.pass /work/compatibility/npx.${{ matrix.image[0] }}.${{ matrix.prop[0] }}.na -y --registry http://172.17.0.1:4873 icloudpd@${{inputs.icloudpd_version}} --version - name: Record failure for ${{ matrix.prop[2] }}${{ matrix.image[1] }} on ${{ matrix.prop[1] }} if: ${{ steps.run_test.outcome == 'failure' }} @@ -1791,13 +2244,42 @@ jobs: if: steps.get_image.outputs.digest != '' uses: actions/upload-artifact@v4 with: - name: icloudpd-${{github.sha}}-compatibility-linux-npx-${{ matrix.image[0] }}-${{ matrix.prop[0] }} + name: icloudpd-${{github.sha}}-compatibility-linux-npx-${{ matrix.image[0] }}-${{ matrix.prop[0] }}-apt if-no-files-found: error path: | compatibility/* + - name: Run tzlc for ${{ matrix.prop[2] }}${{ matrix.image[1] }} on ${{ matrix.prop[1] }} + if: steps.get_image.outputs.digest != '' + id: run_tzlc + uses: addnab/docker-run-action@v3 + continue-on-error: true + with: + image: ${{ matrix.prop[2] }}${{ matrix.image[1] }} + shell: bash + options: -v ${{ github.workspace }}:/work --platform linux/${{ matrix.prop[1] }} + run: > + echo "install npm, tzdata, locales..." && + export DEBIAN_FRONTEND=noninteractive && apt-get update && apt-get install -y npm tzdata locales-all && + TZ=America/Los_Angeles LC_ALL=ru_RU.UTF-8 /work/scripts/npx_optional /work/tzlc/npx.${{ matrix.image[0] }}.${{ matrix.prop[0] }}.pass /work/tzlc/npx.${{ matrix.image[0] }}.${{ matrix.prop[0] }}.na -y --registry http://172.17.0.1:4873 icloudpd@${{inputs.icloudpd_version}} --use-os-locale --version + + - name: Record failure tzlc for ${{ matrix.prop[2] }}${{ matrix.image[1] }} on ${{ matrix.prop[1] }} + if: ${{ steps.run_tzlc.outcome == 'failure' }} + run: | + touch tzlc/npx.${{ matrix.image[0] }}.${{ matrix.prop[0] }}.fail + + - name: Upload tzlc result + if: steps.get_image.outputs.digest != '' + uses: actions/upload-artifact@v4 + with: + name: icloudpd-${{github.sha}}-tzlc-linux-npx-${{ matrix.image[0] }}-${{ matrix.prop[0] }}-apt + if-no-files-found: error + path: | + tzlc/* + + compatibility_linux_npm_apk: - name: "Compatibility NPM on ${{ matrix.image[1] }} on linux/${{ matrix.prop[1] }} platform APK" + name: "Compat NPM ${{ matrix.image[1] }} ${{ matrix.prop[1] }} apk" strategy: fail-fast: false matrix: @@ -1916,7 +2398,12 @@ jobs: if: steps.get_image.outputs.digest != '' run: | mkdir compatibility - + + - name: Make folder for tzlc + if: steps.get_image.outputs.digest != '' + run: | + mkdir tzlc + - name: Download artifacts if: steps.get_image.outputs.digest != '' uses: actions/download-artifact@v4 @@ -1963,10 +2450,10 @@ jobs: options: -v ${{ github.workspace }}:/work --platform linux/${{ matrix.prop[1] }} run: > echo "install npm..." && - apk update && apk add npm musl-locales musl-locales-lang && + apk update && apk add npm && echo "test icloudpd..." && npm install -g --registry http://172.17.0.1:4873 icloudpd@${{inputs.icloudpd_version}} && - TZ=America/Los_Angeles LC_ALL=ru_RU.UTF-8 icloudpd --use-os-locale --version && + icloudpd --version && touch /work/compatibility/npm.${{ matrix.image[0] }}.${{ matrix.prop[0] }}.pass - name: Record failure for ${{ matrix.prop[2] }}${{ matrix.image[1] }} on ${{ matrix.prop[1] }} @@ -1978,13 +2465,45 @@ jobs: if: steps.get_image.outputs.digest != '' uses: actions/upload-artifact@v4 with: - name: icloudpd-${{github.sha}}-compatibility-linux-npm-${{ matrix.image[0] }}-${{ matrix.prop[0] }} + name: icloudpd-${{github.sha}}-compatibility-linux-npm-${{ matrix.image[0] }}-${{ matrix.prop[0] }}-apk if-no-files-found: error path: | compatibility/* + - name: Run tzlc for ${{ matrix.prop[2] }}${{ matrix.image[1] }} on ${{ matrix.prop[1] }} + if: steps.get_image.outputs.digest != '' + id: run_tzlc + uses: addnab/docker-run-action@v3 + continue-on-error: true + with: + image: ${{ matrix.prop[2] }}${{ matrix.image[1] }} + shell: sh + options: -v ${{ github.workspace }}:/work --platform linux/${{ matrix.prop[1] }} + run: > + echo "install npm, tzdata, locales..." && + export MUSL_LOCPATH="/usr/share/i18n/locales/musl" && + apk update && apk add npm tzdata musl-locales musl-locales-lang && + echo "test icloudpd..." && + npm install -g --registry http://172.17.0.1:4873 icloudpd@${{inputs.icloudpd_version}} && + TZ=America/Los_Angeles LC_ALL=ru_RU.UTF-8 icloudpd --use-os-locale --version 1>.result && + mv .result /work/tzlc/npm.${{ matrix.image[0] }}.${{ matrix.prop[0] }}.pass + + - name: Record failure tzlc for ${{ matrix.prop[2] }}${{ matrix.image[1] }} on ${{ matrix.prop[1] }} + if: ${{ steps.run_tzlc.outcome == 'failure' }} + run: | + touch tzlc/npm.${{ matrix.image[0] }}.${{ matrix.prop[0] }}.fail + + - name: Upload tzlc result + if: steps.get_image.outputs.digest != '' + uses: actions/upload-artifact@v4 + with: + name: icloudpd-${{github.sha}}-tzlc-linux-npm-${{ matrix.image[0] }}-${{ matrix.prop[0] }}-apt + if-no-files-found: error + path: | + tzlc/* + compatibility_linux_npx_apk: - name: "Compatibility NPX on ${{ matrix.image[1] }} on linux/${{ matrix.prop[1] }} platform APK" + name: "Compat NPX ${{ matrix.image[1] }} ${{ matrix.prop[1] }} apk" strategy: fail-fast: false matrix: @@ -2103,7 +2622,12 @@ jobs: if: steps.get_image.outputs.digest != '' run: | mkdir compatibility - + + - name: Make folder for tzlc + if: steps.get_image.outputs.digest != '' + run: | + mkdir tzlc + - name: Download artifacts if: steps.get_image.outputs.digest != '' uses: actions/download-artifact@v4 @@ -2164,14 +2688,46 @@ jobs: if: steps.get_image.outputs.digest != '' uses: actions/upload-artifact@v4 with: - name: icloudpd-${{github.sha}}-compatibility-linux-npx-${{ matrix.image[0] }}-${{ matrix.prop[0] }} + name: icloudpd-${{github.sha}}-compatibility-linux-npx-${{ matrix.image[0] }}-${{ matrix.prop[0] }}-apk if-no-files-found: error path: | compatibility/* + - name: Run tzlc for ${{ matrix.prop[2] }}${{ matrix.image[1] }} on ${{ matrix.prop[1] }} + if: steps.get_image.outputs.digest != '' + id: run_tzlc + uses: addnab/docker-run-action@v3 + continue-on-error: true + with: + image: ${{ matrix.prop[2] }}${{ matrix.image[1] }} + shell: sh + options: -v ${{ github.workspace }}:/work --platform linux/${{ matrix.prop[1] }} + run: > + echo "install npm, tzdata, locales..." && + export MUSL_LOCPATH="/usr/share/i18n/locales/musl" && + apk update && apk add npm tzdata musl-locales musl-locales-lang && + echo "test icloudpd..." && + TZ=America/Los_Angeles LC_ALL=ru_RU.UTF-8 npx -y --registry http://172.17.0.1:4873 icloudpd@${{inputs.icloudpd_version}} --use-os-locale --version 1>.result && + mv .result /work/tzlc/npx.${{ matrix.image[0] }}.${{ matrix.prop[0] }}.pass + + - name: Record failure tzlc for ${{ matrix.prop[2] }}${{ matrix.image[1] }} on ${{ matrix.prop[1] }} + if: ${{ steps.run_tzlc.outcome == 'failure' }} + run: | + touch tzlc/npx.${{ matrix.image[0] }}.${{ matrix.prop[0] }}.fail + + - name: Upload tzlc result + if: steps.get_image.outputs.digest != '' + uses: actions/upload-artifact@v4 + with: + name: icloudpd-${{github.sha}}-tzlc-linux-npx-${{ matrix.image[0] }}-${{ matrix.prop[0] }}-apk + if-no-files-found: error + path: | + tzlc/* + + # record QEMU failures for completeness compatibility_linux_npm_apk_fail: - name: "Compatibility NPM/NPX on ${{ matrix.image[1] }} on linux/${{ matrix.prop[1] }} platform APK failures" + name: "Compat NPM/NPX ${{ matrix.image[1] }} ${{ matrix.prop[1] }} apk failures" strategy: fail-fast: false matrix: @@ -2252,6 +2808,10 @@ jobs: run: | mkdir compatibility + - name: Make folder for tzlc + run: | + mkdir tzlc + - name: Record failure for ${{ matrix.prop[2] }}${{ matrix.image[1] }} on ${{ matrix.prop[1] }} run: | touch compatibility/npm.${{ matrix.image[0] }}.${{ matrix.prop[0] }}.fail @@ -2260,13 +2820,26 @@ jobs: - name: Upload compatibility result uses: actions/upload-artifact@v4 with: - name: icloudpd-${{github.sha}}-compatibility-linux-npm-${{ matrix.image[0] }}-${{ matrix.prop[0] }} + name: icloudpd-${{github.sha}}-compatibility-linux-npm-${{ matrix.image[0] }}-${{ matrix.prop[0] }}-apk-fail if-no-files-found: error path: | compatibility/* + - name: Record failure tzlc for ${{ matrix.prop[2] }}${{ matrix.image[1] }} on ${{ matrix.prop[1] }} + run: | + touch tzlc/npm.${{ matrix.image[0] }}.${{ matrix.prop[0] }}.fail + touch tzlc/npx.${{ matrix.image[0] }}.${{ matrix.prop[0] }}.fail + + - name: Upload tzlc result + uses: actions/upload-artifact@v4 + with: + name: icloudpd-${{github.sha}}-tzlc-linux-npm-${{ matrix.image[0] }}-${{ matrix.prop[0] }}-apk-fail + if-no-files-found: error + path: | + tzlc/* + compatibility_macos_npm: - name: "Compatibility NPM on ${{ matrix.prop[0] }} on ${{ matrix.prop[1] }} platform" + name: "Compat NPM ${{ matrix.prop[0] }} ${{ matrix.prop[1] }}" strategy: fail-fast: false matrix: @@ -2323,7 +2896,11 @@ jobs: - name: Make folder for compatibility run: | mkdir compatibility - + + - name: Make folder for tzlc + run: | + mkdir tzlc + - name: Download artifacts uses: actions/download-artifact@v4 with: @@ -2357,7 +2934,7 @@ jobs: continue-on-error: true run: > npm install -g --registry http://localhost:4873 icloudpd@${{inputs.icloudpd_version}} && - TZ=America/Los_Angeles LC_ALL=ru_RU.UTF-8 icloudpd --use-os-locale --version && + icloudpd --version && touch compatibility/npm.${{ matrix.prop[0] }}.${{ matrix.prop[1] }}.pass - name: Record failure on ${{ matrix.prop[0] }} @@ -2373,8 +2950,29 @@ jobs: path: | compatibility/* + - name: Run tzlc on ${{ matrix.prop[0] }} + id: run_tzlc + continue-on-error: true + run: > + npm install -g --registry http://localhost:4873 icloudpd@${{inputs.icloudpd_version}} && + TZ=America/Los_Angeles LC_ALL=ru_RU.UTF-8 icloudpd --use-os-locale --version 1>.result && + mv .result tzlc/npm.${{ matrix.prop[0] }}.${{ matrix.prop[1] }}.pass + + - name: Record failure tzlc on ${{ matrix.prop[0] }} + if: ${{ steps.run_tzlc.outcome == 'failure' }} + run: | + touch tzlc/npm.${{ matrix.prop[0] }}.${{ matrix.prop[1] }}.fail + + - name: Upload tzlc result + uses: actions/upload-artifact@v4 + with: + name: icloudpd-${{github.sha}}-tzlc-macos-npm-${{ matrix.prop[0] }}-${{ matrix.prop[1] }} + if-no-files-found: error + path: | + tzlc/* + compatibility_macos_npx: - name: "Compatibility NPX on ${{ matrix.prop[0] }} on ${{ matrix.prop[1] }} platform" + name: "Compat NPX ${{ matrix.prop[0] }} ${{ matrix.prop[1] }}" strategy: fail-fast: false matrix: @@ -2431,7 +3029,11 @@ jobs: - name: Make folder for compatibility run: | mkdir compatibility - + + - name: Make folder for tzlc + run: | + mkdir tzlc + - name: Download artifacts uses: actions/download-artifact@v4 with: @@ -2480,9 +3082,28 @@ jobs: path: | compatibility/* - + - name: Run tzlc on ${{ matrix.prop[0] }} + id: run_tzlc + continue-on-error: true + run: > + TZ=America/Los_Angeles LC_ALL=ru_RU.UTF-8 npx -y --registry http://localhost:4873 icloudpd@${{inputs.icloudpd_version}} --use-os-locale --version 1>.result && + mv .result tzlc/npx.${{ matrix.prop[0] }}.${{ matrix.prop[1] }}.pass + + - name: Record failure tzlc on ${{ matrix.prop[0] }} + if: ${{ steps.run_tzlc.outcome == 'failure' }} + run: | + touch tzlc/npx.${{ matrix.prop[0] }}.${{ matrix.prop[1] }}.fail + + - name: Upload tzlc result + uses: actions/upload-artifact@v4 + with: + name: icloudpd-${{github.sha}}-tzlc-macos-npx-${{ matrix.prop[0] }}-${{ matrix.prop[1] }} + if-no-files-found: error + path: | + tzlc/* + compatibility_windows_npm: - name: "Compatibility NPM on ${{ matrix.os }} on amd64 platform" + name: "Compat NPM ${{ matrix.os }} amd64" strategy: fail-fast: false matrix: @@ -2564,7 +3185,7 @@ jobs: continue-on-error: true run: > npm install -g --registry http://localhost:4873 icloudpd@${{inputs.icloudpd_version}} && - TZ=America/Los_Angeles icloudpd --use-os-locale --version && + icloudpd --version && touch compatibility/npm.${{ matrix.os }}.amd64.pass - name: Record failure on ${{ matrix.os }} @@ -2581,7 +3202,7 @@ jobs: compatibility/* compatibility_windows_npx: - name: "Compatibility NPX on ${{ matrix.os }} on amd64 platform" + name: "Compat NPX ${{ matrix.os }} amd64" strategy: fail-fast: false matrix: @@ -2687,7 +3308,8 @@ jobs: - compatibility_windows_pip - compatibility_linux_pip_apt - compatibility_linux_pip_apk - - compatibility_linux_bin + - compatibility_linux_bin_apt + - compatibility_linux_bin_apk - compatibility_macos_bin - compatibility_windows_bin - compatibility_docker @@ -2700,6 +3322,7 @@ jobs: - compatibility_macos_npx - compatibility_windows_npm - compatibility_windows_npx + - get_expected_version defaults: run: shell: bash @@ -2726,12 +3349,20 @@ jobs: path: | compatibility + - name: Download tzlc Results + uses: actions/download-artifact@v4 + with: + pattern: icloudpd-${{github.sha}}-tzlc-* + merge-multiple: true + path: | + tzlc + - name: Compile Compatibility Report run: | echo "debugging report..." - scripts/compile_compatibility compatibility + scripts/compile_compatibility.py compatibility echo "save report..." - scripts/compile_compatibility compatibility > dist/compatibility-${{inputs.icloudpd_version}}.md + scripts/compile_compatibility.py compatibility > dist/compatibility-${{inputs.icloudpd_version}}.md - name: Upload compatibility report uses: actions/upload-artifact@v4 @@ -2739,4 +3370,20 @@ jobs: name: icloudpd-${{github.sha}}-compatibility if-no-files-found: error path: | - dist/* + dist/compatibility-${{inputs.icloudpd_version}}.md + + - name: Compile tzlc Report + run: | + echo "debugging report..." + scripts/compile_tzlc.py tzlc "${{needs.get_expected_version.outputs.expected_version}}" + echo "save report..." + scripts/compile_tzlc.py tzlc "${{needs.get_expected_version.outputs.expected_version}}" > dist/tzlc-${{inputs.icloudpd_version}}.md + + - name: Upload tzlc report + uses: actions/upload-artifact@v4 + with: + name: icloudpd-${{github.sha}}-tzlc + if-no-files-found: error + path: | + dist/tzlc-${{inputs.icloudpd_version}}.md + \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index 0af117a6e..d3aa5a383 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,25 +1,31 @@ -FROM alpine:3.18 as runtime_amd64_none +FROM ubuntu:24.04 as runtime_amd64_none +RUN export DEBIAN_FRONTEND=noninteractive && apt-get update && apt-get install -y tzdata locales-all WORKDIR /app COPY dist/icloudpd-ex-*.*.*-linux-amd64 icloudpd_ex -FROM alpine:3.18 as runtime_386_none +# focal is the last ubuntu for 386 +FROM i386/ubuntu:focal as runtime_386_none +RUN export DEBIAN_FRONTEND=noninteractive && apt-get update && apt-get install -y tzdata locales-all WORKDIR /app COPY dist/icloudpd-ex-*.*.*-linux-386 icloudpd_ex -FROM alpine:3.18 as runtime_arm64_none +FROM ubuntu:24.04 as runtime_arm64_none +RUN export DEBIAN_FRONTEND=noninteractive && apt-get update && apt-get install -y tzdata locales-all WORKDIR /app COPY dist/icloudpd-ex-*.*.*-linux-arm64 icloudpd_ex -FROM alpine:3.18 as runtime_arm_v7 +FROM ubuntu:24.04 as runtime_arm_v7 +RUN export DEBIAN_FRONTEND=noninteractive && apt-get update && apt-get install -y tzdata locales-all WORKDIR /app COPY dist/icloudpd-ex-*.*.*-linux-arm32v7 icloudpd_ex FROM alpine:3.18 as runtime_arm_v6 +ENV MUSL_LOCPATH="/usr/share/i18n/locales/musl" +RUN apk update && apk add --no-cache tzdata musl-locales musl-locales-lang WORKDIR /app COPY dist/icloudpd-ex-*.*.*-linux-arm32v6 icloudpd_ex FROM runtime_${TARGETARCH}_${TARGETVARIANT:-none} as runtime -RUN apk add --no-cache tzdata ENV TZ=UTC EXPOSE 8080 WORKDIR /app diff --git a/scripts/compile_compatibility b/scripts/compile_compatibility deleted file mode 100755 index 3304171ae..000000000 --- a/scripts/compile_compatibility +++ /dev/null @@ -1,57 +0,0 @@ -#!/usr/bin/env python3 -""" takes results of compatibility tests and compie into one file """ - -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([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("") - -def matrix(files): - """ Prints matrix """ - archs = [k for k, _ in itertools.groupby(sorted(files, key = lambda ft: ft[3]), key = lambda ft: ft[3])] - # sort by priority of archs - presort = [ "amd64", "arm64", "arm32v7" ] - archs_sorted = sorted(archs, key = lambda k: f"{presort.index(k) if k in presort else 9}{k}") - # caption - print('|'.join(["OSes and distros"] + archs_sorted)) - print('|'.join(['-'] + ['-' for a in archs_sorted])) - - 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 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(): - """ param: folder """ - folder = sys.argv[1] if len(sys.argv) > 1 else "." - files = [f for f in os.listdir(folder) if not os.path.isdir(f)] - fts = [[os.path.getsize(os.path.join(folder,f))] + f.split('.') for f in files if len(f.split('.')) == 4] - print("## Minimal Effort Compatibility") - print("Checks if `icloudpd` can be installed using minimal effort and ran bare minimum functionality of help screen. Minimal effort may require installing default version of package manager using OS tools") - print("") - stats(fts) - print("Legend:") - print("- N/A - not applicable/available") - print("- pass - test pass") - print("- fail - test fail") - print("- pass (src) - test pass using src (for pip)") - print("") - groups = [(k, list(g)) for k, g in itertools.groupby(sorted(fts, key = lambda ft: ft[1]), key = lambda ft: ft[1])] - for (g, f) in groups: - print(f"### {g}") - stats(f) - matrix(f) - -if __name__ == "__main__": - main() \ No newline at end of file diff --git a/scripts/compile_compatibility.py b/scripts/compile_compatibility.py new file mode 100755 index 000000000..aea831d82 --- /dev/null +++ b/scripts/compile_compatibility.py @@ -0,0 +1,21 @@ +#!/usr/bin/env python3 +"""takes results of compatibility tests and compie into one file""" + +import os +import sys + +from compile_matrix import print_breakdowns + + +def content_checker(filepath): + return os.path.getsize(filepath) > 0 + + +if __name__ == "__main__": + print("## Minimal Effort Compatibility") + print( + "Checks if `icloudpd` can be installed using minimal effort and ran bare minimum functionality of displaying a version information. Minimal effort may require installing default version of package manager using OS tools" + ) + print("") + folder = sys.argv[1] if len(sys.argv) > 1 else "." + print_breakdowns(folder, content_checker, ("(src)", "Test pass using src (for pip)")) diff --git a/scripts/compile_matrix.py b/scripts/compile_matrix.py new file mode 100755 index 000000000..808a92bff --- /dev/null +++ b/scripts/compile_matrix.py @@ -0,0 +1,68 @@ +"""takes results of compatibility tests and compile into one file""" + +import itertools +import os + + +def _stats(files): + """Print statistics""" + 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("") + + +def _matrix(files, special): + """Prints matrix""" + archs = [ + k for k, _ in itertools.groupby(sorted(files, key=lambda ft: ft[3]), key=lambda ft: ft[3]) + ] + # sort by priority of archs + presort = ["amd64", "arm64", "arm32v7"] + archs_sorted = sorted(archs, key=lambda k: f"{presort.index(k) if k in presort else 9}{k}") + # caption + print("|".join(["OSes and distros"] + archs_sorted)) + print("|".join(["-"] + ["-" for a in archs_sorted])) + + 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 or r[0][4] == "na" + else (r[0][4] + ("" if r[0][4] != "pass" or r[0][0] is False else f" {special}")) + for r in results_raw + ] + print("|".join([o] + results)) + + +def print_breakdowns(folder, special_content_checker, special_pair): + """param: folder""" + (abbr, description) = special_pair + files = [f for f in os.listdir(folder) if not os.path.isdir(f)] + fts = [ + [special_content_checker(os.path.join(folder, f))] + f.split(".") + for f in files + if len(f.split(".")) == 4 + ] + _stats(fts) + print("Legend:") + print("- N/A - not applicable/available") + print("- pass - test pass") + print("- fail - test fail") + print(f"- pass {abbr} - {description}") + print("") + groups = [ + (k, list(g)) + for k, g in itertools.groupby(sorted(fts, key=lambda ft: ft[1]), key=lambda ft: ft[1]) + ] + for g, f in groups: + print(f"### {g}") + _stats(f) + _matrix(f, abbr) diff --git a/scripts/compile_tzlc.py b/scripts/compile_tzlc.py new file mode 100755 index 000000000..4dbb048e8 --- /dev/null +++ b/scripts/compile_tzlc.py @@ -0,0 +1,35 @@ +#!/usr/bin/env python3 +"""takes results of tz and locale compatibility tests and compile into one file""" + +import sys + +from compile_matrix import print_breakdowns + + +def special_content_checker(expected_content): + # content is special when it exists, but is invalid + def _intern(filepath): + with open(filepath, encoding="UTF-8") as file: + content = file.read() + return content != expected_content + + return _intern + + +if __name__ == "__main__": + if len(sys.argv) != 3: + print("Params: ") + sys.exit(1) + print("## Timezone and Locale Compatibility") + print( + "Checks if `icloudpd` can be installed using minimal effort and ran bare minimum functionality of displaying version and commit timestamp in local timezone and RU locale. Minimal effort may require installing default version of package manager, timezone data, and locales using OS tools" + ) + print("") + folder = sys.argv[1] + expected_content = sys.argv[2] + # content is special when it exists, but is invalid + print_breakdowns( + folder, + special_content_checker(expected_content), + ("(invalid)", "Incorrect values were generated"), + ) diff --git a/scripts/npx_optional b/scripts/npx_optional index 14f7b6604..a551c8ac6 100755 --- a/scripts/npx_optional +++ b/scripts/npx_optional @@ -3,8 +3,7 @@ set -euo pipefail if [ `which npx` ]; then echo "test icloudpd..." && - npx ${@:3} && - touch $1 + npx ${@:3} 1>$1 else echo "No npx available" touch $2 diff --git a/scripts/npx_optional_touch b/scripts/npx_optional_touch new file mode 100755 index 000000000..14f7b6604 --- /dev/null +++ b/scripts/npx_optional_touch @@ -0,0 +1,11 @@ +#!/usr/bin/env bash +set -euo pipefail + +if [ `which npx` ]; then + echo "test icloudpd..." && + npx ${@:3} && + touch $1 +else + echo "No npx available" + touch $2 +fi \ No newline at end of file