Skip to content

Commit

Permalink
hook up rest of unit-type tests to composite workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
aperijake committed Jul 30, 2024
1 parent 9595e0a commit f9c6f8a
Show file tree
Hide file tree
Showing 3 changed files with 220 additions and 39 deletions.
63 changes: 63 additions & 0 deletions .github/actions/run-material-tests/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: Run material tests
description: Run material tests on the VM, inside the Docker container
inputs:
VM_IP:
description: IP address of the VM
required: true
SSH_PRIVATE_KEY:
description: SSH private key for the VM
required: true
VM_USERNAME:
description: Username for the VM
required: true
build-type:
description: Build type (e.g., Release, Debug)
required: true
gpu:
description: GPU build
required: true
runs:
using: composite
steps:
- name: Print inputs for debugging
shell: bash
run: |
echo "build-type: ${{ inputs.build-type }}"
echo "gpu: ${{ inputs.gpu }}"
- name: Run material tests
shell: bash
run: |
ssh -T -o ConnectTimeout=10 ${{ inputs.VM_USERNAME }}@${{ inputs.VM_IP }} << 'EOF'
cd ~/aperi-mech
compose_file=docker-compose.yml
service_name=aperi-mech-development
if [ ${{ inputs.gpu }} == 'true' ]; then
compose_file=docker-compose_nvidia_t4_gpu.yml
service_name=aperi-mech-gpu-development
fi
# Debugging
echo "On VM, Compose file: $compose_file"
echo "On VM, Service name: $service_name"
docker-compose -f $compose_file run --rm $service_name /bin/bash -c '
build_path=~/aperi-mech/build/${{ inputs.build-type }}
if [ ${{ inputs.gpu }} == "true" ]; then
build_path=~/aperi-mech/build/${{ inputs.build-type }}_gpu
fi
# Debugging
echo "In container, inputs.build-type: ${{ inputs.build-type }}"
echo "In container, inputs.gpu: ${{ inputs.gpu }}"
echo "In container, build_path: $build_path"
cd $build_path
echo "Setting up Spack environment..."
. ~/spack/share/spack/setup-env.sh
spack env activate aperi-mech
echo "Running unit tests..."
make run_material_tests
' || { echo "Material test step failed"; exit 1; }
EOF
63 changes: 63 additions & 0 deletions .github/actions/run-utils-modules-tests/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: Run utils modules tests
description: Run utils modules tests on the VM, inside the Docker container
inputs:
VM_IP:
description: IP address of the VM
required: true
SSH_PRIVATE_KEY:
description: SSH private key for the VM
required: true
VM_USERNAME:
description: Username for the VM
required: true
build-type:
description: Build type (e.g., Release, Debug)
required: true
gpu:
description: GPU build
required: true
runs:
using: composite
steps:
- name: Print inputs for debugging
shell: bash
run: |
echo "build-type: ${{ inputs.build-type }}"
echo "gpu: ${{ inputs.gpu }}"
- name: Run utils modules tests
shell: bash
run: |
ssh -T -o ConnectTimeout=10 ${{ inputs.VM_USERNAME }}@${{ inputs.VM_IP }} << 'EOF'
cd ~/aperi-mech
compose_file=docker-compose.yml
service_name=aperi-mech-development
if [ ${{ inputs.gpu }} == 'true' ]; then
compose_file=docker-compose_nvidia_t4_gpu.yml
service_name=aperi-mech-gpu-development
fi
# Debugging
echo "On VM, Compose file: $compose_file"
echo "On VM, Service name: $service_name"
docker-compose -f $compose_file run --rm $service_name /bin/bash -c '
build_path=~/aperi-mech/build/${{ inputs.build-type }}
if [ ${{ inputs.gpu }} == "true" ]; then
build_path=~/aperi-mech/build/${{ inputs.build-type }}_gpu
fi
# Debugging
echo "In container, inputs.build-type: ${{ inputs.build-type }}"
echo "In container, inputs.gpu: ${{ inputs.gpu }}"
echo "In container, build_path: $build_path"
cd $build_path
echo "Setting up Spack environment..."
. ~/spack/share/spack/setup-env.sh
spack env activate aperi-mech
echo "Running utils modules tests..."
make run_utils_modules_tests
' || { echo "Utils modules test step failed"; exit 1; }
EOF
133 changes: 94 additions & 39 deletions .github/workflows/ci-cd-pipeline.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,9 @@ jobs:
concurrency:
group: build-and-test-vm-ci-cd
cancel-in-progress: false
env:
BUILD_TYPE: Release
GPU: false
steps:
- name: Checkout Code on Runner # Just to get required actions in .github/. The actual code checkout is done on the VM
uses: actions/checkout@v4
Expand All @@ -187,50 +190,40 @@ jobs:
- name: Run unit tests
uses: ./.github/actions/run-unit-tests
with:
build-type: Release
build-type: ${{ env.BUILD_TYPE }}
VM_IP: ${{ secrets.VM_IP }}
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
VM_USERNAME: ${{ secrets.VM_USERNAME }}
gpu: false
gpu: ${{ env.GPU }}
num-processes: 1

- name: Run unit tests, parallel
uses: ./.github/actions/run-unit-tests
with:
build-type: Release
build-type: ${{ env.BUILD_TYPE }}
VM_IP: ${{ secrets.VM_IP }}
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
VM_USERNAME: ${{ secrets.VM_USERNAME }}
gpu: false
gpu: ${{ env.GPU }}
num-processes: 3

- name: Run material tests
run: |
ssh -T -o ConnectTimeout=10 ${{ secrets.VM_USERNAME }}@${{ secrets.VM_IP }} << 'EOF'
cd ~/aperi-mech
docker-compose -f docker-compose.yml run --rm aperi-mech-development /bin/bash -c '
cd ~/aperi-mech/build/Release
make run_material_tests
' || { echo "Material tests step failed"; exit 1; }
EOF
uses: ./.github/actions/run-material-tests
with:
build-type: ${{ env.BUILD_TYPE }}
VM_IP: ${{ secrets.VM_IP }}
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
VM_USERNAME: ${{ secrets.VM_USERNAME }}
gpu: ${{ env.GPU }}

- name: Run utils modules tests
run: |
ssh -T -o ConnectTimeout=10 ${{ secrets.VM_USERNAME }}@${{ secrets.VM_IP }} << 'EOF'
cd ~/aperi-mech
docker-compose -f docker-compose.yml run --rm aperi-mech-development /bin/bash -c '
# Activate Spack environment
. ~/spack/share/spack/setup-env.sh
spack env activate aperi-mech
# Add aperi-mech build directory to PATH
export PATH=$PATH:~/aperi-mech/build/Release
# Run utils modules tests
cd ~/aperi-mech/build/Release
make run_utils_modules_tests
' || { echo "Utils modules tests step failed"; exit 1; }
EOF
uses: ./.github/actions/run-utils-modules-tests
with:
build-type: ${{ env.BUILD_TYPE }}
VM_IP: ${{ secrets.VM_IP }}
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
VM_USERNAME: ${{ secrets.VM_USERNAME }}
gpu: ${{ env.GPU }}

test-debug:
name: Test Debug
Expand All @@ -239,8 +232,11 @@ jobs:
concurrency:
group: build-and-test-vm-ci-cd
cancel-in-progress: false
env:
BUILD_TYPE: Debug
GPU: false
steps:
- name: Checkout code # Just to get required actions in .github/
- name: Checkout Code on Runner # Just to get required actions in .github/. The actual code checkout is done on the VM
uses: actions/checkout@v4

- name: Common SSH and Azure CLI Setup
Expand All @@ -252,23 +248,40 @@ jobs:
- name: Run unit tests
uses: ./.github/actions/run-unit-tests
with:
build-type: Debug
build-type: ${{ env.BUILD_TYPE }}
VM_IP: ${{ secrets.VM_IP }}
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
VM_USERNAME: ${{ secrets.VM_USERNAME }}
gpu: false
gpu: ${{ env.GPU }}
num-processes: 1

- name: Run unit tests, parallel
uses: ./.github/actions/run-unit-tests
with:
build-type: Debug
build-type: ${{ env.BUILD_TYPE }}
VM_IP: ${{ secrets.VM_IP }}
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
VM_USERNAME: ${{ secrets.VM_USERNAME }}
gpu: false
gpu: ${{ env.GPU }}
num-processes: 3

- name: Run material tests
uses: ./.github/actions/run-material-tests
with:
build-type: ${{ env.BUILD_TYPE }}
VM_IP: ${{ secrets.VM_IP }}
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
VM_USERNAME: ${{ secrets.VM_USERNAME }}
gpu: ${{ env.GPU }}

- name: Run utils modules tests
uses: ./.github/actions/run-utils-modules-tests
with:
build-type: ${{ env.BUILD_TYPE }}
VM_IP: ${{ secrets.VM_IP }}
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
VM_USERNAME: ${{ secrets.VM_USERNAME }}
gpu: ${{ env.GPU }}

test-release-gpu:
name: Test Release, GPU
Expand All @@ -277,8 +290,11 @@ jobs:
concurrency:
group: build-and-test-vm-ci-cd
cancel-in-progress: false
env:
BUILD_TYPE: Release
GPU: true
steps:
- name: Checkout code # Just to get required actions in .github/
- name: Checkout Code on Runner # Just to get required actions in .github/. The actual code checkout is done on the VM
uses: actions/checkout@v4

- name: Common SSH and Azure CLI Setup
Expand All @@ -290,22 +306,43 @@ jobs:
- name: Run unit tests
uses: ./.github/actions/run-unit-tests
with:
build-type: Release
build-type: ${{ env.BUILD_TYPE }}
VM_IP: ${{ secrets.VM_IP }}
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
VM_USERNAME: ${{ secrets.VM_USERNAME }}
gpu: true
gpu: ${{ env.GPU }}
num-processes: 1

- name: Run material tests
uses: ./.github/actions/run-material-tests
with:
build-type: ${{ env.BUILD_TYPE }}
VM_IP: ${{ secrets.VM_IP }}
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
VM_USERNAME: ${{ secrets.VM_USERNAME }}
gpu: ${{ env.GPU }}

- name: Run utils modules tests
uses: ./.github/actions/run-utils-modules-tests
with:
build-type: ${{ env.BUILD_TYPE }}
VM_IP: ${{ secrets.VM_IP }}
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
VM_USERNAME: ${{ secrets.VM_USERNAME }}
gpu: ${{ env.GPU }}

test-debug-gpu:
name: Test Debug, GPU
runs-on: ubuntu-latest
needs: [setup, build-debug-gpu]
concurrency:
group: build-and-test-vm-ci-cd
cancel-in-progress: false
env:
BUILD_TYPE: Debug
GPU: true
steps:
- name: Checkout code # Just to get required actions in .github/
- name: Checkout Code on Runner # Just to get required actions in .github/. The actual code checkout is done on the VM
uses: actions/checkout@v4

- name: Common SSH and Azure CLI Setup
Expand All @@ -317,13 +354,31 @@ jobs:
- name: Run unit tests
uses: ./.github/actions/run-unit-tests
with:
build-type: Debug
build-type: ${{ env.BUILD_TYPE }}
VM_IP: ${{ secrets.VM_IP }}
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
VM_USERNAME: ${{ secrets.VM_USERNAME }}
gpu: true
gpu: ${{ env.GPU }}
num-processes: 1

- name: Run material tests
uses: ./.github/actions/run-material-tests
with:
build-type: ${{ env.BUILD_TYPE }}
VM_IP: ${{ secrets.VM_IP }}
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
VM_USERNAME: ${{ secrets.VM_USERNAME }}
gpu: ${{ env.GPU }}

- name: Run utils modules tests
uses: ./.github/actions/run-utils-modules-tests
with:
build-type: ${{ env.BUILD_TYPE }}
VM_IP: ${{ secrets.VM_IP }}
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
VM_USERNAME: ${{ secrets.VM_USERNAME }}
gpu: ${{ env.GPU }}

teardown:
runs-on: ubuntu-latest
name: Teardown
Expand Down

0 comments on commit f9c6f8a

Please sign in to comment.