Skip to content

Commit

Permalink
1:1 mapping of jinja workflow to reusable workflows
Browse files Browse the repository at this point in the history
Release test configurations have not yet been added.
  • Loading branch information
joaander committed Jun 5, 2024
1 parent d3aa85b commit ee0864f
Show file tree
Hide file tree
Showing 2 changed files with 357 additions and 0 deletions.
268 changes: 268 additions & 0 deletions .github/workflows/build_and_test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,268 @@
name: Build and test

on:
workflow_call:
inputs:
config:
type: string
required: true
container_prefix:
type: string
required: true
build_runner:
type: string
required: true
default: "[self-hosted,jetstream2,CPU]"
test_runner:
type: string
required: true
default: ubuntu-latest
test_docker_options:
type: string
required: false
validate:
type: boolean
required: false

env:
# prevent deadlocked MPI tests from causing the job to cancel
MPIEXEC_TIMEOUT: 3000
# allow mpirun to execute as root in the tests
OMPI_ALLOW_RUN_AS_ROOT: 1
OMPI_ALLOW_RUN_AS_ROOT_CONFIRM: 1
# allow openmpi to oversubscribe cores
OMPI_MCA_rmaps_base_oversubscribe: 1
# prevent errors from mis-configured openib systems
OMPI_MCA_btl: "vader,self"
# skip running the CPU tests in GPU builds
_HOOMD_SKIP_CPU_TESTS_WHEN_GPUS_PRESENT_: 1
# Require GPU tests in GPU builds.
_HOOMD_REQUIRE_GPU_TESTS_IN_GPU_BUILDS_: 1
# import HOOMD out of the build directory
PYTHONPATH: ${{ github.workspace }}/install

jobs:
build:
name: Build [${{ inputs.config }}]
runs-on: ${{fromJson(inputs.build_runner) }}
container:
image: glotzerlab/ci:2024.06.04-${{ inputs.container_prefix }}

steps:
- name: Set Werror on recent compilers
run: |
echo "CXXFLAGS=-Werror" >> $GITHUB_ENV
- name: Clean workspace
run: ( shopt -s dotglob nullglob; rm -rf ./* )
shell: bash
- name: Checkout
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
with:
path: code
submodules: true

- name: Configure
run: |
if [[ ${BUILD_DEBUG} == "true" ]]; then BUILD_TYPE="Debug"; else BUILD_TYPE="Release"; fi
echo "BUILD_TYPE=${BUILD_TYPE}"
cmake -S code -B build -GNinja \
-DCMAKE_BUILD_TYPE=${BUILD_TYPE} \
-DENABLE_GPU=${ENABLE_GPU:-"OFF"} \
-DENABLE_MPI=${ENABLE_MPI:-"OFF"} \
-DENABLE_TBB=${ENABLE_TBB:-"OFF"} \
-DENABLE_LLVM=${ENABLE_LLVM:-"OFF"} \
-DBUILD_MD=${BUILD_MD:-"ON"} \
-DBUILD_MPCD=${BUILD_MD:-"ON"} \
-DBUILD_METAL=${BUILD_MD:-"ON"} \
-DBUILD_HPMC=${BUILD_HPMC:-"ON"} \
-DCUDA_ARCH_LIST="60;70" \
-DENABLE_DEBUG_JIT=ON \
-DCMAKE_INSTALL_PREFIX=${GITHUB_WORKSPACE}/install \
-DPLUGINS=""
env:
ENABLE_GPU: ${{ contains(inputs.config, 'cuda') }}
ENABLE_MPI: ${{ contains(inputs.config, 'mpi') }}
ENABLE_TBB: ${{ contains(inputs.config, 'tbb') }}
ENABLE_LLVM: ${{ contains(inputs.config, 'llvm') }}
BUILD_MD: ${{ !contains(inputs.config, 'nomd') }}
BUILD_HPMC: ${{ !contains(inputs.config, 'nohpmc') }}
BUILD_DEBUG: ${{ contains(inputs.config, 'debug') }}
shell: bash
- name: Build
run: ninja install -j $(($(getconf _NPROCESSORS_ONLN) + 2))
working-directory: build
- name: Configure plugins
run : |
mkdir -p build-example-plugins
cd build-example-plugins
if [[ ${BUILD_DEBUG} == "true" ]]; then BUILD_TYPE="Debug"; else BUILD_TYPE="Release"; fi
echo "BUILD_TYPE=${BUILD_TYPE}"
CMAKE_PREFIX_PATH=${GITHUB_WORKSPACE}/install cmake -S code/example_plugins -B build-example-plugins -GNinja -DCMAKE_BUILD_TYPE=${BUILD_TYPE}
env:
BUILD_DEBUG: ${{ contains(inputs.config, 'debug') }}
shell: bash
- name: Build plugins
run: ninja install -j $(($(getconf _NPROCESSORS_ONLN) + 2))
working-directory: build-example-plugins

- name: Remove object files
run: find build -type f -name '*.o' -delete
- name: 'Tar build'
run: tar --use-compress-program='zstd -10 -T0' -cvf build.tar build
- name: 'Tar install'
run: tar --use-compress-program='zstd -10 -T0' -cvf install.tar install
- name: 'Upload build'
uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3
with:
name: build-${{ inputs.config }}-${{ github.sha }}
path: build.tar
retention-days: 7
- name: 'Upload install'
uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3
with:
name: install-${{ inputs.config }}-${{ github.sha }}
path: install.tar
retention-days: 7

- name: Clean workspace
run: ( shopt -s dotglob nullglob; rm -rf ./* )
shell: bash
- name: Clean HOME
run: ( shopt -s dotglob nullglob; rm -rf $HOME/* )
shell: bash


pytest:
name: Run pytest [${{ inputs.config }}]
needs: build
runs-on: ${{ fromJson(inputs.test_runner) }}
container:
image: glotzerlab/ci:2024.06.04-${{ inputs.container_prefix }}
options: ${{ inputs.test_docker_options }} -e CUDA_VISIBLE_DEVICES

steps:
- name: Clean workspace
run: ( shopt -s dotglob nullglob; rm -rf ./* )
shell: bash
- name: Checkout
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
with:
path: code
submodules: true

- name: Download install
uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7
with:
name: install-${{ inputs.config }}-${{ github.sha }}
- name: Untar install
run: tar --use-compress-program='zstd -10 -T0' -xvf install.tar

- name: Run pytest (serial)
run: python3 -m pytest --pyargs hoomd -x -v -ra --durations=0 --durations-min=0.1
- name: Run pytest (mpi)
if: ${{ contains(inputs.config, 'mpi') }}
run: mpirun -n 2 ${GITHUB_WORKSPACE}/install/hoomd/pytest/pytest-openmpi.sh --pyargs hoomd -x -v -ra --durations=0 --durations-min=0.1 || (( cat pytest.out.1 && exit 1 ))
- name: Run pytest (serial without cupy)
if: ${{ contains(inputs.config, 'cuda') }}
run: python3 -m pytest --pyargs hoomd -x -v -ra --durations=0 --durations-min=0.1 -m cupy_optional
env:
_HOOMD_DISALLOW_CUPY_: 1
- name: Run pytest (mpi without cupy)
if: ${{ contains(inputs.config, 'cuda') && contains(inputs.config, 'mpi') }}
run: mpirun -n 2 ${GITHUB_WORKSPACE}/install/hoomd/pytest/pytest-openmpi.sh --pyargs hoomd -x -v -ra --durations=0 --durations-min=0.1 -m cupy_optional || (( cat pytest.out.1 && exit 1 ))
env:
_HOOMD_DISALLOW_CUPY_: 1

- name: Clean workspace
run: ( shopt -s dotglob nullglob; rm -rf ./* )
shell: bash
- name: Clean HOME
run: ( shopt -s dotglob nullglob; rm -rf $HOME/* )
shell: bash


ctest:
name: Run ctest [${{ inputs.config }}]
needs: build
runs-on: ${{ fromJson(inputs.test_runner) }}
container:
image: glotzerlab/ci:2024.06.04-${{ inputs.container_prefix }}
options: ${{ inputs.test_docker_options }} -e CUDA_VISIBLE_DEVICES

steps:
- name: Clean workspace
run: ( shopt -s dotglob nullglob; rm -rf ./* )
shell: bash
- name: Checkout
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
with:
path: code
submodules: true

- name: Download build
uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7
with:
name: build-${{ inputs.config }}-${{ github.sha }}
- name: Untar build
run: tar --use-compress-program='zstd -10 -T0' -xvf build.tar

- name: Run tests
run: >-
ctest
-T test
--output-on-failure
--test-output-size-failed 1048576
--test-output-size-passed 1048576
working-directory: build

- name: Clean workspace
run: ( shopt -s dotglob nullglob; rm -rf ./* )
shell: bash
- name: Clean HOME
run: ( shopt -s dotglob nullglob; rm -rf $HOME/* )
shell: bash


validate:
name: Validate [${{ inputs.config }}]
needs: build
runs-on: ${{ fromJson(inputs.test_runner) }}
container:
image: glotzerlab/ci:2024.06.04-${{ inputs.container_prefix }}
options: ${{ inputs.test_docker_options }} -e CUDA_VISIBLE_DEVICES

if: ${{ contains(github.event.pull_request.labels.*.name, 'validate') && inputs.validate }}
steps:
- name: Clean workspace
run: ( shopt -s dotglob nullglob; rm -rf ./* )
shell: bash
- name: Checkout
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
with:
path: code
submodules: true

- name: Download install
uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7
with:
name: install-${{ inputs.config }}-${{ github.sha }}
- name: Untar install
run: tar --use-compress-program='zstd -10 -T0' -xvf install.tar

- name: Run pytest (serial)
if: ${{ !contains(inputs.config, 'mpi') }}
run: python3 -m pytest --pyargs hoomd -x -v -ra --durations=0 --durations-min=0.1 -p hoomd.pytest_plugin_validate -m validate --validate
- name: Run pytest (mpi)
if: ${{ contains(inputs.config, 'mpi') }}
run: mpirun -n 2 ${GITHUB_WORKSPACE}/install/hoomd/pytest/pytest-openmpi.sh --pyargs hoomd -x -v -ra --durations=0 --durations-min=0.1 -p hoomd.pytest_plugin_validate -m validate --validate || (( cat pytest.out.1 && exit 1 ))
- name: Run howto guides (serial)
if: ${{ contains(inputs.config, 'llvm') }} # some examples require LLVM
run: 'for i in *.py; do echo "Running howto: $i" && python3 $i || exit 1; done'
working-directory: code/sphinx-doc/howto

- name: Clean workspace
run: ( shopt -s dotglob nullglob; rm -rf ./* )
shell: bash
- name: Clean HOME
run: ( shopt -s dotglob nullglob; rm -rf $HOME/* )
shell: bash
89 changes: 89 additions & 0 deletions .github/workflows/tests_new.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
name: Tests (new)

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

on:
pull_request:
types: [opened, labeled, reopened, synchronize]

push:
branches:
- "trunk-*"

workflow_dispatch:

jobs:
start_action_runners:
name: Start action runners
runs-on: ubuntu-latest
steps:
- name: Use jetstream2-admin/start
uses: glotzerlab/jetstream2-admin/start@v1.2.5
with:
OS_APPLICATION_CREDENTIAL_ID: ${{ secrets.OS_APPLICATION_CREDENTIAL_ID }}
OS_APPLICATION_CREDENTIAL_SECRET: ${{ secrets.OS_APPLICATION_CREDENTIAL_SECRET }}

typical:
name: Build and test typical configurations
uses: ./.github/workflows/build_and_test.yaml
with:
config: ${{ join(matrix.config, '_') }}
container_prefix: ${{ matrix.config[0] }}
build_runner: ${{ toJson(matrix.build_runner) }}
test_runner: ${{ toJson(matrix.test_runner) }}
test_docker_options: ${{ matrix.test_docker_options }}
validate: ${{ matrix.validate }}

strategy:
fail-fast: false
matrix:
include:
- config: [clang14_py311, mpi, tbb, llvm]
build_runner: [self-hosted,jetstream2,CPU]
test_runner: ubuntu-latest
validate: true

- config: [gcc13_py312]
build_runner: [self-hosted,jetstream2,CPU]
test_runner: ubuntu-latest
validate: true

- config: [cuda120_gcc11_py310, mpi, llvm]
build_runner: [self-hosted,jetstream2,CPU]
test_runner: [self-hosted,GPU]
test_docker_options: '--gpus=all --device /dev/nvidia0 --device /dev/nvidia1 --device /dev/nvidia-uvm --device /dev/nvidia-uvm-tools --device /dev/nvidiactl'
validate: true

- config: [cuda120_gcc11_py310]
build_runner: [self-hosted,jetstream2,CPU]
test_runner: [self-hosted,GPU]
test_docker_options: '--gpus=all --device /dev/nvidia0 --device /dev/nvidia1 --device /dev/nvidia-uvm --device /dev/nvidia-uvm-tools --device /dev/nvidiactl'
validate: true

- config: [gcc13_py312, nomd]
build_runner: [self-hosted,jetstream2,CPU]
test_runner: ubuntu-latest
validate: false

- config: [gcc13_py312, nohpmc]
build_runner: [self-hosted,jetstream2,CPU]
test_runner: ubuntu-latest
validate: false

- config: [gcc13_py312, nomd, nohpmc]
build_runner: [self-hosted,jetstream2,CPU]
test_runner: ubuntu-latest
validate: false

- config: [cuda120_gcc11_py310 mpi, llvm, debug]
build_runner: [self-hosted,jetstream2,CPU]
test_runner: [self-hosted,GPU]
test_docker_options: '--gpus=all --device /dev/nvidia0 --device /dev/nvidia1 --device /dev/nvidia-uvm --device /dev/nvidia-uvm-tools --device /dev/nvidiactl'
validate: false

- config: [gcc9_py39]
build_runner: [self-hosted,jetstream2,CPU]
test_runner: ubuntu-latest
validate: false

0 comments on commit ee0864f

Please sign in to comment.