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 <zayatsevgeniy@nspcc.io>
  • Loading branch information
Evgeniy Zayats committed Oct 29, 2024
1 parent 92b0cc8 commit 3089f5d
Showing 1 changed file with 381 additions and 0 deletions.
381 changes: 381 additions & 0 deletions .github/workflows/system-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,381 @@
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", binary: "linux-amd64"}]'
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_commit:
type: string
description: 'Ref to neofs-testcases repo'
required: false
default: 'master'
neofs_node_commit:
type: string
description: 'Commit from neofs-node repo to build binaries'
required: false
default: 'from_tests'
neofs_node_tag:
type: string
description: 'Tag from neofs-node repo to download binaries'
required: false
default: 'from_tests'
neofs_s3_gw_commit:
type: string
description: 'Commit from neofs-s3-gw repo to build binaries'
required: false
default: 'from_tests'
neofs_s3_gw_tag:
type: string
description: 'Tag from neofs-s3-gw repo to download binaries'
required: false
default: 'from_tests'
neofs_rest_gw_commit:
type: string
description: 'Commit from neofs-rest-gw repo to build binaries'
required: false
default: 'from_tests'
neofs_rest_gw_tag:
type: string
description: 'Tag from neofs-rest-gw repo to download binaries'
required: false
default: 'from_tests'
neo_go_tag:
type: string
description: 'Tag from neo-go repo to download binaries'
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_commit }}
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_commit != 'from_tests' }}
uses: actions/checkout@v4
with:
repository: nspcc-dev/neofs-node
ref: ${{ inputs.neofs_node_commit }}
path: neofs-node

- name: Build neofs-node
if: ${{ inputs.neofs_node_commit != '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_commit != '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: Download neofs-cli
if: ${{ inputs.neofs_node_tag != 'from_tests' }}
uses: dsaltares/fetch-gh-release-asset@1.1.1
with:
repo: 'nspcc-dev/neofs-node'
version: 'tags/${{ inputs.neofs_node_tag }}''
file: 'neofs-cli-${{ matrix.binary }}'
target: 'neofs-testcases/neofs-cli'

- name: Download neofs-adm
if: ${{ inputs.neofs_node_tag != 'from_tests' }}
uses: dsaltares/fetch-gh-release-asset@1.1.1
with:
repo: 'nspcc-dev/neofs-node'
version: 'tags/${{ inputs.neofs_node_tag }}'
file: 'neofs-adm-${{ matrix.binary }}'
target: 'neofs-testcases/neofs-adm'

- name: Download neofs-ir
if: ${{ inputs.neofs_node_tag != 'from_tests' }}
uses: dsaltares/fetch-gh-release-asset@1.1.1
with:
repo: 'nspcc-dev/neofs-ir'
version: 'tags/${{ inputs.neofs_node_tag }}'
file: 'neofs-ir-${{ matrix.binary }}'
target: 'neofs-testcases/neofs-ir'

- name: Download neofs-lens
if: ${{ inputs.neofs_node_tag != 'from_tests' }}
uses: dsaltares/fetch-gh-release-asset@1.1.1
with:
repo: 'nspcc-dev/neofs-lens'
version: 'tags/${{ inputs.neofs_node_tag }}'
file: 'neofs-lens-${{ matrix.binary }}'
target: 'neofs-testcases/neofs-lens'

- name: Download neofs-node
if: ${{ inputs.neofs_node_tag != 'from_tests' }}
uses: dsaltares/fetch-gh-release-asset@1.1.1
with:
repo: 'nspcc-dev/neofs-lens'
version: 'tags/${{ inputs.neofs_node_tag }}'
file: 'neofs-lens-${{ matrix.binary }}'
target: 'neofs-testcases/neofs-lens'

- name: Set permissions for downloaded neofs-node binaries
if: ${{ inputs.neofs_node_tag != 'from_tests' }}
run: |
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_commit != 'from_tests' }}
uses: actions/checkout@v4
with:
repository: nspcc-dev/neofs-s3-gw
ref: ${{ inputs.neofs_s3_gw_commit }}
path: neofs-s3-gw

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

- name: Copy built neofs-s3-gw
if: ${{ inputs.neofs_rest_gw_commit != '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: Download neofs-s3-gw
if: ${{ inputs.neofs_s3_gw_tag != 'from_tests' }}
uses: dsaltares/fetch-gh-release-asset@1.1.1
with:
repo: 'nspcc-dev/neofs-s3-gw'
version: 'tags/${{ inputs.neofs_s3_gw_tag }}'
file: 'neofs-s3-gw-${{ matrix.binary }}'
target: 'neofs-testcases/neofs-s3-gw'

- name: Download neofs-s3-authmate
if: ${{ inputs.neofs_s3_gw_tag != 'from_tests' }}
uses: dsaltares/fetch-gh-release-asset@1.1.1
with:
repo: 'nspcc-dev/neofs-s3-gw'
version: 'tags/${{ inputs.neofs_s3_gw_tag }}'
file: 'neofs-s3-authmate-${{ matrix.binary }}'
target: 'neofs-testcases/neofs-s3-authmate'

- name: Set permissions for downloaded neofs-s3 binaries
if: ${{ inputs.neofs_s3_gw_tag != 'from_tests' }}
run: |
sudo chmod a+x neofs-s3-gw
sudo chmod a+x neofs-s3-authmate
working-directory: neofs-testcases

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

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

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

- name: Download neofs-rest-gw
if: ${{ inputs.neofs_rest_gw_tag != 'from_tests' }}
uses: dsaltares/fetch-gh-release-asset@1.1.1
with:
repo: 'nspcc-dev/neofs-rest-gw'
version: 'tags/${{ inputs.neofs_rest_gw_tag }}'
file: 'neofs-rest-gw-${{ matrix.binary }}'
target: 'neofs-testcases/neofs-rest-gw'

- name: Set permissions for downloaded neofs-rest-gw binaries
if: ${{ inputs.neofs_rest_gw_tag != 'from_tests' }}
run: |
sudo chmod a+x neofs-rest-gw
working-directory: neofs-testcases

- name: Download neo-go
if: ${{ inputs.neo_go_tag != 'from_tests' }}
uses: dsaltares/fetch-gh-release-asset@1.1.1
with:
repo: 'nspcc-dev/neo-go'
version: 'tags/${{ inputs.neo_go_tag }}'
file: 'neo-go-${{ matrix.binary }}'
target: 'neofs-testcases/neo-go'

- name: Set permissions for downloaded neo-go binaries
if: ${{ inputs.neo_go_tag != 'from_tests' }}
run: |
sudo chmod a+x neo-go
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/gh-push-allure-report-to-neofs@v0.1.1
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 3089f5d

Please sign in to comment.