2023-06-04 17:28:17 +00:00
|
|
|
name: Dist Tests
|
|
|
|
|
|
|
|
|
|
|
|
on:
|
|
|
|
# push:
|
|
|
|
# branches:
|
|
|
|
# - master
|
|
|
|
# tags:
|
|
|
|
# - 'v*.*.*'
|
|
|
|
# paths-ignore:
|
|
|
|
# - '**/*.md'
|
|
|
|
# - '.gitignore'
|
|
|
|
# - 'docker/**'
|
|
|
|
# - '!docker/job.yaml'
|
|
|
|
workflow_dispatch:
|
|
|
|
inputs:
|
|
|
|
branch:
|
2023-07-21 07:03:10 +00:00
|
|
|
description: Branch (master)
|
2023-06-04 17:28:17 +00:00
|
|
|
required: false
|
|
|
|
type: string
|
|
|
|
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
|
|
|
|
nameprefix:
|
2023-09-19 14:53:15 +00:00
|
|
|
description: Runner prefix (codex-dist-tests)
|
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:
|
|
|
|
description: Runner command (dotnet test Tests)
|
2023-06-04 17:28:17 +00:00
|
|
|
required: false
|
|
|
|
type: string
|
|
|
|
|
|
|
|
|
|
|
|
env:
|
|
|
|
BRANCH: ${{ github.ref_name }}
|
|
|
|
SOURCE: ${{ format('{0}/{1}', github.server_url, github.repository) }}
|
2023-09-19 14:53:15 +00:00
|
|
|
NAMEPREFIX: codex-dist-tests
|
|
|
|
NAMESPACE: default
|
2023-09-21 12:42:45 +00:00
|
|
|
COMMAND: dotnet test Tests/CodexTests
|
2023-06-04 17:28:17 +00:00
|
|
|
JOB_MANIFEST: docker/job.yaml
|
|
|
|
KUBE_CONFIG: ${{ secrets.KUBE_CONFIG }}
|
|
|
|
KUBE_VERSION: v1.26.1
|
|
|
|
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
run_tests:
|
|
|
|
name: Run Tests
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- name: Checkout
|
|
|
|
uses: actions/checkout@v3
|
|
|
|
|
|
|
|
- name: Variables
|
|
|
|
run: |
|
2023-09-06 16:29:37 +00:00
|
|
|
[[ -n "${{ github.event.inputs.branch }}" ]] && echo "BRANCH=${{ github.event.inputs.branch }}" >>"$GITHUB_ENV" || echo "BRANCH=${{ env.BRANCH }}" >>"$GITHUB_ENV"
|
|
|
|
[[ -n "${{ github.event.inputs.source }}" ]] && echo "SOURCE=${{ github.event.inputs.source }}" >>"$GITHUB_ENV" || echo "SOURCE=${{ env.SOURCE }}" >>"$GITHUB_ENV"
|
|
|
|
[[ -n "${{ github.event.inputs.nameprefix }}" ]] && echo "NAMEPREFIX=${{ github.event.inputs.nameprefix }}" >>"$GITHUB_ENV" || echo "NAMEPREFIX=${{ env.NAMEPREFIX }}" >>"$GITHUB_ENV"
|
|
|
|
[[ -n "${{ github.event.inputs.namespace }}" ]] && echo "NAMESPACE=${{ github.event.inputs.namespace }}" >>"$GITHUB_ENV" || echo "NAMESPACE=${{ env.NAMESPACE }}" >>"$GITHUB_ENV"
|
2023-09-19 14:53:15 +00:00
|
|
|
[[ -n "${{ github.event.inputs.command }}" ]] && COMMAND="${{ github.event.inputs.command }}" || COMMAND="${{ env.COMMAND }}"
|
|
|
|
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-06-04 17:28:17 +00:00
|
|
|
|
|
|
|
- name: Kubectl - Install ${{ env.KUBE_VERSION }}
|
|
|
|
uses: azure/setup-kubectl@v3
|
|
|
|
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 -
|