Tweak container loading #37
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# adapted from Numpy's linux-qemu.yml file | |
name: Linux Qemu tests | |
on: [push, pull_request] | |
defaults: | |
run: | |
shell: bash | |
jobs: | |
qemu: | |
runs-on: ubuntu-22.04 | |
continue-on-error: true | |
strategy: | |
matrix: | |
BUILD_PROP: | |
- [ | |
"armhf", | |
"arm-linux-gnueabihf", | |
"arm32v7/ubuntu:22.04", | |
"armhf-cross", | |
] | |
- [ | |
"ppc64le", | |
"powerpc64le-linux-gnu", | |
"ppc64le/ubuntu:22.04", | |
"ppc64el-cross" | |
] | |
- [ | |
"s390x", | |
"s390x-linux-gnu", | |
"s390x/ubuntu:22.04", | |
"s390x-cross", | |
] | |
- [ | |
"riscv64", | |
"riscv64-linux-gnu", | |
"riscv64/ubuntu:22.04", | |
"riscv64-cross", | |
] | |
env: | |
TOOLCHAIN_NAME: ${{ matrix.BUILD_PROP[1] }} | |
DOCKER_CONTAINER: ${{ matrix.BUILD_PROP[2] }} | |
LIBC_NAME: ${{ matrix.BUILD_PROP[3] }} | |
TERM: xterm-256color | |
name: "${{ matrix.BUILD_PROP[0] }}" | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
fetch-depth: 0 | |
- name: Initialize binfmt_misc for qemu-user-static | |
run: | | |
docker run --rm --privileged multiarch/qemu-user-static --reset -p yes | |
- name: Cache docker container | |
uses: actions/cache@v3 | |
id: container-cache | |
with: | |
path: ~/docker_${{ matrix.BUILD_PROP[1] }}.tar | |
key: container-${{ runner.os }}-${{ matrix.BUILD_PROP[1] }}-${{ matrix.BUILD_PROP[2] }} | |
- name: Creates new container | |
if: steps.container-cache.outputs.cache-hit != 'true' | |
run: | | |
docker run --name ${{ matrix.BUILD_PROP[0] }} --interactive -v /:/host -v $(pwd):/gfort2py ${DOCKER_CONTAINER} /bin/bash -c " | |
apt-get update && | |
apt-get install -y cmake git python3 python-is-python3 python3-dev python3-venv python3-pip python3-numpy automake libc6-dev linux-libc-dev gcc gfortran && | |
git config --global --add safe.directory /gfort2py && | |
python -m pip install build wheel pytest cpyparsing platformdirs | |
" | |
docker commit ${{ matrix.BUILD_PROP[0] }} ${{ matrix.BUILD_PROP[0] }} | |
mkdir -p "~/docker_${TOOLCHAIN_NAME}" | |
docker save -o "~/docker_${TOOLCHAIN_NAME}/the_container.tar" ${{ matrix.BUILD_PROP[0] }} | |
- name: Load container from cache | |
if: steps.container-cache.outputs.cache-hit == 'true' | |
run: docker load -i "~/docker_${TOOLCHAIN_NAME}/the_container.tar" | |
- name: Build | |
run: | | |
docker run --rm -e "TERM=xterm-256color" -v $(pwd):/gfort2py -v /:/host ${{ matrix.BUILD_PROP[0] }}\ | |
/bin/script -e -q -c "/bin/bash --noprofile --norc -eo pipefail -c ' | |
cd /gfort2py && python -m build && python -m pip install dist/gfort2py*.whl | |
'" | |
- name: Run Tests | |
run: | | |
docker run --rm -e "TERM=xterm-256color" -v $(pwd):/gfort2py -v /:/host ${{ matrix.BUILD_PROP[0] }} \ | |
/bin/script -e -q -c "/bin/bash --noprofile --norc -eo pipefail -c ' | |
export FC=/usr/bin/gfortran | |
cd /gfort2py && python -m pytest -v | |
'" | |