Skip to content

feat: Supporting big endian architecture. #559

feat: Supporting big endian architecture.

feat: Supporting big endian architecture. #559

Workflow file for this run

name: Python
on:
pull_request:
jobs:
build_and_test:
name: Check everything builds & tests
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
# Lowest and highest, no version specified so that
# new releases get automatically tested against
version: [{torch: torch==1.10, python: "3.8"}, {torch: torch, python: "3.10"}]
defaults:
run:
working-directory: ./bindings/python
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
components: rustfmt, clippy
- uses: Swatinem/rust-cache@v2
with:
workspaces: "bindings/python"
- name: Install Python
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.version.python }}
architecture: "x64"
- name: Lint with RustFmt
run: cargo fmt -- --check
- name: Lint with Clippy
run: cargo clippy --all-targets --all-features -- -D warnings
- name: Run Audit
run: cargo audit -D warnings
- name: Install
run: |
pip install -U pip
pip install .[numpy,tensorflow,paddlepaddle]
pip install ${{ matrix.version.torch }}
- name: Install (jax, flax)
if: matrix.os != 'windows-latest'
run: |
pip install .[jax]
shell: bash
- name: Check style
run: |
pip install .[quality]
black --check --line-length 119 --target-version py35 py_src/safetensors tests
- name: Run tests
run: |
cargo test
pip install .[testing]
pytest -sv tests/
test_s390x_big_endian:
runs-on: ubuntu-latest
name: Test bigendian - S390X
steps:
- uses: actions/checkout@v2
- name: Upgrade libssl
run: sudo apt-get install -y libssl-dev
- name: Pull images
run: |
docker pull multiarch/qemu-user-static
- name: Install QEMU
run: |
docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
docker pull --platform linux/s390x s390x/python
docker buildx create --use --driver=docker-container
- uses: tailscale/github-action@v1
with:
authkey: ${{ secrets.TAILSCALE_AUTHKEY }}
- name: Set short sha
id: vars
run: echo "GITHUB_SHA_SHORT=$(git rev-parse --short HEAD)" >> $GITHUB_ENV
- name: Docker meta
id: meta
uses: docker/metadata-action@v4
with:
# list of Docker images to use as base name for tags
images: |
registry.internal.huggingface.tech/safetensors/s390x
# generate Docker tags based on the following events/attributes
tags: |
type=schedule
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
type=sha
- name: Login to Registry
uses: docker/login-action@v2
with:
registry: registry.internal.huggingface.tech
username: ${{ secrets.REGISTRY_USERNAME }}
password: ${{ secrets.REGISTRY_PASSWORD }}
- name: Update upstream (CPU)
uses: docker/build-push-action@v4
with:
push: true
file: Dockerfile.s390x.test
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=registry,ref=registry.internal.huggingface.tech/safetensors/s390x:cache,mode=max
cache-to: type=registry,ref=registry.internal.huggingface.tech/safetensors/s390x:cache,mode=max