From 9c356a7ceb6bfa1e9c76ee1a13fc84ae7dc93454 Mon Sep 17 00:00:00 2001 From: Andreas Kloeckner Date: Fri, 4 Sep 2020 22:32:21 -0500 Subject: [PATCH] Refactor Firedrake CI for less code duplication, install pybind 11 --- .ci/install-for-firedrake.sh | 19 +++++++++++ .../run_firedrake_examples.sh | 0 .github/workflows/ci.yml | 33 ++----------------- .gitlab-ci.yml | 18 ++-------- 4 files changed, 24 insertions(+), 46 deletions(-) create mode 100644 .ci/install-for-firedrake.sh rename {.github/workflows => .ci}/run_firedrake_examples.sh (100%) diff --git a/.ci/install-for-firedrake.sh b/.ci/install-for-firedrake.sh new file mode 100644 index 00000000..4b25ba82 --- /dev/null +++ b/.ci/install-for-firedrake.sh @@ -0,0 +1,19 @@ +sudo chown -R $(whoami) /github/home || true +sudo apt update +sudo apt upgrade -y +sudo apt install time +sudo apt install -y pocl-opencl-icd ocl-icd-opencl-dev + +. /home/firedrake/firedrake/bin/activate +grep -v loopy requirements.txt > /tmp/myreq.txt + +# This shouldn't be necessary, but... +# https://github.com/inducer/meshmode/pull/48#issuecomment-687519451 +pip install pybind11 + +# The Firedrake container is based on Py3.6 as of 2020-10-10, which +# doesn't have dataclasses. +pip install dataclasses + +pip install -r /tmp/myreq.txt +pip install --force-reinstall git+https://github.com/benSepanski/loopy.git@firedrake-usable_for_potentials diff --git a/.github/workflows/run_firedrake_examples.sh b/.ci/run_firedrake_examples.sh similarity index 100% rename from .github/workflows/run_firedrake_examples.sh rename to .ci/run_firedrake_examples.sh diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 431dd499..9bf5fe81 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -40,21 +40,9 @@ jobs: image: 'firedrakeproject/firedrake' steps: - uses: actions/checkout@v1 - # This Dependencies setup is the same setup used for running firedrake - # examples, but had to be copied since github doesn't support yaml - # anchors. Changes made here should also be made there - name: "Dependencies" run: | - sudo apt update - sudo apt upgrade -y - sudo apt install time - sudo apt install -y pocl-opencl-icd ocl-icd-opencl-dev - sudo chown -R $(whoami) /github/home - - . /home/firedrake/firedrake/bin/activate - grep -v loopy requirements.txt > /tmp/myreq.txt - pip install -r /tmp/myreq.txt - pip install --force-reinstall git+https://github.com/benSepanski/loopy.git@firedrake-usable_for_potentials + . .ci/install-for-firedrake.sh # The Firedrake container is based on Py3.6 as of 2020-10-10, which # doesn't have dataclasses. pip install pytest dataclasses @@ -72,29 +60,14 @@ jobs: image: 'firedrakeproject/firedrake' steps: - uses: actions/checkout@v1 - # This Dependencies setup is the same setup used for running firedrake - # tests, but had to be copied since github doesn't support yaml - # anchors. Changes made here should also be made there - name: "Dependencies" run: | - sudo apt update - sudo apt upgrade -y - sudo apt install time - sudo apt install -y pocl-opencl-icd ocl-icd-opencl-dev - sudo chown -R $(whoami) /github/home - - . /home/firedrake/firedrake/bin/activate - grep -v loopy requirements.txt > /tmp/myreq.txt - pip install -r /tmp/myreq.txt - pip install --force-reinstall git+https://github.com/benSepanski/loopy.git@firedrake-usable_for_potentials - # The Firedrake container is based on Py3.6 as of 2020-10-10, which - # doesn't have dataclasses. - pip install pytest dataclasses + . .ci/install-for-firedrake.sh pip install . - name: "Examples" run: | . /home/firedrake/firedrake/bin/activate - . ./.github/workflows/run_firedrake_examples.sh + . ./.ci/run_firedrake_examples.sh examples3: name: Examples Conda Py3 diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 9b3049ce..7ed111cf 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -54,20 +54,7 @@ Python 3 POCL Firedrake: - "docker-runner" image: "firedrakeproject/firedrake" script: - - &firedrake_setup | - sudo apt update - sudo apt upgrade -y - sudo apt install time - sudo apt install -y pocl-opencl-icd ocl-icd-opencl-dev - source ~/firedrake/bin/activate - grep -v loopy requirements.txt > myreq.txt - pip install -r myreq.txt - pip install --force-reinstall git+https://github.com/benSepanski/loopy.git@firedrake-usable_for_potentials - # The Firedrake container is based on Py3.6 as of 2020-10-10, which - # doesn't have dataclasses. - pip install pytest dataclasses - pip install . - # run tests + - .ci/install-for-firedrake.sh - cd test - python -m pytest --tb=native --junitxml=pytest.xml -rxsw test_firedrake_interop.py artifacts: @@ -79,8 +66,7 @@ Python 3 POCL Firedrake Examples: - "docker-runner" image: "firedrakeproject/firedrake" script: - - *firedrake_setup - # run examples + - .ci/install-for-firedrake.sh - . ./.github/workflows/run_firedrake_examples.sh artifacts: reports: -- GitLab