-
Notifications
You must be signed in to change notification settings - Fork 17
87 lines (83 loc) · 3.36 KB
/
test_gpu_turnkey.yml
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
# 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: Test TurnkeyML on Azure GPUs
on:
# Allows users to manually trigger the workflow using the GitHub UI
workflow_dispatch:
permissions:
contents: read
jobs:
start_vm:
timeout-minutes: 10
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install az cli
run: |
sudo apt-get update
sudo apt-get install -y azure-cli
- name: Turn on Azure VM
run: |
az login --username ${{ secrets.AZURE_CLIENT_ID }} --password ${{ secrets.AZURE_CLIENT_PWD }}
az vm wait --name morecuda --resource-group morecuda_group --custom "instanceView.statuses[?code=='PowerState/deallocated']" --interval 30
az vm start --name morecuda --resource-group morecuda_group
az vm wait --created --name morecuda --resource-group morecuda_group
az vm run-command invoke --name morecuda --resource-group morecuda_group --command-id RunShellScript --scripts 'export RUNNER_ALLOW_RUNASROOT="1" && export HOME="/home/azureuser" && bash /home/azureuser/actions-runner/run.sh &'
build_and_test:
needs: start_vm
timeout-minutes: 10
if: ${{ needs.start_vm.result == 'success' }}
runs-on: self-hosted
env:
TURNKEY_VERBOSITY: static
TURNKEY_TRACEBACK: True
strategy:
matrix:
python-version: ["3.8"]
steps:
- uses: actions/checkout@v3
- uses: conda-incubator/setup-miniconda@v3
with:
miniconda-version: "latest"
activate-environment: tkml
python-version: ${{ matrix.python-version }}
- name: Install Docker
shell: bash -el {0}
run: |
sudo mkdir -p /etc/apt/keyrings
sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor --yes -o /etc/apt/keyrings/docker.gpg
sudo chmod a+r /etc/apt/keyrings/docker.gpg
echo \
"deb [arch="$(dpkg --print-architecture)" signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \
"$(. /etc/os-release && echo "$VERSION_CODENAME")" stable" | \
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt-get update
sudo apt-get install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
sudo chmod 666 /var/run/docker.sock
- name: Install dependencies
shell: bash -el {0}
run: |
python -m pip install --upgrade pip
conda install pylint
pip install -e .
pip install transformers
python -m pip check
- name: Test with unittest
shell: bash -el {0}
run: |
# E2E tests
python test/gpu.py
deallocate_vm:
needs: build_and_test
if: always()
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install az cli
run: |
sudo apt-get update
sudo apt-get install -y azure-cli
- name: Deallocate Azure VM
run: |
az login --username ${{ secrets.AZURE_CLIENT_ID }} --password ${{ secrets.AZURE_CLIENT_PWD }}
az vm deallocate --name morecuda --resource-group morecuda_group