Skip to content

Commit

Permalink
Debug MacOS…
Browse files Browse the repository at this point in the history
  • Loading branch information
coldfix committed Dec 17, 2024
1 parent a274701 commit ff64fd6
Showing 1 changed file with 17 additions and 228 deletions.
245 changes: 17 additions & 228 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,150 +16,6 @@ jobs:
- run: pip install flake8
- run: flake8

build_linux:
name: "Build: Linux (x64)"
runs-on: ubuntu-latest
strategy:
matrix:
base:
- manylinux2014_x86_64
- manylinux2014_aarch64
steps:
- uses: actions/checkout@v4
- run: echo "MADX_VERSION=$(cat MADX_VERSION)" >> $GITHUB_ENV

- name: Download cached MAD-X build
id: madx-build-cache
uses: actions/cache@v4
with:
path: src/MAD-X/dist
key: "\
madx-${{ env.MADX_VERSION }}-\
${{ matrix.base }}-\
patches-${{ hashFiles('.github/patch/*') }}-\
scripts-${{ hashFiles('.github/build/linux/madx*') }}\
"

- run: git clone https://github.com/MethodicalAcceleratorDesign/MAD-X
src/MAD-X -b $MADX_VERSION --depth 1
if: steps.madx-build-cache.outputs.cache-hit != 'true'

- name: Set up QEMU for running arm64 containers
if: endsWith(matrix.base, '_aarch64')
uses: docker/setup-qemu-action@v3

- name: Prepare docker image
run: |
docker buildx build .github/build/linux \
--build-arg UID=`id -u` \
--build-arg GID=`id -g` \
--build-arg BASE=${{ matrix.base }} \
-t builder
shell: bash

- name: Build MAD-X
if: steps.madx-build-cache.outputs.cache-hit != 'true'
run: |
docker run --rm --init \
-w /mnt \
-v `pwd`:/mnt \
builder \
.github/build/linux/madx.sh src/MAD-X build/MAD-X dist/MAD-X
shell: bash

- name: Build cpymad wheels
run: |
docker run --rm --init \
-w /mnt \
-v `pwd`:/mnt \
builder \
.github/build/linux/cpymad.sh dist/MAD-X
shell: bash

- name: Upload cpymad wheels
uses: actions/upload-artifact@v4
with:
name: dist-linux-${{ matrix.base }}
path: |
dist/
!dist/MAD-X
build_windows:
name: "Build: Windows"
runs-on: windows-latest
defaults:
run:
shell: msys2 {0}
steps:
- uses: actions/checkout@v4
- uses: msys2/setup-msys2@v2
with:
update: true
path-type: inherit
install: mingw-w64-ucrt-x86_64-gcc
mingw-w64-ucrt-x86_64-gcc-fortran
mingw-w64-ucrt-x86_64-cmake

- run: echo "MSYSTEM=UCRT64" >> $GITHUB_ENV
- run: echo "MADX_VERSION=$(cat MADX_VERSION)" >> $GITHUB_ENV

- name: Download cached MAD-X build
id: madx-build-cache
uses: actions/cache@v4
with:
path: src/MAD-X/dist
key: "\
madx-${{ env.MADX_VERSION }}-\
windows-\
patches-${{ hashFiles('.github/patch/*') }}-\
scripts-${{ hashFiles('.github/build/windows/madx*') }}\
"

- run: git clone https://github.com/MethodicalAcceleratorDesign/MAD-X
src/MAD-X -b $MADX_VERSION --depth 1
if: steps.madx-build-cache.outputs.cache-hit != 'true'

- name: Apply patches
if: steps.madx-build-cache.outputs.cache-hit != 'true'
run: git -C src/MAD-X apply - <.github/patch/fix-madx-win32.patch
- name: Build MAD-X
if: steps.madx-build-cache.outputs.cache-hit != 'true'
run: .github/build/windows/madx.sh src/MAD-X

- uses: actions/setup-python@v5
with: {python-version: "3.6"}
- run: .github/build/windows/cpymad.sh src/MAD-X/dist 3.6

- uses: actions/setup-python@v5
with: {python-version: "3.7"}
- run: .github/build/windows/cpymad.sh src/MAD-X/dist 3.7

- uses: actions/setup-python@v5
with: {python-version: "3.8"}
- run: .github/build/windows/cpymad.sh src/MAD-X/dist 3.8

- uses: actions/setup-python@v5
with: {python-version: "3.9"}
- run: .github/build/windows/cpymad.sh src/MAD-X/dist 3.9

- uses: actions/setup-python@v5
with: {python-version: "3.10"}
- run: .github/build/windows/cpymad.sh src/MAD-X/dist 3.10

- uses: actions/setup-python@v5
with: {python-version: "3.11"}
- run: .github/build/windows/cpymad.sh src/MAD-X/dist 3.11

- uses: actions/setup-python@v5
with: {python-version: "3.12"}
- run: .github/build/windows/cpymad.sh src/MAD-X/dist 3.12

- name: Upload cpymad wheels
uses: actions/upload-artifact@v4
with:
name: dist-windows
path: dist

build_macos:
name: "Build: MacOS"
runs-on: macos-13
Expand Down Expand Up @@ -198,8 +54,8 @@ jobs:
set -xeo pipefail
if [[ ${{ matrix.arch }} == "x86_64" ]]; then
FC=gfortran-11
LIBDIR=$(dirname $(find /usr/local/Cellar/gcc@11 -name libgfortran.dylib))
FC=gfortran-12
LIBDIR=$(dirname $(find /usr/local/Cellar/gcc@12 -name libgfortran.dylib))
echo "MACOSX_DEPLOYMENT_TARGET=11.0" >> $GITHUB_ENV
elif [[ ${{ matrix.arch }} == "arm64" ]]; then
Expand Down Expand Up @@ -230,31 +86,35 @@ jobs:

- uses: actions/setup-python@v5
with: { python-version: "3.6" }
- run: .github/build/macos/cpymad.sh src/MAD-X/dist
- run: .github/build/macos/cpymad.sh src/MAD-X/dist || true

- uses: actions/setup-python@v5
with: { python-version: "3.7" }
- run: .github/build/macos/cpymad.sh src/MAD-X/dist
- run: .github/build/macos/cpymad.sh src/MAD-X/dist || true

- uses: actions/setup-python@v5
with: { python-version: "3.8" }
- run: .github/build/macos/cpymad.sh src/MAD-X/dist
- run: .github/build/macos/cpymad.sh src/MAD-X/dist || true

- uses: actions/setup-python@v5
with: { python-version: "3.9" }
- run: .github/build/macos/cpymad.sh src/MAD-X/dist
- run: .github/build/macos/cpymad.sh src/MAD-X/dist || true

- uses: actions/setup-python@v5
with: { python-version: "3.10" }
- run: .github/build/macos/cpymad.sh src/MAD-X/dist
- run: .github/build/macos/cpymad.sh src/MAD-X/dist || true

- uses: actions/setup-python@v5
with: { python-version: "3.11" }
- run: .github/build/macos/cpymad.sh src/MAD-X/dist
- run: .github/build/macos/cpymad.sh src/MAD-X/dist || true

- uses: actions/setup-python@v5
with: { python-version: "3.12" }
- run: .github/build/macos/cpymad.sh src/MAD-X/dist
- run: .github/build/macos/cpymad.sh src/MAD-X/dist || true

- uses: actions/setup-python@v5
with: { python-version: "3.13" }
- run: .github/build/macos/cpymad.sh src/MAD-X/dist || true

- name: Fixup wheel dependencies
run: |
Expand All @@ -268,15 +128,17 @@ jobs:
name: dist-macos-${{ matrix.arch }}
path: dist

- uses: mxschmitt/action-tmate@v3
with: {limit-access-to-actor: true}
if: failure()

test:
name: Tests
runs-on: ${{ matrix.os.run }}
needs: [build_linux, build_windows, build_macos]
strategy:
matrix:
os:
- {run: ubuntu-latest, dist: dist-linux-manylinux2014_x86_64}
- {run: windows-latest, dist: dist-windows}
- {run: macos-latest, dist: dist-macos-arm64}
- {run: macos-13, dist: dist-macos-x86_64}
python:
Expand Down Expand Up @@ -321,76 +183,3 @@ jobs:
- run: coverage run --source=cpymad -p -m pytest -v -k "not dframe"
- run: pip install pandas
- run: coverage run --source=cpymad -p -m pytest -v -k "dframe"

- run: coverage combine
- run: coveralls
if: inputs.COVERALLS_REPO_TOKEN != ''
env:
COVERALLS_REPO_TOKEN: ${{ inputs.COVERALLS_REPO_TOKEN }}

documentation:
name: Update documentation
needs: build_linux
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.9'
- uses: actions/download-artifact@v4
with:
name: dist-linux-manylinux2014_x86_64
path: dist

- run: sudo apt-get install -qy graphviz
- run: pip install -U pip
- run: pip install cpymad[doc] -f dist
- run: make -C doc html

- name: Deploy to GitHub Pages
if: success() && (
startsWith(github.ref, 'refs/tags/v') ||
github.ref == 'refs/heads/master')
uses: crazy-max/ghaction-github-pages@v4
with:
build_dir: doc/_build/html
commit_message: Build documentation from ${{ github.ref }}@${{ github.sha }}
jekyll: false
env:
GITHUB_TOKEN: ${{ github.token }}

upload_release:
name: Upload release
needs: test
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/v')

steps:
- uses: actions/setup-python@v5
with:
python-version: '3.x'

- name: Fetch built distributions
uses: actions/download-artifact@v4
with:
path: dist

- name: Merge artifacts to single folder
run: |
mv dist/dist-*/*.whl dist/
mv dist/dist-linux-manylinux2014_x86_64/*.tar.gz dist/
- name: Install twine
run: pip install twine

- name: Publish PyPI package
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
run: twine upload dist/*.whl dist/*.tar.gz

- name: Create GitHub Release
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/v')
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 comments on commit ff64fd6

Please sign in to comment.