bids-standard / bids-validator

Validator for the Brain Imaging Data Structure
https://bids-standard.github.io/bids-validator/
MIT License
181 stars 109 forks source link

Enable Dev/Master version of bids-validator-web #1227

Open sappelhoff opened 3 years ago

sappelhoff commented 3 years ago

copying to this public issue from a private chat:

wouldn't it be fairly easy to supply the web-validator as both stable (as done currently), AND dev? We can just have two folders on the gh-pages branch, and CI deploys to one only on release, and to the other one on each commit to master. We'd only need some minimum of html to insert links from one page to the other

sappelhoff commented 3 years ago

github pages websites are hosted on: <github-account-name>.github.io/<github-repo>, e.g.: bids-standard.github.io/bids-validator/

the website is served such, that the root tree of files on the gh-pages branch is "taken" and the index.html file there is the landing point, see: https://github.com/bids-standard/bids-validator/tree/gh-pages

But we could also push two folders to the gh-pages branch root: one called stable, and one called dev ... each of these folders would look like the root does look currently

BUT ADDITIONALLY, we'll have in the root of gh-pages an index.html that looks like this:

<!DOCTYPE HTML>
<html lang="en-US">
    <head>
        <meta charset="UTF-8">
        <meta http-equiv="refresh" content="1; url=https://https://bids-standard/bids-validator/stable/index.html">
        <script type="text/javascript">
            window.location.href = "https://https://bids-standard/bids-validator/stable/index.html"
        </script>
        <title>Page Redirection</title>
    </head>
    <body>
        If you are not redirected automatically, follow this <a href='https://bids-standard/bids-validator/stable/index.html'>link</a>.
    </body>
</html>

so we automatically redirect visitors to the stable version.

And their url will look like:

instead of the current:

Finally, we need to insert some kind of button or documentation that when users replace the stable in the URL with dev, they are getting served the other validator.

Implementing that in CI works through "filters", telling the CI when to run a job and when not. E.g., only run it if you see a new git tag ... or run it only if there is a commit on branch XYZ

see: https://github.com/bids-standard/bids-validator/blob/5ee85764957b8b07681ac33c92b7d3052c01ce45/.circleci/config.yml#L217-L221

so I am pretty confident it'd work. And inserting that "button" to switch between stable and dev is the only thing I am not sure about right now

sappelhoff commented 3 years ago

just a short note that this URL also leads to the "master" version of bids-validator: https://circleci.com/api/v1.1/project/github/bids-standard/bids-validator/latest/artifacts/0/~/web_version/index.html

will always resolve to the latest completed build.

For example, to https://8631-37161308-gh.circle-artifacts.com/0/%7E/web_version/index.html at the time of writing.

effigies commented 3 years ago

As long as we have reasonable churn, that will work, but Circle's commitment to artifact availability is pretty short-lived. I don't remember the the exact duration.