11# SPDX-License-Identifier: Apache-2.0
22
3- name : " Run 'fast' marked unit tests via Tox::pytest"
3+ name : " Run unit tests via Tox::pytest"
44# This tests should run only those tests that are marked as 'fast.'
55# The opposite are those that would require the mark 'slow,' which would
66# include longer-running integration and smoke tests.
2626 runs-on : ubuntu-latest
2727 outputs :
2828 label : ${{ steps.start-ec2-runner.outputs.label }}
29- ec2-instance-id : ${{ steps.start-ec2-runner.outputs.label }}
29+ ec2-instance-id : ${{ steps.start-ec2-runner.outputs.ec2-instance-id }}
3030
3131 steps :
3232 - name : " Harden runner"
@@ -48,13 +48,13 @@ jobs:
4848 mode : start
4949 github-token : ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }}
5050 ec2-image-id : ${{ vars.AWS_EC2_AMI }}
51- ec2-instance-type : ${{ vars.AWS_REGION }}
51+ ec2-instance-type : ${{ env.ec2_runner_variant }}
5252 subnet-id : subnet-024298cefa3bedd61
5353 security-group-id : sg-06300447c4a5fbef3
5454 iam-role-name : instructlab-ci-runner
5555 aws-resource-tags : >
5656 [
57- {"Key": "Name", "Value": "instructlab-ci-github-large -runner"},
57+ {"Key": "Name", "Value": "instructlab-ci-github-unittest -runner"},
5858 {"Key": "GitHubRepository", "Value": "${{ github.repository }}"},
5959 {"Key": "GitHubRef", "Value": "${{ github.ref }}"},
6060 {"Key": "GitHubPR", "Value": "${{ github.event.number }}"}
8383 with :
8484 fetch-depth : 0
8585
86- - name : " Verify environment variables are setup correctly"
87- run : |
88- export CUDA_HOME="/usr/local/cuda"
89- export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/local/cuda/lib64:/usr/local/cuda/extras/CUPTI/lib64"
90- export PATH="$PATH:$CUDA_HOME/bin"
91- nvidia-smi
92-
9386 # installs in $GITHUB_WORKSPACE/venv.
9487 # only has to install Tox because Tox will do the other virtual environment management.
9588 - name : " Setup Python virtual environment"
10497
10598 - name : " Run unit tests with Tox and Pytest"
10699 run : |
100+ source venv/bin/activate
107101 tox -e py3-unit -- -m ${{env.pytest_mark}}
108102
109103 - name : " Show disk utilization AFTER tests"
@@ -115,11 +109,13 @@ jobs:
115109 - start-ec2-runner
116110 - run-unit-tests
117111 runs-on : ubuntu-latest
112+ if : ${{ always() }}
118113 steps :
119114 - name : " Harden runner"
120115 uses : step-security/harden-runner@cb605e52c26070c328afc4562f0b4ada7618a84e # v2.10.1
121116 with :
122117 egress-policy : audit
118+
123119 - name : " Configure AWS credentials"
124120 uses : " aws-actions/configure-aws-credentials@e3dd6a429d7300a6a4c196c26e071d42e0343502" # v4.0.2
125121 with :
@@ -128,10 +124,9 @@ jobs:
128124 aws-region : ${{ vars.AWS_REGION }}
129125
130126 - name : " Stop EC2 runner"
131- id : start-ec2-runner
132127 uses : machulav/ec2-github-runner@1827d6ca7544d7044ddbd2e9360564651b463da2 # v2.3.7
133128 with :
134129 mode : stop
135130 github-token : ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }}
136131 label : ${{ needs.start-ec2-runner.outputs.label }}
137- ec2-instance-type : ${{ env.ec2_runner_variant }}
132+ ec2-instance-id : ${{ needs.start-ec2-runner.outputs.ec2-instance-id }}
0 commit comments