Skip to content

Commit

Permalink
.github: add common system tests workflow
Browse files Browse the repository at this point in the history
closes #878

Signed-off-by: Evgeniy Zayats <[email protected]>
  • Loading branch information
Evgeniy Zayats committed Oct 24, 2024
1 parent 4a25bd2 commit 4108c4f
Showing 1 changed file with 251 additions and 0 deletions.
251 changes: 251 additions & 0 deletions .github/workflows/system-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,251 @@
name: NeoFS System Tests

on:
workflow_call:
inputs:
neofs_network_domain:
type: string
description: 'NeoFS network domain to deploy tests report'
required: true
neofs_http_gate:
type: string
description: 'NeoFS http gate address to deploy tests report'
required: true
neofs_store_objects_cid:
type: string
description: 'NeoFS container id to deploy tests report'
required: true
neofs_pr_expiration_period:
type: string
description: 'NeoFS tests report expiration period for PRs'
required: true
neofs_master_expiration_period:
type: string
description: 'NeoFS tests report expiration period for master commits'
required: true
neofs_manual_expiration_period:
type: string
description: 'NeoFS tests report expiration period for manual runs'
required: true
neofs_other_expiration_period:
type: string
description: 'NeoFS tests report expiration period for other purposes'
required: true
os:
type: string
description: 'Github runners in JSON format'
required: false
default: '[{"runner": "ubuntu-latest"}]'
marks:
type: string
description: 'Pytest marks to execute certain tests; examples: sanity'
required: false
default: ''
tests_path:
type: string
description: 'Path to tests; examples: pytest_tests/tests/s3'
required: false
default: 'pytest_tests/tests'
tests_parallel_level:
type: number
description: 'Level of parallelization to be used by tests; examples: 3'
required: false
default: 1
neofs_testcases_ref:
type: string
description: 'Ref to neofs-testcases repo'
required: false
default: 'master'
neofs_node_ref:
type: string
description: 'Ref to neofs-node repo'
required: false
default: 'from_tests'
neofs_s3_gw_ref:
type: string
description: 'Ref to neofs-s3-gw repo'
required: false
default: 'from_tests'
neofs_rest_gw_ref:
type: string
description: 'Ref to neofs-rest-gw repo'
required: false
default: 'from_tests'
secrets:
TEST_RESULTS_WALLET:
description: 'NeoFS wallet to deploy tests report'
required: true
TEST_RESULTS_PASSWORD:
description: 'NeoFS wallet password to deploy tests report'
required: true

env:
ALLURE_RESULTS_DIR: ${{ github.workspace }}/allure-results

jobs:
run_system_tests:
runs-on: ${{ matrix.runner }}
strategy:
fail-fast: false
matrix:
include: ${{ fromJson(inputs.os) }}
timeout-minutes: 500
steps:
- name: Set up Go
uses: actions/setup-go@v5
with:
cache: true
go-version: '1.22'
- run: go version

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
- run: python --version

- name: Checkout neofs-testcases repository
uses: actions/checkout@v4
with:
repository: nspcc-dev/neofs-testcases
ref: ${{ inputs.neofs_testcases_ref }}
path: neofs-testcases

- name: Fix OpenSSL ripemd160
run: |
sudo python ./tools/src/openssl_config_fix.py
working-directory: neofs-testcases

- name: Checkout xk6-neofs repository
uses: actions/checkout@v4
with:
repository: nspcc-dev/xk6-neofs
ref: master
path: xk6-neofs

- name: Build xk6-neofs
timeout-minutes: 5
run: |
make install_xk6
make build
working-directory: xk6-neofs

- name: Checkout neofs-node repository
if: ${{ inputs.neofs_node_ref != 'from_tests' }}
uses: actions/checkout@v4
with:
repository: nspcc-dev/neofs-node
ref: ${{ inputs.neofs_node_ref }}
path: neofs-node

- name: Build neofs-node
if: ${{ inputs.neofs_node_ref != 'from_tests' }}
timeout-minutes: 5
run: |
make all
echo "$(pwd)/bin" >> $GITHUB_PATH
working-directory: neofs-node

- name: Copy built neofs-node
if: ${{ inputs.neofs_node_ref != 'from_tests' }}
timeout-minutes: 30
run: |
cp ../neofs-node/bin/* .
sudo chmod a+x neofs-cli
sudo chmod a+x neofs-adm
sudo chmod a+x neofs-ir
sudo chmod a+x neofs-lens
sudo chmod a+x neofs-node
working-directory: neofs-testcases

- name: Checkout neofs-s3-gw repository
if: ${{ inputs.neofs_s3_gw_ref != 'from_tests' }}
uses: actions/checkout@v4
with:
repository: nspcc-dev/neofs-s3-gw
ref: ${{ inputs.neofs_s3_gw_ref }}
path: neofs-s3-gw

- name: Build neofs-s3-gw
if: ${{ inputs.neofs_s3_gw_ref != 'from_tests' }}
run: |
make all
working-directory: neofs-s3-gw

- name: Copy built neofs-s3-gw
if: ${{ inputs.neofs_rest_gw_ref != 'from_tests' }}
timeout-minutes: 30
run: |
cp ../neofs-s3-gw/bin/* .
sudo chmod a+x neofs-s3-authmate
sudo chmod a+x neofs-s3-gw
working-directory: neofs-testcases

- name: Checkout neofs-rest-gw repository
if: ${{ inputs.neofs_rest_gw_ref != 'from_tests' }}
uses: actions/checkout@v4
with:
repository: nspcc-dev/neofs-rest-gw
ref: ${{ inputs.neofs_rest_gw_ref }}
path: neofs-rest-gw

- name: Build neofs-rest-gw
if: ${{ inputs.neofs_rest_gw_ref != 'from_tests' }}
run: |
make all
working-directory: neofs-rest-gw

- name: Copy and chmod built neofs-rest-gw
if: ${{ inputs.neofs_rest_gw_ref != 'from_tests' }}
timeout-minutes: 30
run: |
cp ../neofs-rest-gw/bin/* .
sudo chmod a+x neofs-rest-gw
working-directory: neofs-testcases

- name: Prepare venv
id: prepare_venv
timeout-minutes: 30
run: |
make venv.pytest
echo "$(pwd)" >> $GITHUB_PATH
working-directory: neofs-testcases

- name: Run tests
timeout-minutes: 120
env:
ALLURE_RESULTS_DIR: ${{ env.ALLURE_RESULTS_DIR }}
run: |
source venv.pytest/bin/activate && pytest -n ${{ inputs.tests_parallel_level }} --show-capture=no -m "${{ inputs.marks }}" --alluredir=${GITHUB_WORKSPACE}/allure-results ${{ inputs.tests_path }}
working-directory: neofs-testcases

- name: Publish to NeoFS
id: put_report
if: always() && steps.prepare_venv.outcome == 'success'
uses: nspcc-dev/[email protected]
with:
NEOFS_WALLET: ${{ secrets.TEST_RESULTS_WALLET }}
NEOFS_WALLET_PASSWORD: ${{ secrets.TEST_RESULTS_PASSWORD }}
NEOFS_NETWORK_DOMAIN: ${{ inputs.neofs_network_domain }}
NEOFS_HTTP_GATE: ${{ inputs.neofs_http_gate }}
STORE_OBJECTS_CID: ${{ inputs.neofs_store_objects_cid }}
PR_LIFETIME: ${{ inputs.neofs_pr_expiration_period }}
MASTER_LIFETIME: ${{ inputs.neofs_master_expiration_period }}
MANUAL_RUN_LIFETIME: ${{ inputs.neofs_manual_expiration_period }}
OTHER_LIFETIME: ${{ inputs.neofs_other_expiration_period }}
ALLURE_RESULTS_DIR: ${{ env.ALLURE_RESULTS_DIR }}
ALLURE_GENERATED_DIR: 'neofs-test-allure-generated-report'

- name: Post the link to the report
id: post_report_link
timeout-minutes: 60
if: always() && steps.put_report.outcome == 'success'
env:
REPORT_NEOFS_URL: ${{ steps.put_report.outputs.REPORT_NEOFS_URL }}index.html
uses: Sibz/github-status-action@v1
with:
authToken: ${{ secrets.GITHUB_TOKEN }}
context: 'Test report ${{ matrix.runner }}'
state: 'success'
sha: ${{ github.event.pull_request.head.sha || github.sha }}
target_url: ${{ env.REPORT_NEOFS_URL }}

0 comments on commit 4108c4f

Please sign in to comment.