Skip to content

Commit

Permalink
Merge pull request #1283 from egbertbouman/actions
Browse files Browse the repository at this point in the history
Added validation tests to GitHub Actions
  • Loading branch information
egbertbouman committed Mar 6, 2024
2 parents 711a1fb + ac15de3 commit fc87f48
Show file tree
Hide file tree
Showing 3 changed files with 97 additions and 15 deletions.
99 changes: 90 additions & 9 deletions .github/workflows/pr-comment-validate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
with:
python-version: ${{ matrix.version }}
cache: 'pip'
- uses: actions/cache/restore@v3
- uses: actions/cache/restore@v4
if: matrix.os == 'windows-latest'
id: restore_cache
with:
Expand All @@ -35,7 +35,7 @@ jobs:
- run: python run_all_tests.py -a
env:
TEST_IPV8_WITH_IPV6: 1
- uses: actions/cache/save@v3
- uses: actions/cache/save@v4
if: matrix.os == 'windows-latest'
id: save_cache
with:
Expand All @@ -53,22 +53,22 @@ jobs:
run: |
{
echo 'actual_pull_head<<EOF'
git ls-remote https://github.com/Tribler/py-ipv8/ refs/pull/${{ github.event.issue.number }}/head | grep -o "^\w*\b"
git ls-remote ${{ github.server_url }}/${{ github.repository }}/ refs/pull/${{ github.event.issue.number }}/head | grep -o "^\w*\b"
echo
echo EOF
} >> "$GITHUB_ENV"
- name: Sharing commit SHA between jobs
id: sha_share_step
run: echo "actual_pull_head=${{ env.actual_pull_head }}" >> "$GITHUB_OUTPUT"
- name: Set commit pending status
uses: guibranco/github-status-action-v2@v1.1.7
uses: guibranco/github-status-action-v2@v1.1.13
with:
authToken: ${{secrets.GITHUB_TOKEN}}
context: 'Cross-env Validation'
description: 'Pending..'
state: 'pending'
sha: ${{ env.actual_pull_head }}
target_url: https://github.com/Tribler/py-ipv8/actions/runs/${{ github.run_id }}
target_url: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}

set_failure_status:
if: ${{failure() && github.event.issue.pull_request && startsWith(github.event.comment.body, 'validate') }}
Expand All @@ -78,14 +78,14 @@ jobs:
- name: Set commit failed status
env:
actual_pull_head: ${{needs.set_pending_status.outputs.actual_pull_head}}
uses: guibranco/github-status-action-v2@v1.1.7
uses: guibranco/github-status-action-v2@v1.1.13
with:
authToken: ${{secrets.GITHUB_TOKEN}}
context: 'Cross-env Validation'
description: 'Failed!'
state: 'failure'
sha: ${{ env.actual_pull_head }}
target_url: https://github.com/Tribler/py-ipv8/actions/runs/${{ github.run_id }}
target_url: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}

set_success_status:
if: ${{!failure() && github.event.issue.pull_request && startsWith(github.event.comment.body, 'validate') }}
Expand All @@ -95,11 +95,92 @@ jobs:
- name: Set commit success status
env:
actual_pull_head: ${{needs.set_pending_status.outputs.actual_pull_head}}
uses: guibranco/github-status-action-v2@v1.1.7
uses: guibranco/github-status-action-v2@v1.1.13
with:
authToken: ${{secrets.GITHUB_TOKEN}}
context: 'Cross-env Validation'
description: 'Success!'
state: 'success'
sha: ${{ env.actual_pull_head }}
target_url: https://github.com/Tribler/py-ipv8/actions/runs/${{ github.run_id }}
target_url: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}

validate_attestation_tutorial:
name: Validate attestation tutorial
if: ${{github.event.issue.pull_request && startsWith(github.event.comment.body, 'validate') }}
needs: set_pending_status
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: refs/pull/${{ github.event.issue.number }}/head
- name: Setup Python 3.8
uses: actions/setup-python@v5
with:
python-version: 3.8
- name: Install dependencies
run: |
pip install --upgrade setuptools pip
pip install -r requirements.txt
- name: Run attestation tests
run: |
export PYTHONPATH="$(pwd)/"
cd doc/deprecated/attestation_tutorial_integration
python attestation_tutorial_attest.py
python attestation_tutorial_verify.py
validate_identity_tutorial:
name: Validate identity tutorial
if: ${{github.event.issue.pull_request && startsWith(github.event.comment.body, 'validate') }}
needs: set_pending_status
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: refs/pull/${{ github.event.issue.number }}/head
- name: Setup Python 3.8
uses: actions/setup-python@v5
with:
python-version: 3.8
- name: Install dependencies
run: |
pip install --upgrade setuptools pip
pip install -r requirements.txt
- name: Run identity tests
run: |
export PYTHONPATH="$(pwd)/"
cd doc/basics/identity_tutorial_integration
python attestation_tutorial_attest.py
python attestation_tutorial_verify.py
validate_documentation:
name: Validate documentation
if: ${{github.event.issue.pull_request && startsWith(github.event.comment.body, 'validate') }}
needs: set_pending_status
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: refs/pull/${{ github.event.issue.number }}/head
- name: Setup Python 3.8
uses: actions/setup-python@v5
with:
python-version: 3.8
- name: Install dependencies
run: |
pip install --upgrade setuptools pip
pip install -r requirements.txt
- name: Run documentation tests
run: |
cd doc
if [ -f "further-reading/certfile.pem" ]
then
echo "certfile.pem found"
else
echo "generating certfile.pem"
cd further-reading
openssl req -newkey rsa:2048 -nodes -keyout private.key -x509 -days 365 -out certfile.pem -subj "/C=NL/ST=Zuid Holland/L=Delft/O=TU Delft/OU=Distributed Systems Group/CN=Tribler"
cat private.key >> certfile.pem
rm private.key
cd ..
fi
LD_PRELOAD=libgcc_s.so.1 python3 -X dev ./validate_examples.py
1 change: 1 addition & 0 deletions .github/workflows/unittests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ jobs:
key: cache_libsodium_dll
macos:
runs-on: macos-latest
timeout-minutes: 2
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
Expand Down
12 changes: 6 additions & 6 deletions .ruff.toml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
select = ["ALL"]
fixable = ["ALL"]
unfixable = []
lint.select = ["ALL"]
lint.fixable = ["ALL"]
lint.unfixable = []

ignore = [
lint.ignore = [
"ANN003",
"ANN101",
"ARG001",
Expand Down Expand Up @@ -87,11 +87,11 @@ exclude = [
line-length = 120

# Allow unused variables when underscore-prefixed.
dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$"
lint.dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$"

target-version = "py37"

[pylint]
[lint.pylint]
max-args = 6
max-returns = 8
max-branches = 12
Expand Down

0 comments on commit fc87f48

Please sign in to comment.