2023-11-06 13:09:51 +00:00
|
|
|
name: Run Dist Tests
|
2023-06-04 17:28:17 +00:00
|
|
|
|
|
|
|
|
|
|
|
on:
|
|
|
|
workflow_dispatch:
|
|
|
|
inputs:
|
|
|
|
source:
|
2023-07-21 07:03:10 +00:00
|
|
|
description: Repository with tests (current)
|
2023-06-04 17:28:17 +00:00
|
|
|
required: false
|
|
|
|
type: string
|
2023-11-12 15:07:53 +00:00
|
|
|
branch:
|
|
|
|
description: Branch with tests (master)
|
|
|
|
required: false
|
|
|
|
type: string
|
2023-06-04 17:28:17 +00:00
|
|
|
nameprefix:
|
2023-11-12 15:07:53 +00:00
|
|
|
description: Runner name prefix (d-tests-runner)
|
2023-06-04 17:28:17 +00:00
|
|
|
required: false
|
|
|
|
type: string
|
|
|
|
namespace:
|
2023-09-19 14:53:15 +00:00
|
|
|
description: Runner namespace (default)
|
|
|
|
required: false
|
|
|
|
type: string
|
|
|
|
command:
|
2023-11-12 15:07:53 +00:00
|
|
|
description: Command (dotnet test Tests/CodexTests)
|
2023-06-04 17:28:17 +00:00
|
|
|
required: false
|
|
|
|
type: string
|
|
|
|
|
|
|
|
|
|
|
|
env:
|
|
|
|
SOURCE: ${{ format('{0}/{1}', github.server_url, github.repository) }}
|
2023-11-19 19:13:40 +00:00
|
|
|
BRANCH: ${{ github.ref_name }}
|
2023-11-12 15:07:53 +00:00
|
|
|
NAMEPREFIX: d-tests-runner
|
2023-09-19 14:53:15 +00:00
|
|
|
NAMESPACE: default
|
2023-09-21 12:42:45 +00:00
|
|
|
COMMAND: dotnet test Tests/CodexTests
|
2023-11-06 13:09:51 +00:00
|
|
|
JOB_MANIFEST: docker/dist-tests-job.yaml
|
2023-06-04 17:28:17 +00:00
|
|
|
KUBE_CONFIG: ${{ secrets.KUBE_CONFIG }}
|
2023-11-06 13:09:51 +00:00
|
|
|
KUBE_VERSION: v1.28.2
|
2023-06-04 17:28:17 +00:00
|
|
|
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
run_tests:
|
|
|
|
name: Run Tests
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- name: Checkout
|
2024-02-19 11:05:51 +00:00
|
|
|
uses: actions/checkout@v4
|
2023-06-04 17:28:17 +00:00
|
|
|
|
|
|
|
- name: Variables
|
|
|
|
run: |
|
2023-09-19 14:53:15 +00:00
|
|
|
echo "COMMAND=$(jq -c 'split(" ")' <<< '"'$COMMAND'"')" >>"$GITHUB_ENV"
|
2023-07-21 07:03:10 +00:00
|
|
|
echo "RUNID=$(date +%Y%m%d-%H%M%S)" >> $GITHUB_ENV
|
|
|
|
echo "TESTID=$(git rev-parse --short HEAD)" >> $GITHUB_ENV
|
2023-11-19 19:13:40 +00:00
|
|
|
[[ -n "${{ inputs.branch }}" ]] && echo "BRANCH=${{ inputs.branch }}" >>"$GITHUB_ENV" || echo "BRANCH=${{ env.BRANCH }}" >>"$GITHUB_ENV"
|
|
|
|
[[ -n "${{ inputs.source }}" ]] && echo "SOURCE=${{ inputs.source }}" >>"$GITHUB_ENV" || echo "SOURCE=${{ env.SOURCE }}" >>"$GITHUB_ENV"
|
|
|
|
[[ -n "${{ inputs.nameprefix }}" ]] && echo "NAMEPREFIX=${{ inputs.nameprefix }}" >>"$GITHUB_ENV" || echo "NAMEPREFIX=${{ env.NAMEPREFIX }}" >>"$GITHUB_ENV"
|
|
|
|
[[ -n "${{ inputs.namespace }}" ]] && echo "NAMESPACE=${{ inputs.namespace }}" >>"$GITHUB_ENV" || echo "NAMESPACE=${{ env.NAMESPACE }}" >>"$GITHUB_ENV"
|
|
|
|
[[ -n "${{ inputs.command }}" ]] && COMMAND="${{ inputs.command }}" || COMMAND="${{ env.COMMAND }}"
|
2023-06-04 17:28:17 +00:00
|
|
|
|
|
|
|
- name: Kubectl - Install ${{ env.KUBE_VERSION }}
|
2024-03-12 14:32:31 +00:00
|
|
|
uses: azure/setup-kubectl@v4
|
2023-06-04 17:28:17 +00:00
|
|
|
with:
|
|
|
|
version: ${{ env.KUBE_VERSION }}
|
|
|
|
|
|
|
|
- name: Kubectl - Kubeconfig
|
|
|
|
run: |
|
|
|
|
mkdir -p "${HOME}"/.kube
|
|
|
|
echo "${{ env.KUBE_CONFIG }}" | base64 -d > "${HOME}"/.kube/config
|
|
|
|
|
|
|
|
- name: Kubectl - Create Job
|
|
|
|
run: |
|
|
|
|
envsubst < ${{ env.JOB_MANIFEST }} | kubectl apply -f -
|
2023-11-12 15:07:53 +00:00
|
|
|
|
|
|
|
- name: Tests Identification
|
|
|
|
run: |
|
|
|
|
echo "----"
|
|
|
|
echo "Repository: ${{ env.SOURCE }}"
|
|
|
|
echo "Branch: ${{ env.BRANCH }}"
|
2023-11-19 19:13:40 +00:00
|
|
|
echo "Runner job: ${{ env.NAMEPREFIX }}-${{ env.RUNID }}"
|
2023-11-12 15:07:53 +00:00
|
|
|
echo "Runner namespace: ${{ env.NAMESPACE }}"
|
|
|
|
echo "----"
|
2023-11-12 16:35:11 +00:00
|
|
|
echo "Tests runid: ${{ env.RUNID }}"
|
|
|
|
echo "Tests command: `jq -r '. | join(" ")' <<< '${{ env.COMMAND }}'`"
|
2023-11-12 15:07:53 +00:00
|
|
|
echo "----"
|