forked from FlagOpen/FlagGems
-
Notifications
You must be signed in to change notification settings - Fork 0
36 lines (31 loc) · 1.33 KB
/
op-unit-test.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# This workflow will install Python dependencies, run tests and lint with a single version of Python
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python
name: op-unit-test
on:
workflow_call:
jobs:
container-unit-test:
runs-on: [self-hosted, docker]
container:
image: localhost:5000/flag-gems-ci:v1.0
ports:
- 81
options: --gpus all --hostname flag-gems_cicd_ut -v /home/flaggems_cicd/PR_Coverage:/PR_Coverage
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Check GPU free
shell: bash
run: tools/gpu_check.sh
- name: FlagGems unit test
shell: bash
run: |
git config --global --add safe.directory /__w/FlagGems/FlagGems
if [ "${{ github.event_name }}" == "pull_request" ]; then
echo "This is a pull request event. PR number is ${{ github.event.pull_request.number }}"
bash tools/op-unit-test.sh ${{ github.event.pull_request.number }}
elif [ "${{ github.event_name }}" == "push" ]; then
PR_NUMBER=$(git log -1 --pretty=format:'%s' | grep -oE '#[0-9]+' | grep -oE '[0-9]+')
echo "This is a push event. The relate PR number is ${PR_NUMBER}"
bash tools/op-unit-test.sh ${PR_NUMBER}
fi