Skip to content

Commit

Permalink
rework qemu tests again
Browse files Browse the repository at this point in the history
  • Loading branch information
rjfarmer committed Jan 21, 2024
1 parent 1d268a4 commit 6ad0560
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 24 deletions.
39 changes: 16 additions & 23 deletions .github/workflows/qemu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,30 +18,31 @@ jobs:
"armhf",
"arm-linux-gnueabihf",
"arm32v7/ubuntu:22.04",
"armhf-cross",
"linux/arm/v7",
]
- [
"ppc64le",
"powerpc64le-linux-gnu",
"ppc64le/ubuntu:22.04",
"ppc64el-cross"
"linux/ppc64le",
]
- [
"s390x",
"s390x-linux-gnu",
"s390x/ubuntu:22.04",
"s390x-cross",
"linux/s390x",
]
- [
"riscv64",
"riscv64-linux-gnu",
"riscv64/ubuntu:22.04",
"riscv64-cross",
"linux/riscv64",
]
env:
NAME: ${{ matrix.BUILD_PROP[0] }}
TOOLCHAIN_NAME: ${{ matrix.BUILD_PROP[1] }}
DOCKER_CONTAINER: ${{ matrix.BUILD_PROP[2] }}
LIBC_NAME: ${{ matrix.BUILD_PROP[3] }}
PLATFORM_NAME: ${{ matrix.BUILD_PROP[3] }}
TERM: xterm-256color

name: "${{ matrix.BUILD_PROP[0] }}"
Expand All @@ -59,37 +60,29 @@ jobs:
uses: actions/cache@v3
id: container-cache
with:
path: ~/docker_${{ matrix.BUILD_PROP[1] }}.tar
path: docker_${TOOLCHAIN_NAME}.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 "
docker run --name ${TOOLCHAIN_NAME} --platform ${PLATFORM_NAME} --interactive -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] }}
docker commit ${TOOLCHAIN_NAME} ${TOOLCHAIN_NAME}
docker save -o docker_${TOOLCHAIN_NAME}.tar ${TOOLCHAIN_NAME}
- name: Load container from cache
if: steps.container-cache.outputs.cache-hit == 'true'
run: docker load -i "~/docker_${TOOLCHAIN_NAME}/the_container.tar"
run: docker load -i docker_${TOOLCHAIN_NAME}.tar

- name: Build
- name: Build and test
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
'"
docker run -v $(pwd):/gfort2py --platform ${PLATFORM_NAME} ${TOOLCHAIN_NAME} /bin/bash -c "
cd /gfort2py && python -m build && python -m pip install dist/gfort2py*.whl && python -m pytest -v
"
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ var/
*.egg-info/
.installed.cfg
*.egg

*.tar
# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
Expand Down

0 comments on commit 6ad0560

Please sign in to comment.