mirror of
https://github.com/logos-storage/logos-storage-nim-cs-dist-tests.git
synced 2026-01-06 23:43:07 +00:00
Run tests in Kubernetes using GitHub Actions (#23)
* Add GitHub Actions workflow to run tests * Text formatted
This commit is contained in:
parent
bc4035e723
commit
9fe9f2ed36
73
.github/workflows/dist-tests.yaml
vendored
Normal file
73
.github/workflows/dist-tests.yaml
vendored
Normal file
@ -0,0 +1,73 @@
|
|||||||
|
name: Dist Tests
|
||||||
|
|
||||||
|
|
||||||
|
on:
|
||||||
|
# push:
|
||||||
|
# branches:
|
||||||
|
# - master
|
||||||
|
# tags:
|
||||||
|
# - 'v*.*.*'
|
||||||
|
# paths-ignore:
|
||||||
|
# - '**/*.md'
|
||||||
|
# - '.gitignore'
|
||||||
|
# - 'docker/**'
|
||||||
|
# - '!docker/job.yaml'
|
||||||
|
workflow_dispatch:
|
||||||
|
inputs:
|
||||||
|
branch:
|
||||||
|
description: Branch
|
||||||
|
required: false
|
||||||
|
type: string
|
||||||
|
source:
|
||||||
|
description: Repository with tests
|
||||||
|
required: false
|
||||||
|
type: string
|
||||||
|
nameprefix:
|
||||||
|
description: Runner job/pod name prefix
|
||||||
|
required: false
|
||||||
|
type: string
|
||||||
|
namespace:
|
||||||
|
description: Kubernetes namespace for runner
|
||||||
|
required: false
|
||||||
|
type: string
|
||||||
|
|
||||||
|
|
||||||
|
env:
|
||||||
|
BRANCH: ${{ github.ref_name }}
|
||||||
|
SOURCE: ${{ format('{0}/{1}', github.server_url, github.repository) }}
|
||||||
|
NAMEPREFIX: cs-codex-dist-tests
|
||||||
|
NAMESPACE: cs-codex-dist-tests
|
||||||
|
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: |
|
||||||
|
[[ -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"
|
||||||
|
|
||||||
|
- 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: |
|
||||||
|
export RUNID=$(date +%Y%m%d-%H%M%S)
|
||||||
|
envsubst < ${{ env.JOB_MANIFEST }} | kubectl apply -f -
|
||||||
@ -4,10 +4,10 @@
|
|||||||
Using a common dotnet unit-test framework and a few other libraries, this project allows you to write tests that use multiple Codex node instances in various configurations to test the distributed system in a controlled, reproducible environment.
|
Using a common dotnet unit-test framework and a few other libraries, this project allows you to write tests that use multiple Codex node instances in various configurations to test the distributed system in a controlled, reproducible environment.
|
||||||
|
|
||||||
|
|
||||||
Nim-Codex: https://github.com/codex-storage/nim-codex
|
Nim-Codex: https://github.com/codex-storage/nim-codex
|
||||||
Dotnet: v6.0
|
Dotnet: v6.0
|
||||||
Kubernetes: v1.25.4
|
Kubernetes: v1.25.4
|
||||||
Dotnet-kubernetes SDK: v10.1.4 https://github.com/kubernetes-client/csharp
|
Dotnet-kubernetes SDK: v10.1.4 https://github.com/kubernetes-client/csharp
|
||||||
Nethereum: v4.14.0
|
Nethereum: v4.14.0
|
||||||
|
|
||||||
## Tests
|
## Tests
|
||||||
|
|||||||
48
docker/job.yaml
Normal file
48
docker/job.yaml
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
apiVersion: batch/v1
|
||||||
|
kind: Job
|
||||||
|
metadata:
|
||||||
|
name: ${NAMEPREFIX}-${RUNID}
|
||||||
|
namespace: ${NAMESPACE}
|
||||||
|
labels:
|
||||||
|
name: ${NAMEPREFIX}-${RUNID}
|
||||||
|
run-id: ${RUNID}
|
||||||
|
spec:
|
||||||
|
backoffLimit: 0
|
||||||
|
template:
|
||||||
|
metadata:
|
||||||
|
name: ${NAMEPREFIX}
|
||||||
|
spec:
|
||||||
|
containers:
|
||||||
|
- name: ${NAMEPREFIX}-runner
|
||||||
|
image: codexstorage/cs-codex-dist-tests:sha-300b91e
|
||||||
|
env:
|
||||||
|
- name: RUNNERLOCATION
|
||||||
|
value: InternalToCluster
|
||||||
|
- name: KUBECONFIG
|
||||||
|
value: /opt/kubeconfig.yaml
|
||||||
|
- name: LOGPATH
|
||||||
|
value: /var/log/cs-codex-dist-tests
|
||||||
|
- name: NAMESPACE
|
||||||
|
value: ${NAMESPACE}
|
||||||
|
- name: BRANCH
|
||||||
|
value: ${BRANCH}
|
||||||
|
- name: SOURCE
|
||||||
|
value: ${SOURCE}
|
||||||
|
volumeMounts:
|
||||||
|
- name: kubeconfig
|
||||||
|
mountPath: /opt/kubeconfig.yaml
|
||||||
|
subPath: kubeconfig.yaml
|
||||||
|
- name: logs
|
||||||
|
mountPath: /var/log/cs-codex-dist-tests
|
||||||
|
# command:
|
||||||
|
# - "dotnet"
|
||||||
|
# - "test"
|
||||||
|
# - "Tests"
|
||||||
|
restartPolicy: Never
|
||||||
|
volumes:
|
||||||
|
- name: kubeconfig
|
||||||
|
secret:
|
||||||
|
secretName: cs-codex-dist-tests-app-kubeconfig
|
||||||
|
- name: logs
|
||||||
|
hostPath:
|
||||||
|
path: /var/log/cs-codex-dist-tests
|
||||||
Loading…
x
Reference in New Issue
Block a user