Skip to content

SYNC: Bump Xsuite to v0.54.1 #39

SYNC: Bump Xsuite to v0.54.1

SYNC: Bump Xsuite to v0.54.1 #39

name: Build & push image on tag
on:
push:
tags:
- "v*.*.*"
workflow_dispatch:
inputs:
push:
description: "Push images"
required: false
default: "false"
permissions:
contents: read
packages: write
jobs:
build-arm64-wheels:
runs-on: ubuntu-24.04-arm # Use an ARM64 runner
steps:
- name: Install build tools
run: |
sudo apt-get update
sudo apt-get install -y build-essential gcc
- uses: actions/checkout@v4
- name: Extract Python version
id: pyver
run: |
PYTHON_VERSION=$(
awk -F= '/^[[:space:]]*-[[:space:]]*python=/{print $2}' envs/full.yaml
)
XSUITE_VERSION=$(
awk -F'==' '/xsuite\[full_env\]==/ {print $2}' envs/full.yaml
)
echo "python_version=$PYTHON_VERSION" >> "$GITHUB_OUTPUT"
echo "xsuite_version=$XSUITE_VERSION" >> "$GITHUB_OUTPUT"
- uses: actions/setup-python@v5
with:
python-version: ${{ steps.pyver.outputs.python_version }}
- name: Build wheels
run: |
python -m pip install -U pip wheel build
mkdir -p wheelhouse
python -m pip wheel "xsuite[full_env]==${{ steps.pyver.outputs.xsuite_version }}" "xwakes[tests]" \
--wheel-dir wheelhouse
- uses: actions/upload-artifact@v4
with:
name: wheels-linux-arm64
path: wheelhouse/*.whl
build-and-push:
needs: build-arm64-wheels
runs-on: ubuntu-latest
strategy:
matrix:
include:
# CPU images (no suffix)
- name: full-cpu
flavor: full
image: ghcr.io/ekatralis/xsuite-containers
dockerfile: Dockerfile.cpu
platforms: linux/amd64,linux/arm64
tag_suffix: ""
gpu_stack: ""
- name: lite-cpu
flavor: lite
image: ghcr.io/ekatralis/xsuite-slim
dockerfile: Dockerfile.cpu
platforms: linux/amd64,linux/arm64
tag_suffix: ""
gpu_stack: ""
# CUDA image
- name: cuda
flavor: full
image: ghcr.io/ekatralis/xsuite-containers
dockerfile: Dockerfile.cuda
platforms: linux/amd64
tag_suffix: "-cuda"
gpu_stack: "12.9"
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up QEMU
if: contains(matrix.platforms, 'arm64')
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to GHCR
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Download ARM64 wheels
if: contains(matrix.platforms, 'arm64')
uses: actions/download-artifact@v4
with:
name: wheels-linux-arm64
path: wheels
- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ matrix.image }}
tags: |
type=raw,value=${{ github.ref_name }}${{ matrix.tag_suffix }}${{ matrix.gpu_stack }}
type=raw,value=latest${{ matrix.tag_suffix }}
- name: Build and push
uses: docker/build-push-action@v6
with:
context: .
file: ${{ matrix.dockerfile }}
build-args: |
FLAVOR=${{ matrix.flavor }}
VERSION=${{ github.ref_name }}
push: ${{ github.event_name == 'push' || inputs.push == 'true' }}
platforms: ${{ matrix.platforms }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha,scope=${{ matrix.name }}
cache-to: type=gha,mode=max,scope=${{ matrix.name }}