Skip to content

Smoke Test

Smoke Test #1386

Workflow file for this run

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