Skip to content

Commit 4d529ec

Browse files
committed
Break clingo linux builds out into separate VMs
1 parent 8d1406c commit 4d529ec

File tree

2 files changed

+81
-95
lines changed

2 files changed

+81
-95
lines changed

.github/workflows/clingo.yml

Lines changed: 75 additions & 87 deletions
Original file line numberDiff line numberDiff line change
@@ -21,113 +21,101 @@ env:
2121
PYTHONUNBUFFERED: 1
2222

2323
jobs:
24-
macos_build:
25-
runs-on: ${{ matrix.runner[0] }}
26-
strategy:
27-
matrix:
28-
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13", "3.14"]
29-
# runner + macOS deployment target
30-
runner: [["macos-14", "14"], ["macos-15", "15"], ["macos-26", "26"]]
31-
exclude:
32-
- python-version: "3.8"
33-
runner: ["macos-15", "15"]
34-
- python-version: "3.8"
35-
runner: ["macos-26", "26"]
36-
- python-version: "3.9"
37-
runner: ["macos-26", "26"]
38-
env:
39-
MACOSX_DEPLOYMENT_TARGET: ${{ matrix.runner[1] }}
40-
steps:
41-
- uses: actions/checkout@v4
42-
- uses: actions/checkout@v4
43-
with:
44-
repository: spack/spack
45-
path: spack
46-
ref: 734c5db2121b01c373eed6538e452f18887e9e44
47-
# See https://github.com/actions/setup-python/issues/960
48-
- name: Workaround for broken Python versions from setup-python
49-
run: brew install gettext zlib
50-
- uses: actions/setup-python@v4
51-
with:
52-
python-version: ${{ matrix.python-version }}
53-
- name: Install clingo-bootstrap
54-
run: |
55-
pip install --upgrade pip
56-
export PATH="$(brew --prefix bison):$PATH"
57-
. spack/share/spack/setup-env.sh
58-
59-
rm -rf $(spack location -p podman)
60-
61-
spack config add "config:install_tree:padded_length:256"
62-
63-
spack python clingo/install_clingo.py
64-
spack buildcache push --unsigned ./binary-mirror clingo-bootstrap
65-
- uses: actions/upload-artifact@v5
66-
with:
67-
name: clingo_binary_mirror-${{ matrix.runner[0] }}-${{ matrix.runner[1] }}-${{ matrix.python-version }}
68-
path: binary-mirror
24+
# macos_build:
25+
# runs-on: ${{ matrix.runner[0] }}
26+
# strategy:
27+
# matrix:
28+
# python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13", "3.14"]
29+
# # runner + macOS deployment target
30+
# runner: [["macos-14", "14"], ["macos-15", "15"], ["macos-26", "26"]]
31+
# exclude:
32+
# - python-version: "3.8"
33+
# runner: ["macos-15", "15"]
34+
# - python-version: "3.8"
35+
# runner: ["macos-26", "26"]
36+
# - python-version: "3.9"
37+
# runner: ["macos-26", "26"]
38+
# env:
39+
# MACOSX_DEPLOYMENT_TARGET: ${{ matrix.runner[1] }}
40+
# steps:
41+
# - uses: actions/checkout@v4
42+
# - uses: actions/checkout@v4
43+
# with:
44+
# repository: spack/spack
45+
# path: spack
46+
# ref: 734c5db2121b01c373eed6538e452f18887e9e44
47+
# # See https://github.com/actions/setup-python/issues/960
48+
# - name: Workaround for broken Python versions from setup-python
49+
# run: brew install gettext zlib
50+
# - uses: actions/setup-python@v4
51+
# with:
52+
# python-version: ${{ matrix.python-version }}
53+
# - name: Install clingo-bootstrap
54+
# run: |
55+
# pip install --upgrade pip
56+
# export PATH="$(brew --prefix bison):$PATH"
57+
# . spack/share/spack/setup-env.sh
58+
59+
# rm -rf $(spack location -p pod man)
60+
61+
# spack config add "config:install_tree:padded_length:256"
62+
63+
# spack python clingo/install_clingo.py
64+
# spack buildcache push --unsigned ./binary-mirror clingo-bootstrap
65+
# - uses: actions/upload-artifact@v5
66+
# with:
67+
# name: clingo_binary_mirror-${{ matrix.runner[0] }}-${{ matrix.python-version }}
68+
# path: binary-mirror
6969

7070

7171
manylinux2014_build:
7272
runs-on: "ubuntu-latest"
73-
outputs:
74-
spack_manylinux_tag: ${{ fromJSON(steps.docker_meta.outputs.json).tags[0] }}
75-
permissions:
76-
packages: write
77-
73+
strategy:
74+
matrix:
75+
python-version: ["3.6", "3.7", "3.8", "3.9", "3.10", "3.11", "3.12", "3.13", "3.14"]
76+
arch: ["amd64", "arm64", "ppc64le"]
7877
steps:
7978
- uses: actions/checkout@v4
80-
81-
# Setup tags to be used for docker images
82-
- uses: docker/metadata-action@v5
83-
id: docker_meta
84-
with:
85-
images: ghcr.io/${{ github.repository_owner }}/clingo_manylinux2014
86-
87-
# Login to Github Packages
88-
- uses: docker/login-action@v3
89-
with:
90-
registry: ghcr.io
91-
username: ${{ github.actor }}
92-
password: ${{ secrets.GITHUB_TOKEN }}
93-
9479
- uses: docker/setup-qemu-action@v3
95-
id: qemu
80+
if: ${{ matrix.arch != 'amd64' }}
9681
with:
97-
platforms: linux/ppc64le,linux/arm64
82+
platforms: linux/${{ matrix.arch }}
9883

9984
- uses: docker/setup-buildx-action@v3
10085

101-
# Build and eventually push to registry
10286
- uses: docker/build-push-action@v5
10387
with:
10488
file: ./clingo/Dockerfile.manylinux2014
105-
platforms: linux/arm64,linux/ppc64le,linux/amd64
106-
cache-from: |
107-
ghcr.io/${{ github.repository_owner }}/clingo_manylinux2014:main
108-
${{ steps.docker_meta.outputs.tags }}
109-
cache-to: type=inline
110-
pull: ${{ github.event_name == 'pull_request' }}
111-
push: true
112-
tags: ${{ steps.docker_meta.outputs.tags }}
113-
labels: ${{ steps.docker_meta.outputs.labels }}
114-
115-
manylinux2014_upload:
116-
runs-on: ubuntu-latest
117-
needs: [ manylinux2014_build ]
118-
env:
119-
SPACK_MANYLINUX2014_TAG: ${{ needs.manylinux2014.outputs.spack_manylinux_tag }}
120-
steps:
121-
- uses: actions/checkout@v4
122-
- run: ./copy_mirror_manylinux2014.sh
89+
platforms: linux/${{ matrix.arch }}
90+
tags: clingo:latest
91+
build-Args: |
92+
PYTHON_VERSION=${{ matrix.python-version }}
93+
94+
- run: |
95+
docker create --name clingo-c --platform linux/${{ matrix.arch }} clingo
96+
docker cp "clingo-c:/root/binary-mirror" binary-mirror
97+
12398
- uses: actions/upload-artifact@v5
12499
with:
125-
name: clingo_binary_mirror-manylinux2014
100+
name: clingo_binary_mirror-linux-${{ matrix.arch}}-${{ matrix.python-version }}
126101
path: binary-mirror
127102

103+
# manylinux2014_upload:
104+
# runs-on: ubuntu-latest
105+
# needs: [ manylinux2014_build ]
106+
# env:
107+
# SPACK_MANYLINUX2014_TAG: ${{ needs.manylinux2014.outputs.spack_manylinux_tag }}
108+
# steps:
109+
# - uses: actions/checkout@v4
110+
# - run: ./copy_mirror_manylinux2014.sh
111+
# - uses: actions/upload-artifact@v5
112+
# with:
113+
# name: clingo_binary_mirror-manylinux2014
114+
# path: binary-mirror
115+
128116
clingo_json:
129117
runs-on: ubuntu-latest
130-
needs: [ macos_build, manylinux2014_upload]
118+
needs: [ manylinux2014_build ]
131119
steps:
132120
- uses: actions/checkout@v4
133121
- uses: actions/checkout@v4

clingo/Dockerfile.manylinux2014

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
FROM ghcr.io/spack/manylinux2014:v2024-10-16
22

3+
ARG PYTHON_VERSION
4+
35
RUN tar -C /opt/_internal -xvf /opt/_internal/static-libs-for-embedding-only.tar.xz
46

57
WORKDIR /root
@@ -20,13 +22,9 @@ RUN spack config add "config:install_tree:padded_length:256"
2022

2123
COPY clingo/install_clingo.py /root/install_clingo.py
2224

23-
RUN SPACK_PYTHON=/opt/python/cp36-cp36m/bin/python3 spack python install_clingo.py
24-
RUN SPACK_PYTHON=/opt/python/cp37-cp37m/bin/python3 spack python install_clingo.py
25-
RUN SPACK_PYTHON=/opt/python/cp38-cp38/bin/python3 spack python install_clingo.py
26-
RUN SPACK_PYTHON=/opt/python/cp39-cp39/bin/python3 spack python install_clingo.py
27-
RUN SPACK_PYTHON=/opt/python/cp310-cp310/bin/python3 spack python install_clingo.py
28-
RUN SPACK_PYTHON=/opt/python/cp311-cp311/bin/python3 spack python install_clingo.py
29-
RUN SPACK_PYTHON=/opt/python/cp312-cp312/bin/python3 spack python install_clingo.py
30-
RUN SPACK_PYTHON=/opt/python/cp313-cp313/bin/python3 spack python install_clingo.py
25+
RUN export PY_PATH=$(printf '%s' "$PYTHON_VERSION" | \
26+
awk -F. '{maj=$1; min=$2; suf=(maj*10+min<=37)?"m":""; printf "cp%d%d-cp%d%d%s\n", maj, min, maj, min, suf}')
27+
28+
RUN SPACK_PYTHON=/opt/python/$PY_PATH/bin/python3 spack python install_clingo.py
3129

3230
RUN spack buildcache push --unsigned ./binary-mirror $(spack --color=never find --hashes clingo-bootstrap)

0 commit comments

Comments
 (0)