Skip to content

fix alpine compatibility tests #925

fix alpine compatibility tests

fix alpine compatibility tests #925

# This workflow will install Python dependencies, run tests and lint with a single version of Python
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
name: Quality Checks
on:
push:
branches:
- '**'
pull_request:
# branches: [ master ]
workflow_dispatch:
jobs:
lint:
runs-on: ubuntu-20.04
strategy:
matrix:
python-version: [3.8, 3.9, '3.10', 3.11, 3.12]
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install Test dependencies
run: |
pip3 install --disable-pip-version-check -e .[test]
- name: Lint
run: |
scripts/lint
type_check:
runs-on: ubuntu-20.04
strategy:
matrix:
python-version: [3.8, 3.9, '3.10', 3.11, 3.12]
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
- name: Install Test dependencies
run: |
pip3 install --disable-pip-version-check -e .[test]
- name: Type Check
run: |
scripts/type_check
test:
runs-on: ubuntu-20.04
strategy:
matrix:
python-version: [3.8, 3.9, '3.10', 3.11, 3.12]
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
- name: Install Test dependencies
run: |
pip3 install --disable-pip-version-check -e .[test]
- name: Test
run: |
scripts/test
get_version:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- name: Retrieve version and Changelog
id: get_version
run: |
echo icloudpd_version=$(cat pyproject.toml | grep version= | cut -d'"' -f 2) >> $GITHUB_OUTPUT
echo 'icloudpd_changelog<<EOF' >> $GITHUB_OUTPUT
scripts/extract_releasenotes CHANGELOG.md >> $GITHUB_OUTPUT
echo 'EOF' >> $GITHUB_OUTPUT
- name: Log version and Changelog
run: |
echo "icloudpd_version=${{steps.get_version.outputs.icloudpd_version}}"
echo "icloudpd_changelog=${{steps.get_version.outputs.icloudpd_changelog}}"
outputs:
icloudpd_version: ${{steps.get_version.outputs.icloudpd_version}}
icloudpd_changelog: ${{steps.get_version.outputs.icloudpd_changelog}}
build_src:
runs-on: ubuntu-22.04
needs: [get_version]
defaults:
run:
shell: bash
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.12
uses: actions/setup-python@v4
with:
python-version: '3.12'
- name: Install Dev dependencies
run: |
pip3 install --disable-pip-version-check -e .[dev]
- name: Build Python Wheel
run: |
scripts/build
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: icloudpd-${{needs.get_version.outputs.icloudpd_version}}-artifacts
if-no-files-found: error
path: |
dist/icloud*.whl
build_linux:
# run on earliest possible linux for better compatibility
# ubuntu 20.04 has glibc 2.31 -> manylinux_2_31
runs-on: ubuntu-20.04
needs: [get_version]
defaults:
run:
shell: bash
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.12
uses: actions/setup-python@v4
with:
python-version: '3.12'
- name: Install Dev dependencies
run: |
pip3 install --disable-pip-version-check -e .[dev]
- name: Build Release Executables
run: |
scripts/build_bin_linux ${{needs.get_version.outputs.icloudpd_version}} amd64
- name: Build Python Binary Wheel
run: |
scripts/build_binary_dist_linux ${{needs.get_version.outputs.icloudpd_version}}
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: icloudpd-${{needs.get_version.outputs.icloudpd_version}}-artifacts
if-no-files-found: error
path: |
dist/icloud*
build_macos:
# earliest possible mac for better compatibility
runs-on: macos-11
needs: [get_version]
defaults:
run:
shell: bash
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.12
uses: actions/setup-python@v4
with:
python-version: '3.12'
- name: Install Dev dependencies
run: |
pip3 install --disable-pip-version-check -e .[dev]
- name: Build Release Executables
run: |
scripts/build_bin_macos ${{needs.get_version.outputs.icloudpd_version}} amd64
- name: Build Python Binary Wheel
run: |
scripts/build_binary_dist_macos ${{needs.get_version.outputs.icloudpd_version}}
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: icloudpd-${{needs.get_version.outputs.icloudpd_version}}-artifacts
if-no-files-found: error
path: |
dist/icloud*
build_windows:
# earliest possible mac for better compatibility
runs-on: windows-2019
needs: [get_version]
defaults:
run:
shell: bash
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.12
uses: actions/setup-python@v4
with:
python-version: '3.12'
- name: Install Dev dependencies
run: |
pip3 install --disable-pip-version-check -e .[dev]
- name: Build Release Executables
run: |
scripts/build_bin_windows ${{needs.get_version.outputs.icloudpd_version}} amd64
- name: Build Python Binary Wheel
run: |
scripts/build_binary_dist_windows ${{needs.get_version.outputs.icloudpd_version}}
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: icloudpd-${{needs.get_version.outputs.icloudpd_version}}-artifacts
if-no-files-found: error
path: |
dist/icloud*
build_docker:
runs-on: ubuntu-22.04
needs: [get_version]
steps:
- uses: actions/checkout@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Builder instance name
run: echo ${{ steps.buildx.outputs.name }}
- name: Available platforms
run: echo ${{ steps.buildx.outputs.platforms }}
- name: Build Release Docker
uses: docker/build-push-action@v3
with:
context: .
file: ./Dockerfile
platforms: linux/amd64
push: false
tags: |
icloudpd/icloudpd:latest
icloudpd/icloudpd:${{needs.get_version.outputs.icloudpd_version}}
build_npm:
runs-on: ubuntu-22.04
needs: [get_version,build_linux,build_macos,build_windows]
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: '16.x'
registry-url: 'https://registry.npmjs.org'
- name: Download artifacts
uses: actions/download-artifact@v3
with:
name: icloudpd-${{needs.get_version.outputs.icloudpd_version}}-artifacts
path: |
dist
- name: Build Package
run: |
scripts/build_npm ${{needs.get_version.outputs.icloudpd_version}}
- name: Publish NPM (Dry-run)
run: |
npm publish dist/npm/@icloudpd/linux-x64 --access public --dry-run=true
npm publish dist/npm/@icloudpd/win32-x64 --access public --dry-run=true
npm publish dist/npm/@icloudpd/darwin-x64 --access public --dry-run=true
npm publish dist/npm/@icloudpd/darwin-arm64 --access public --dry-run=true
npm publish dist/npm/icloudpd --access public --dry-run=true
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
compatibility_linux_pip_apt:
name: "PIP on ${{ matrix.image[1] }} on linux/${{ matrix.prop[1] }} platform APT"
strategy:
fail-fast: false
matrix:
image:
- [
"python3_12", #variant name
"python:3.12", #image
]
- [
"debian_6_squeeze", #variant name
"debian:squeeze", #image
]
- [
"debian_7_wheezy", #variant name
"debian:wheezy", #image
]
- [
"debian_8_jessie", #variant name
"debian:jessie", #image
]
- [
"debian_9_stretch", #variant name
"debian:stretch", #image
]
- [
"debian_10_buster", #variant name
"debian:buster", #image
]
- [
"debian_11_bullseye", #variant name
"debian:bullseye", #image
]
- [
"debian_12_bookworm", #variant name
"debian:bookworm", #image
]
- [
"ubuntu_12_precise", #variant name
"ubuntu:precise", #image
]
- [
"ubuntu_14_trusty", #variant name
"ubuntu:trusty", #image
]
- [
"ubuntu_16_xenial", #variant name
"ubuntu:xenial", #image
]
- [
"ubuntu_18_bionic", #variant name
"ubuntu:bionic", #image
]
- [
"ubuntu_20_focal", #variant name
"ubuntu:focal", #image
]
- [
"ubuntu_22_jammy", #variant name
"ubuntu:jammy", #image
]
prop:
- [
"amd64", # variant name
"amd64", # platform spec
"", # image prefix
]
- [
"i386", # variant name
"i386", # 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: [ get_version, build_linux, build_src, build_macos, build_windows ]
defaults:
run:
shell: bash
steps:
- name: Make folder for compatibility
run: |
mkdir compatibility
- name: Download artifacts
uses: actions/download-artifact@v3
with:
name: icloudpd-${{needs.get_version.outputs.icloudpd_version}}-artifacts
path: |
dist
- name: Set up QEMU
if: matrix.prop[1] != 'amd64' && matrix.prop[1] != '386'
uses: docker/setup-qemu-action@v2
- name: Run test for ${{ matrix.prop[2] }}${{ matrix.image[1] }} on ${{ matrix.prop[1] }}
id: run_test
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..." &&
apt-get update -y && apt-get install -y python3 python3-venv &&
echo "create venv and active..." &&
cd /work &&
python3 -m venv .venv &&
. .venv/bin/activate &&
echo "install icloudpd..." &&
pip3 install --disable-pip-version-check --find-links /work/dist icloudpd==${{needs.get_version.outputs.icloudpd_version}} &&
echo "test icloud..." &&
icloud -h &&
echo "test icloudpd..." &&
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
- name: Record failure for ${{ matrix.prop[2] }}${{ matrix.image[1] }} on ${{ matrix.prop[1] }}
if: ${{ steps.run_test.outcome == 'failure' }}
run: |
touch compatibility/pip.${{ matrix.image[0] }}.${{ matrix.prop[0] }}.fail
- name: Upload compatibility result
uses: actions/upload-artifact@v3
with:
name: icloudpd-${{needs.get_version.outputs.icloudpd_version}}-compatibility
if-no-files-found: error
path: |
compatibility/*
compatibility_linux_pip_apk:
name: "PIP on ${{ matrix.image[1] }} on linux/${{ matrix.prop[1] }} platform APK"
strategy:
fail-fast: false
matrix:
image:
- [
"python3_12_alpine3_18", #variant name
"python:3.12-alpine3.18", #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
]
- [
"i386", # variant name
"i386", # 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: [ get_version, build_linux, build_src, build_macos, build_windows ]
defaults:
run:
shell: bash
steps:
- name: Make folder for compatibility
run: |
mkdir compatibility
- name: Download artifacts
uses: actions/download-artifact@v3
with:
name: icloudpd-${{needs.get_version.outputs.icloudpd_version}}-artifacts
path: |
dist
- name: Set up QEMU
if: matrix.prop[1] != 'amd64' && matrix.prop[1] != '386'
uses: docker/setup-qemu-action@v2
- name: Run test for ${{ matrix.prop[2] }}${{ matrix.image[1] }} on ${{ matrix.prop[1] }}
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 "install default python..." &&
apk update && apk add python3 &&
echo "create venv and active..." &&
cd /work &&
python3 -m venv .venv &&
. .venv/bin/activate &&
echo "install icloudpd..." &&
pip3 install --disable-pip-version-check --find-links /work/dist icloudpd==${{needs.get_version.outputs.icloudpd_version}} &&
echo "test icloud..." &&
icloud -h &&
echo "test icloudpd..." &&
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
- name: Record failure for ${{ matrix.prop[2] }}${{ matrix.image[1] }} on ${{ matrix.prop[1] }}
if: ${{ steps.run_test.outcome == 'failure' }}
run: |
touch compatibility/pip.${{ matrix.image[0] }}.${{ matrix.prop[0] }}.fail
- name: Upload compatibility result
uses: actions/upload-artifact@v3
with:
name: icloudpd-${{needs.get_version.outputs.icloudpd_version}}-compatibility
if-no-files-found: error
path: |
compatibility/*
compatibility_nonlinux_pip:
name: "PIP on ${{ matrix.os }} on amd64 platform"
strategy:
fail-fast: false
matrix:
os: [ macos-11, macos-12, windows-2019, windows-2022 ]
runs-on: ${{ matrix.os }}
needs: [ get_version, build_macos, build_windows, build_linux, build_src ]
steps:
- name: Make folder for compatibility
run: |
mkdir compatibility
- name: Download artifacts
uses: actions/download-artifact@v3
with:
name: icloudpd-${{needs.get_version.outputs.icloudpd_version}}-artifacts
path: |
dist
- name: Run test for ${{ matrix.os }} on amd64
id: run_test
continue-on-error: true
run: >
pip3 install --disable-pip-version-check --find-links dist icloudpd==${{needs.get_version.outputs.icloudpd_version}} &&
icloud --help &&
icloudpd --version &&
touch compatibility/pip.${{ matrix.os }}.amd64.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 for ${{ matrix.os }} on amd64
if: ${{ steps.run_test.outcome == 'failure' }}
run: |
touch compatibility/pip.${{ matrix.image[0] }}.${{ matrix.prop[0] }}.fail
- name: Upload compatibility result
uses: actions/upload-artifact@v3
with:
name: icloudpd-${{needs.get_version.outputs.icloudpd_version}}-compatibility
if-no-files-found: error
path: |
compatibility/*
compatibility_report:
name: "Build Compatibility Report"
runs-on: ubuntu-22.04
needs: [ get_version, compatibility_nonlinux_pip, compatibility_linux_pip_apt, compatibility_linux_pip_apk ]
defaults:
run:
shell: bash
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up Python 3.12
uses: actions/setup-python@v4
with:
python-version: '3.12'
- name: Make folder for artifacts
run: |
mkdir dist
- name: Download compatibility results
uses: actions/download-artifact@v3
with:
name: icloudpd-${{needs.get_version.outputs.icloudpd_version}}-compatibility
path: |
compatibility
- name: Compile compatibility Report
run: |
echo "debugging report..."
scripts/compile_compatibility compatibility
echo "save report..."
scripts/compile_compatibility compatibility > dist/compatibility-${{needs.get_version.outputs.icloudpd_version}}.md
- name: Upload compatibility report
uses: actions/upload-artifact@v3
with:
name: icloudpd-${{needs.get_version.outputs.icloudpd_version}}-artifacts
if-no-files-found: error
path: |
dist/*