Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
Mizux committed Jan 22, 2025
1 parent 4146f7e commit 51b8b23
Show file tree
Hide file tree
Showing 13 changed files with 78 additions and 66 deletions.
44 changes: 22 additions & 22 deletions .github/workflows/amd64_docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,28 +18,28 @@ jobs:
ubuntu
]
fail-fast: false
name: amd64${{ matrix.distro }}
name: amd64${{ matrix.distro }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Check docker
run: |
docker info
docker buildx ls
- name: Build env image
run: make --directory=ci amd64_${{ matrix.distro }}_env
- name: Build devel project
run: make --directory=ci amd64_${{ matrix.distro }}_devel
- name: Build project
run: make --directory=ci amd64_${{ matrix.distro }}_build
- name: Test project
run: make --directory=ci amd64_${{ matrix.distro }}_test
- uses: actions/checkout@v4
- name: Check docker
run: |
docker info
docker buildx ls
- name: Build env image
run: make --directory=ci amd64_${{ matrix.distro }}_env
- name: Build devel project
run: make --directory=ci amd64_${{ matrix.distro }}_devel
- name: Build project
run: make --directory=ci amd64_${{ matrix.distro }}_build
- name: Test project
run: make --directory=ci amd64_${{ matrix.distro }}_test

- name: Build install env image
run: make --directory=ci amd64_${{ matrix.distro }}_install_env
- name: Build install devel project
run: make --directory=ci amd64_${{ matrix.distro }}_install_devel
- name: Build install project
run: make --directory=ci amd64_${{ matrix.distro }}_install_build
- name: Test install project
run: make --directory=ci amd64_${{ matrix.distro }}_install_test
- name: Build install env image
run: make --directory=ci amd64_${{ matrix.distro }}_install_env
- name: Build install devel project
run: make --directory=ci amd64_${{ matrix.distro }}_install_devel
- name: Build install project
run: make --directory=ci amd64_${{ matrix.distro }}_install_build
- name: Test install project
run: make --directory=ci amd64_${{ matrix.distro }}_install_test
44 changes: 23 additions & 21 deletions .github/workflows/amd64_linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,24 +7,32 @@ on: [push, pull_request, workflow_dispatch]
jobs:
native:
strategy:
matrix:
cmake: [
{generator: "Unix Makefiles", config: "Release"},
{generator: "Ninja", config: "Release"},
{generator: "Ninja Multi-Config", config: "Release"},
]
python: [
{version: "3.9"},
{version: "3.10"},
{version: "3.11"},
{version: "3.12"},
{version: "3.13"},
]
fail-fast: false
name: Linux•${{ matrix.cmake.generator }}•Py${{ matrix.python.version }}
matrix:
cmake: [
{name: "Make", generator: "Unix Makefiles", config: "Release"},
{name: "Ninja", generator: "Ninja", config: "Release"},
{name: "NinjaMulti", generator: "Ninja Multi-Config", config: "Release"},
]
python: [
{version: "3.9"},
{version: "3.10"},
{version: "3.11"},
{version: "3.12"},
{version: "3.13"},
]
fail-fast: false
name: Linux•${{ matrix.cmake.name }}•Py${{ matrix.python.version }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python.version }}
- name: Check Python
run: python --version
- name: Update Path
run: echo "$HOME/.local/bin" >> $GITHUB_PATH
- name: Install Ninja
run: |
sudo apt-get update
Expand All @@ -33,12 +41,6 @@ jobs:
run: |
sudo apt install -y swig
swig -version
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python.version }}
- name: Update Path
run: echo "$HOME/.local/bin" >> $GITHUB_PATH
- name: Check cmake
run: cmake --version
- name: Configure
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/arm64_docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
#fedora, # timeout
#opensuse, # timeout
rockylinux,
ubuntu
#ubuntu, # Segmentation fault
]
fail-fast: false
name: arm64 • ${{ matrix.distro }}
Expand Down
2 changes: 1 addition & 1 deletion ci/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ help:
@echo -e "\t\t${BOLD}opensuse${RESET} (tumbleweed)"
@echo -e "\t\t${BOLD}rockylinux${RESET} (9)"
@echo -e "\t\t${BOLD}ubuntu${RESET} (rolling)"
@echo -e "\t\t${BOLD}all${RESET}: trigger ALL DISTROS."
@echo -e "\t\t${BOLD}all${RESET} trigger ALL DISTROS."
@echo
@echo -e "\tWith ${BOLD}<stage>${RESET}:"
@echo -e "\t\t${BOLD}env${RESET}"
Expand Down
31 changes: 19 additions & 12 deletions ci/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ make --directory=ci
```

### Example

For example to test inside an `Alpine` container:
```sh
make alpine_test
Expand All @@ -38,6 +39,7 @@ Dockerfile is splitted in several stages.
![docker](docs/deps.svg)

### Run arm64v8 image on amd64 machine

You can build and run `arm64v8` (i.e. `aarch64`) docker container on a `amd64` host (`x86_64`) by enabling qemu support:
```sh
docker run --pull always --rm --privileged multiarch/qemu-user-static --reset -p yes
Expand All @@ -51,9 +53,10 @@ docker run --rm -it arm64v8/ubuntu
ref: https://github.com/docker-library/official-images#architectures-other-than-amd64

### Docker buildx

ref: https://docs.docker.com/buildx/working-with-buildx/

On you enable qemu support (see above), you can list available platform using:
Once you enable QEMU support (see above), you can list available platform using:
```sh
docker buildx ls
```
Expand All @@ -71,29 +74,33 @@ To control the version of CMake, instead of using the
* Install it using the [pypi package cmake](https://pypi.org/project/cmake/) (need a python stack)

### Install prebuilt

The recommended and faster way is to use the prebuilt version:

```Dockerfile
# Install CMake 3.21.4
RUN wget "https://cmake.org/files/v3.21/cmake-3.21.4-linux-x86_64.sh" \
&& chmod a+x cmake-3.21.4-linux-x86_64.sh \
&& ./cmake-3.21.4-linux-x86_64.sh --prefix=/usr/local/ --skip-license \
&& rm cmake-3.21.4-linux-x86_64.sh
# Install CMake 3.26.4
RUN wget "https://cmake.org/files/v3.26/cmake-3.26.4-linux-x86_64.sh" \
&& chmod a+x cmake-3.26.4-linux-x86_64.sh \
&& ./cmake-3.26.4-linux-x86_64.sh --prefix=/usr/local/ --skip-license \
&& rm cmake-3.26.4-linux-x86_64.sh
```

**warning**: Since [CMake 3.20](https://cmake.org/files/v3.20/) Kitware use a lowercase `linux` instead of `Linux`.

### Build from source

To build from source you can use the following snippet:

```Dockerfile
# Install CMake 3.21.4
RUN wget "https://cmake.org/files/v3.21/cmake-3.21.4.tar.gz" \
&& tar xzf cmake-3.21.4.tar.gz \
&& rm cmake-3.21.4.tar.gz \
&& cd cmake-3.21.4 \
# Install CMake 3.26.4
RUN wget "https://cmake.org/files/v3.26/cmake-3.26.4.tar.gz" \
&& tar xzf cmake-3.26.4.tar.gz \
&& rm cmake-3.26.4.tar.gz \
&& cd cmake-3.26.4 \
&& ./bootstrap --prefix=/usr/local/ \
&& make \
&& make install \
&& cd .. \
&& rm -rf cmake-3.21.4
&& rm -rf cmake-3.26.4
```

2 changes: 1 addition & 1 deletion ci/docker/alpine/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ WORKDIR /home/samples
COPY ci/samples .

FROM install_devel AS install_build
RUN python3 sample.py
RUN python3 -m compileall .

FROM install_build AS install_test
RUN python3 sample.py
2 changes: 1 addition & 1 deletion ci/docker/archlinux/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ WORKDIR /home/samples
COPY ci/samples .

FROM install_devel AS install_build
RUN python3 sample.py
RUN python3 -m compileall .

FROM install_build AS install_test
RUN python3 sample.py
2 changes: 1 addition & 1 deletion ci/docker/debian/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ WORKDIR /home/samples
COPY ci/samples .

FROM install_devel AS install_build
RUN python3 sample.py
RUN python3 -m compileall .

FROM install_build AS install_test
RUN python3 sample.py
2 changes: 1 addition & 1 deletion ci/docker/fedora/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ WORKDIR /home/samples
COPY ci/samples .

FROM install_devel AS install_build
RUN python3 sample.py
RUN python3 -m compileall .

FROM install_build AS install_test
RUN python3 sample.py
5 changes: 3 additions & 2 deletions ci/docker/manylinux/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,15 @@ RUN ./build-manylinux.sh test

FROM env AS install_env
COPY --from=build /home/project/build*/python/dist/*.whl ./
RUN python3 -m pip install --find-links=. pythonnative*.whl
RUN python3 -m pip install --find-links=. \
pythonnative*.whl

FROM install_env AS install_devel
WORKDIR /home/sample
COPY ci/samples .

FROM install_devel AS install_build
RUN python3 sample.py
RUN python3 -m compileall .

FROM install_build AS install_test
RUN python3 sample.py
3 changes: 2 additions & 1 deletion ci/docker/opensuse/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ RUN zypper update -y \
RUN zypper update -y \
&& zypper install -y python311 python311-devel \
python311-pip python311-wheel python311-setuptools \
python3-numpy python3-pandas \
&& zypper clean -a
RUN python3.11 -m pip install --break-system-packages \
mypy
Expand Down Expand Up @@ -48,7 +49,7 @@ WORKDIR /home/samples
COPY ci/samples .

FROM install_devel AS install_build
RUN python3 sample.py
RUN python3 -m compileall .

FROM install_build AS install_test
RUN python3 sample.py
3 changes: 2 additions & 1 deletion ci/docker/rockylinux/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ RUN CTEST_OUTPUT_ON_FAILURE=1 cmake --build build --target test -v
# Test install rules
FROM env AS install_env
COPY --from=build /home/project/build/python/dist/*.whl ./
RUN python3 -m pip install --find-links=. pythonnative*.whl
RUN python3 -m pip install --find-links=. \
pythonnative*.whl

FROM install_env AS install_devel
WORKDIR /home/samples
Expand Down
2 changes: 1 addition & 1 deletion ci/docs/generate_image.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/env bash
set -eux
set -euxo pipefail

# Check plantuml is in PATH
command -v plantuml
Expand Down

0 comments on commit 51b8b23

Please sign in to comment.