-
Notifications
You must be signed in to change notification settings - Fork 28
131 lines (131 loc) · 4.31 KB
/
smoke.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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
name: Smoke Test
permissions:
id-token: write
on:
pull_request_target:
paths: 'task/**'
schedule:
- cron: '0 1 * * *' # Everyday @ 0100 UTC
workflow_dispatch:
inputs:
test_target:
description: Type of instances to be provisioned during test.
required: true
default: 'gpu+spot'
type: choice
options:
- quick
- quick+spot
- gpu
- gpu+spot
concurrency:
group: ${{ github.workflow }}-${{ github.ref_name }}
cancel-in-progress: true
env:
SMOKE_TEST_TARGET: ${{ github.event_name == 'pull_request_target' && 'quick' || inputs.test_target || 'gpu+spot' }}
SMOKE_TEST_IDENTIFIER: smoke-test-${{ github.run_id }}
jobs:
authorize:
environment: ${{ (github.event_name == 'pull_request_target' &&
github.event.pull_request.head.repo.full_name != github.repository) &&
'manual' || 'automatic' }}
runs-on: ubuntu-latest
steps:
- run: echo ✓
test:
needs: authorize
environment: automatic
runs-on: ubuntu-latest
timeout-minutes: 60
strategy:
fail-fast: false
matrix:
provider: [AWS, AZ, GCP]
concurrency: ${{ github.workflow }}-${{ matrix.provider }}
env:
AZURE_CLIENT_ID: ${{ vars.AZURE_CLIENT_ID }}
AZURE_CLIENT_SECRET: ${{ secrets.AZURE_CLIENT_SECRET }}
AZURE_TENANT_ID: ${{ vars.AZURE_TENANT_ID }}
AZURE_SUBSCRIPTION_ID: ${{ vars.AZURE_SUBSCRIPTION_ID }}
GOOGLE_APPLICATION_CREDENTIALS_DATA: ${{ secrets.GOOGLE_APPLICATION_CREDENTIALS_DATA }}
SMOKE_TEST_ENABLE_${{ matrix.provider }}: true
steps:
- uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.sha || github.ref }}
- uses: actions/setup-go@v3
with:
go-version-file: go.mod
- if: matrix.provider == 'AWS'
uses: aws-actions/configure-aws-credentials@v1
with:
aws-region: us-west-1
role-to-assume: arn:aws:iam::342840881361:role/SandboxUser
- run: go test ./task -v -timeout=30m -count=1 -tags=smoke
- if: always()
uses: actions/checkout@v3
with:
ref: main
- if: always()
run: go test ./task -v -timeout=30m -count=1 -tags=smoke
env:
SMOKE_TEST_SWEEP: true
test-k8s:
name: test (K8S)
needs: authorize
environment: automatic
runs-on: ubuntu-latest
timeout-minutes: 60
concurrency: ${{ github.workflow }}-K8S
steps:
- uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.sha || github.ref }}
- uses: actions/setup-go@v3
with:
go-version-file: go.mod
- uses: azure/login@v1
with:
client-id: ${{ secrets.AZURE_CLIENT_ID }}
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
- if: contains(env.SMOKE_TEST_TARGET, 'gpu')
run: |
az extension add \
--name=aks-preview
az provider register \
--namespace=Microsoft.ContainerService
az feature register \
--namespace=Microsoft.ContainerService \
--name=GPUDedicatedVHDPreview
- run: |
az group create \
--name="tpiSmokeTestCluster$GITHUB_RUN_ID" \
--location=westus2
az aks create \
--resource-group="tpiSmokeTestCluster$GITHUB_RUN_ID" \
--name="tpiSmokeTestCluster$GITHUB_RUN_ID" \
--node-vm-size=${{ contains(env.SMOKE_TEST_TARGET, 'gpu') && 'Standard_NC4as_T4_v3' || 'Standard_A2_v2' }} \
--node-count=1 \
--aks-custom-headers=${{ contains(env.SMOKE_TEST_TARGET, 'gpu') && 'UseGPUDedicatedVHD=true' || '' }} \
--generate-ssh-keys
- id: credentials
run: |
az aks get-credentials \
--resource-group="tpiSmokeTestCluster$GITHUB_RUN_ID" \
--name="tpiSmokeTestCluster$GITHUB_RUN_ID" \
--file - |
perl -0777p \
-e 's/%/%25/g;' \
-e 's/\n/%0A/g;' \
-e 's/\r/%0D/g;' \
-e 's/(.+)/::add-mask::\1\n::set-output name=kubeconfig::\1\n/g'
- run: go test ./task -v -timeout=60m -count=1 -tags=smoke
env:
KUBECONFIG_DATA: ${{ steps.credentials.outputs.kubeconfig }}
SMOKE_TEST_ENABLE_K8S: true
- if: always()
run: |
az group delete \
--name="tpiSmokeTestCluster$GITHUB_RUN_ID" \
--yes