101 lines
3.3 KiB
YAML
101 lines
3.3 KiB
YAML
on:
|
|
workflow_call:
|
|
inputs:
|
|
test:
|
|
description: The test to run
|
|
type: string
|
|
required: true
|
|
duration:
|
|
description: How long to run the test for
|
|
type: string
|
|
required: false
|
|
default: '2h'
|
|
|
|
# cancel older, redundant runs of same workflow on same branch
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{github.event_name}}-${{ github.head_ref || github.ref_name }}-${{ inputs.test }}
|
|
cancel-in-progress: true
|
|
|
|
env:
|
|
GOFLAGS: "-trimpath"
|
|
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
|
|
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
|
|
AWS_DEFAULT_REGION: "us-east-2"
|
|
gh_ci_key: ${{ secrets.GH_CI_KEY }}
|
|
BUILD_NUMBER: ${{ format('{0}-{1}-{2}', github.run_id, github.run_number, github.run_attempt) }}
|
|
TEST_TYPE: ${{ inputs.test }}
|
|
TEST_DURATION: ${{ inputs.duration }}
|
|
|
|
jobs:
|
|
validation-test:
|
|
name: ${{ inputs.test }} validation
|
|
# not applicable to forks. shouldn't run on release build
|
|
if: github.repository_owner == 'openziti'
|
|
runs-on: ubuntu-24.04
|
|
steps:
|
|
- name: Git Checkout
|
|
uses: actions/checkout@v6
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: Install Go
|
|
uses: ./.github/actions/setup-go
|
|
|
|
- name: Install Ziti CI
|
|
uses: openziti/ziti-ci@v1
|
|
|
|
- name: Install Terraform CLI
|
|
uses: hashicorp/setup-terraform@v4
|
|
with:
|
|
terraform_version: ~1.5
|
|
|
|
- name: Build and Test
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
ziti_ci_gpg_key: ${{ secrets.ZITI_CI_GPG_KEY }}
|
|
ziti_ci_gpg_key_id: ${{ secrets.ZITI_CI_GPG_KEY_ID }}
|
|
shell: bash
|
|
run: |
|
|
$(go env GOPATH)/bin/ziti-ci configure-git
|
|
$(go env GOPATH)/bin/ziti-ci generate-build-info common/version/info_generated.go version
|
|
pushd zititest && go mod tidy && go install -tags all ./... && popd
|
|
go install -tags=all,tests ./...
|
|
|
|
- name: Create Test Environment
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
shell: bash
|
|
run: |
|
|
echo "ZITI_ROOT=$(go env GOPATH)/bin" >> "$GITHUB_ENV"
|
|
$(go env GOPATH)/bin/${TEST_TYPE} create -d ${TEST_TYPE}-${GITHUB_RUN_NUMBER} -n ${TEST_TYPE}-${GITHUB_RUN_NUMBER} -l environment=gh-fablab-${TEST_TYPE},ziti_version=$($(go env GOPATH)/bin/ziti-ci -q get-current-version)
|
|
$(go env GOPATH)/bin/${TEST_TYPE} up
|
|
$(go env GOPATH)/bin/${TEST_TYPE} exec validateUp
|
|
|
|
- name: Run Validation Loop
|
|
shell: bash
|
|
timeout-minutes: 380
|
|
run: |
|
|
echo "ZITI_ROOT=$(go env GOPATH)/bin" >> "$GITHUB_ENV"
|
|
$(go env GOPATH)/bin/${TEST_TYPE} exec-loop ${TEST_DURATION} testIteration
|
|
|
|
- name: Create Logs Archive
|
|
if: always()
|
|
run: |
|
|
$(go env GOPATH)/bin/${TEST_TYPE} get files '*' "./logs/{{ .Id }}/" ./logs
|
|
|
|
- name: Upload artifacts
|
|
uses: actions/upload-artifact@v7
|
|
if: always()
|
|
with:
|
|
name: ${{ env.TEST_TYPE }}-logs-${{ github.run_id }}
|
|
path: logs/
|
|
compression-level: 7
|
|
retention-days: 5
|
|
|
|
- name: Tear down Test Environment
|
|
timeout-minutes: 30
|
|
if: always()
|
|
shell: bash
|
|
run: |
|
|
$(go env GOPATH)/bin/${TEST_TYPE} dispose
|