From bad6fd0510d91d71f2623091ed4d0bdd427b6b19 Mon Sep 17 00:00:00 2001 From: Yuan SUN Date: Tue, 26 Nov 2024 12:03:04 +0100 Subject: [PATCH] test arm64 packages --- .github/workflows/schedule.yml | 109 ++++++++++++++++++++++++++------- 1 file changed, 88 insertions(+), 21 deletions(-) diff --git a/.github/workflows/schedule.yml b/.github/workflows/schedule.yml index 7afd4c0..d0c5344 100644 --- a/.github/workflows/schedule.yml +++ b/.github/workflows/schedule.yml @@ -1,11 +1,11 @@ name: Test the PYPI package in all the platforms -# on: [push, pull_request] +on: [push, pull_request] -on: - schedule: - - cron: '30 10 * * 1' +# on: +# schedule: +# - cron: '30 10 * * 1' jobs: checkout-code: @@ -22,14 +22,46 @@ jobs: name: test path: ./test/ - test-download-package: + # test-x86_64-package: + # needs: checkout-code + # name: Test package ${{ matrix.os }} ${{ matrix.python-version }} + # runs-on: ${{ matrix.os }} + # strategy: + # matrix: + # os: [windows-2019, windows-2022, ubuntu-20.04, ubuntu-22.04, ubuntu-24.04, macos-13, macos-14, macos-15] + # python-version: ["3.10", "3.11","3.12", "3.13"] + + # steps: + # - name: Download git repo code + # uses: actions/download-artifact@v4 + # with: + # pattern: test + # path: image_io/ + + # - uses: actions/setup-python@v5 + # with: + # python-version: ${{ matrix.python-version }} + + # - name: Install cxx-image-io from test pypi and run NRT test + # run: | + # python -c "import sys; print(sys.version)" + # python -m pip install --upgrade pip + # python -m pip install numpy pytest + # pip install cxx-image-io + # cd image_io/ + # mkdir -p test/_outputs + # pytest -sv + + test-arm64-package: needs: checkout-code - name: Test package - runs-on: ${{ matrix.os }} + name: Test package on ${{ matrix.distro }} ${{ matrix.arch }} + # The host should always be linux + runs-on: ubuntu-latest strategy: + fail-fast: false matrix: - os: [windows-2019, windows-2022, ubuntu-20.04, ubuntu-22.04, ubuntu-24.04, macos-13, macos-14, macos-15] - python-version: ["3.10", "3.11","3.12", "3.13"] + distro: [ubuntu_latest, bookworm, fedora_latest, alpine_latest, archarm_latest] + arch: [aarch64] steps: - name: Download git repo code @@ -38,16 +70,51 @@ jobs: pattern: test path: image_io/ - - uses: actions/setup-python@v5 + # Run steps on a matrix of 4 arch/distro combinations + - uses: uraimo/run-on-arch-action@v2 + name: Build artifact + id: build with: - python-version: ${{ matrix.python-version }} - - - name: Install cxx-image-io from test pypi and run NRT test - run: | - python -c "import sys; print(sys.version)" - python -m pip install --upgrade pip - python -m pip install numpy pytest - pip install cxx-image-io - cd image_io/ - mkdir -p test/_outputs - pytest -sv \ No newline at end of file + arch: ${{ matrix.arch }} + distro: ${{ matrix.distro }} + + # Not required, but speeds up builds + githubToken: ${{ github.token }} + # Mount the image_io/test directory as /test in the container + dockerRunArgs: | + --volume "${PWD}/image_io/test:/test" + # Pass some environment variables to the container + env: | # YAML, but pipe character is necessary + artifact_name: pytest-${{ matrix.distro }}_${{ matrix.arch }} + # The shell to run commands with in the container + shell: /bin/sh + # Install some dependencies in the container. This speeds up builds if + # you are also using githubToken. Any dependencies installed here will + # be part of the container image that gets cached, so subsequent + # builds don't have to re-install them. The image layer is cached + # publicly in your project's package repository, so it is vital that + # no secrets are present in the container state or logs. + install: | + case "${{ matrix.distro }}" in + ubuntu*|bookworm) + apt-get update -q -y + apt-get install -q -y git ninja-build nasm python3 python3-pip python3-pytest cmake + ;; + fedora*) + dnf -y update + dnf -y install git which ninja-build nasm python3 python3-pip python3-pytest cmake + ;; + alpine*) + apk update + apk add git nasm samurai python3 py3-pip py3-pytest cmake + ;; + archarm*) + pacman -Sy --needed --noconfirm git base-devel cmake ninja python-pip python-pytest + ;; + esac + # Produce a binary artifact and place it in the mounted volume + run: | + cd /test + pip install cxx-image-io --break-system-packages + mkdir -p /test/_outputs + pytest -sv