pcaversaccio / snekmate

State-of-the-art, highly opinionated, hyper-optimised, and secure 🐍Vyper smart contract building blocks.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

👷‍♂️ Implement CI Tests for User Documentation `userdoc` and Developer Documentation `devdoc`

pcaversaccio opened this issue · comments

In order to ensure no compilation failures if development frameworks use the userdoc and/or devdoc CLI options, we should implement a proper CI test for those cases (after the Vyper 0.3.8 release since).

Example CLI Command

vyper -f userdoc,devdoc .\src\auth\AccessControl.vy

A simple Python script could look like this:

import os, glob

for filename in glob.glob("**/*.vy", recursive=True):
    os.system("vyper -f userdoc,devdoc %s" % (filename))

We should probably use the modern subprocess.run command instead:

import subprocess, glob

for filename in glob.glob("**/*.vy", recursive=True):
    result = subprocess.run(
        ["vyper", "-f", "userdoc,devdoc", filename], capture_output=True, text=True
    )
    if result.stderr != "":
        raise Exception("Error compiling: " + filename)
    print("stdout:", result.stdout)

Another way would be to call ape directly as part of the CI.