-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
21 changed files
with
4,730 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
tests: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[run] | ||
branch = True | ||
relative_files = True |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,126 @@ | ||
name: Run E2E Tests | ||
description: Run end-to-end tests for Pantos | ||
inputs: | ||
ethereum-contracts-version: | ||
description: 'The version of the ethereum-contracts repository to use' | ||
required: false | ||
default: '' | ||
servicenode-version: | ||
description: 'The version of the servicenode images to use. Use local if you want to use locally built images' | ||
required: false | ||
default: '' | ||
validatornode-version: | ||
description: 'The version of the validatornode repository to use' | ||
required: false | ||
default: '' | ||
ethereum-contracts-path: | ||
description: 'The path to the ethereum-contracts repository' | ||
required: false | ||
default: ${{ github.workspace }}/ethereum-contracts | ||
servicenode-path: | ||
description: 'The path to the servicenode repository' | ||
required: false | ||
default: ${{ github.workspace }}/servicenode | ||
validatornode-path: | ||
description: 'The path to the validatornode repository' | ||
required: false | ||
default: ${{ github.workspace }}/validatornode | ||
|
||
runs: | ||
using: 'composite' | ||
|
||
steps: | ||
- name: Set environment variables | ||
shell: bash | ||
run: | | ||
echo "PANTOS_ETHEREUM_CONTRACTS=${{ inputs.ethereum-contracts-path }}" >> $GITHUB_ENV | ||
echo "PANTOS_SERVICE_NODE=${{ inputs.servicenode-path }}" >> $GITHUB_ENV | ||
echo "PANTOS_VALIDATOR_NODE=${{ inputs.validatornode-path }}" >> $GITHUB_ENV | ||
echo "PANTOS_E2E_TESTS=${{ github.workspace }}/e2e-tests" >> $GITHUB_ENV | ||
- uses: actions/checkout@v4 | ||
with: | ||
path: ${{ env.PANTOS_E2E_TESTS }} | ||
|
||
- uses: pantos-io/ci-workflows/.github/actions/install-python-deps@v1 | ||
with: | ||
working-directory: ${{ env.PANTOS_E2E_TESTS }} | ||
|
||
- name: Check for folder existence | ||
shell: bash | ||
id: check-folder | ||
run: | | ||
echo "PANTOS_ETHEREUM_CONTRACTS_EXISTS=$(test -d ${{ env.PANTOS_ETHEREUM_CONTRACTS }} && echo true || echo false)" >> $GITHUB_OUTPUT | ||
echo "PANTOS_SERVICE_NODE_EXISTS=$(test -d ${{ env.PANTOS_SERVICE_NODE }} && echo true || echo false)" >> $GITHUB_OUTPUT | ||
echo "PANTOS_VALIDATOR_NODE_EXISTS=$(test -d ${{ env.PANTOS_VALIDATOR_NODE }} && echo true || echo false)" >> $GITHUB_OUTPUT | ||
- uses: actions/checkout@v4 | ||
if: steps.check-folder.outputs.PANTOS_ETHEREUM_CONTRACTS_EXISTS == 'false' | ||
with: | ||
repository: pantos-io/ethereum-contracts | ||
path: ${{ env.PANTOS_ETHEREUM_CONTRACTS }} | ||
sparse-checkout: | | ||
docker-compose.yml | ||
Makefile | ||
- uses: actions/checkout@v4 | ||
if: steps.check-folder.outputs.PANTOS_SERVICE_NODE_EXISTS == 'false' | ||
with: | ||
repository: pantos-io/servicenode | ||
path: ${{ env.PANTOS_SERVICE_NODE }} | ||
sparse-checkout: | | ||
docker-compose.yml | ||
docker-compose.override.yml | ||
Makefile | ||
- uses: actions/checkout@v4 | ||
if: steps.check-folder.outputs.PANTOS_VALIDATOR_NODE_EXISTS == 'false' | ||
with: | ||
repository: pantos-io/validatornode | ||
path: ${{ env.PANTOS_VALIDATOR_NODE }} | ||
sparse-checkout: | | ||
docker-compose.yml | ||
docker-compose.override.yml | ||
Makefile | ||
- name: Create local signer_key | ||
shell: bash | ||
run: | | ||
ssh-keygen -t ed25519 -f signer_key.pem -N '' | ||
chmod 777 signer_key.pem | ||
working-directory: ${{ env.PANTOS_SERVICE_NODE }} | ||
|
||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@68827325e0b33c7199eb31dd4e31fbe9023e06e3 # v3.0.0 | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@d70bba72b1f3fd22344832f00baa16ece964efeb # v3.3.0 | ||
id: buildx | ||
|
||
- name: Cache Docker layers | ||
uses: actions/cache@v4 | ||
with: | ||
path: /tmp/.buildx-cache | ||
key: ${{ runner.os }}-buildx-v1.0-e2e-test-${{ github.ref_name }} | ||
restore-keys: | | ||
${{ runner.os }}-buildx-v1.0-test- | ||
- name: Check docker config and disable live reload | ||
shell: bash | ||
run: | | ||
cat /etc/docker/daemon.json | ||
echo '{ "live-restore": false }' | sudo tee /etc/docker/daemon.json | ||
sudo systemctl reload docker | ||
make check-swarm-init | ||
working-directory: ${{ env.PANTOS_E2E_TESTS }} | ||
|
||
- name: Run Tests | ||
shell: bash | ||
run: | | ||
make test | ||
working-directory: ${{ env.PANTOS_E2E_TESTS }} | ||
env: | ||
PANTOS_ETHEREUM_CONTRACTS_VERSION: ${{ inputs.ethereum-contracts-version }} | ||
PANTOS_SERVICE_NODE_VERSION: ${{ inputs.servicenode-version }} | ||
PANTOS_VALIDATOR_NODE_VERSION: ${{ inputs.validatornode-version }} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
name: CI | ||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
workflow_call: | ||
|
||
jobs: | ||
test: | ||
name: Run tests | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Run Tests | ||
uses: jenseng/dynamic-uses@v1 | ||
with: | ||
uses: ${{ github.repository }}/.github/actions/run-tests@${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || 'main' }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
name: Sonar | ||
|
||
on: | ||
workflow_run: | ||
workflows: [CI] | ||
types: [completed] | ||
|
||
jobs: | ||
shared: | ||
uses: pantos-io/ci-workflows/.github/workflows/sonar.yml@v1 | ||
secrets: inherit | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
[mypy] | ||
namespace_packages = True | ||
explicit_package_bases = True | ||
|
||
[mypy-pantos.common.*] | ||
ignore_missing_imports = True |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
repos: | ||
- repo: https://github.com/pre-commit/pre-commit-hooks | ||
rev: v4.5.0 | ||
hooks: | ||
- id: no-commit-to-branch | ||
name: Check that branch name follows our standard | ||
description: Checks that a branch has a proper name | ||
args: ['--branch', 'main','--pattern', '^(?![a-zA-Z0-9._-]+)'] | ||
stages: [ commit-msg ] | ||
- repo: https://github.com/PyCQA/flake8 | ||
rev: 6.0.0 | ||
hooks: | ||
- id: flake8 | ||
files: ^pantos/client/library | ||
stages: [ commit ] | ||
- repo: https://github.com/pre-commit/mirrors-mypy | ||
rev: v1.0.1 | ||
hooks: | ||
- id: mypy | ||
files: ^pantos/client/library | ||
additional_dependencies: ['types-requests', 'types-PyYAML'] | ||
stages: [ commit ] | ||
- repo: https://github.com/PyCQA/isort | ||
rev: 5.12.0 | ||
hooks: | ||
- id: isort | ||
alias: format | ||
args: ['--force-single-line-imports' ] | ||
stages: [ commit ] | ||
- repo: https://github.com/PyCQA/bandit | ||
rev: 1.7.5 | ||
hooks: | ||
- id: bandit | ||
alias: lint | ||
args: | ||
- --quiet | ||
- --format=custom | ||
- --configfile=.bandit | ||
stages: [ commit ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
[style] | ||
based_on_style = pep8 | ||
spaces_before_comment = 2 | ||
split_before_logical_operator = true | ||
column_limit = 79 | ||
allow_split_before_dict_value = false | ||
blank_lines_between_top_level_imports_and_variables = 1 | ||
blank_line_before_nested_class_or_def = false | ||
split_before_named_assigns = false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"editor.formatOnSave": true, | ||
"files.autoSave": "onFocusChange", | ||
"python.testing.pytestArgs": [], | ||
"python.testing.unittestEnabled": false, | ||
"python.testing.pytestEnabled": true, | ||
"python.testing.cwd": "${workspaceFolder}/tests", | ||
"python.testing.autoTestDiscoverOnSaveEnabled": true, | ||
"prettier.requireConfig": true, | ||
"prettier.yamlSpacing": true, | ||
"[yaml]": { | ||
"editor.defaultFormatter": "esbenp.prettier-vscode" | ||
} | ||
} |
Oops, something went wrong.