Skip to content

Commit

Permalink
adds smoke test workflow
Browse files Browse the repository at this point in the history
users can dispatch a workflow that runs smoke tests against a selected
branch

Signed-off-by: James Kunstle <[email protected]>
  • Loading branch information
JamesKunstle committed Jan 25, 2025
1 parent 77ae91e commit 36c446a
Showing 1 changed file with 96 additions and 0 deletions.
96 changes: 96 additions & 0 deletions .github/workflows/smoke-tests.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
# SPDX-License-Identifier: Apache-2.0

name: "Run smoke tests via Tox::pytest"
# These tests will be long running and require accelerated hardware.
# They will help to verify that the library is *functionally* correct but
# will not try to verify that the libary is *correct*.

on:
# TEMP - only runs when manually invoked
# and only runs against branches in the repo.
workflow_dispatch:
inputs:
branch:
type: string
default: main

permissions:
contents: read

defaults:
run:
shell: bash

jobs:
start-ec2-runner:
uses: ./.github/workflows/reusable-start-ec2-runner.yaml
with:
aws_region: ${{vars.AWS_REGION}}
aws_ami: ${{vars.AWS_EC2_AMI}}
aws_ec2_runner_variant: ${{vars.SMOKETEST_EC2_INSTANCE_TYPE}} # requires accelerators
secrets: inherit

run-smoke-tests:
needs:
- start-ec2-runner
runs-on: ${{needs.start-ec2-runner.outputs.runner_label}}
# It is important that this job has no write permissions and has
# no access to any secrets. This part is where we are running
# untrusted code from PRs.
permissions: {}
steps:
- name: "Harden runner"
uses: step-security/harden-runner@cb605e52c26070c328afc4562f0b4ada7618a84e # v2.10.1
with:
egress-policy: audit

- name: "Install packages"
run: |
cat /etc/os-release
sudo dnf install -y gcc gcc-c++ make git python3.11 python3.11-devel
- name: "Verify cuda environment is setup"
run: |
export CUDA_HOME="/usr/local/cuda"
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/local/cuda/lib64:/usr/local/cuda/extras/CUPTI/lib64"
export PATH="$PATH:$CUDA_HOME/bin"
nvidia-smi
- name: "Checkout code"
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 0
ref: ${{inputs.branch}}

# installs in $GITHUB_WORKSPACE/venv.
# only has to install Tox because Tox will do the other virtual environment management.
- name: "Setup Python virtual environment"
run: |
python3.11 -m venv --upgrade-deps venv
. venv/bin/activate
pip install tox
- name: "Show disk utilization BEFORE tests"
run: |
df -h
- name: "Run unit tests with Tox and Pytest"
run: |
source venv/bin/activate
tox -e py3-smoke
- name: "Show disk utilization AFTER tests"
run: |
df -h
stop-ec2-runner:
needs:
- start-ec2-runner
- run-smoke-tests
if: ${{ always() }}
uses: ./.github/workflows/reusable-stop-ec2-runner.yaml
with:
aws_region: ${{vars.AWS_REGION}}
aws_ec2_runner_label: ${{needs.start-ec2-runner.outputs.runner_label}}
aws_ec2_runner_instance_id: ${{needs.start-ec2-runner.outputs.runner_instance_id}}
secrets: inherit

0 comments on commit 36c446a

Please sign in to comment.