Skip to content

GitHub Actions action to validate OPTIMADE implementations using the validator from Materials-Consortia/optimade-python-tools

License

Notifications You must be signed in to change notification settings

Materials-Consortia/optimade-validator-action

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GitHub Action - OPTIMADE validator

GitHub Marketplace

This action runs optimade-validator from the optimade package found in the optimade-python-tools repository on either a locally running server or a public server.

All minor and patch updates to v2 will be folded into the v2 tag, so that using the action @v2 is recommended, since it results in using the latest v2.minor.patch.

Latest versions:

Used tag Effective version
v2 v2.0.1
v1 v1.2.0

Example usage

To run optimade-validator for an index meta-database at http://gh_actions_host:5001/v1 do the following:
Within the same job, first, start a server, e.g., using the docker-compose.yml setup from this repository, and then add the step

uses: Materials-Consortia/optimade-validator-action@v2
with:
  port: 5001
  path: /v1
  index: yes

To run optimade-validator for a regular OPTIMADE deployed implementation, testing all possible versioned base URLs:

  • https://example.org:443/optimade/example/v1
  • https://example.org:443/optimade/example/v1.0
  • https://example.org:443/optimade/example/v1.0.0
uses: Materials-Consortia/optimade-validator-action@v2
with:
  protocol: https
  domain: example.org
  port: 443
  path: /optimade/example
  all versioned paths: True

Inputs

Input Description Usage Default Action version
all_versioned_paths Whether to test all possible versioned base URLs:

/vMAJOR
/vMAJOR.MINOR
/vMAJOR.MINOR.PATCH

If this is 'true', the input 'path' MUST exempt the version part (e.g., '/optimade' instead of '/optimade/v1').
If this is 'false', the input 'path' MUST include the version part (e.g., '/optimade/v1' instead of '/optimade')
Optional false v1+
as_type Validate the request URL with the provided type, rather than scanning the entire implementation
Example values: 'structures', 'reference'. For a full list of values see optimade-python-tools.
Optional - v1+
domain Domain for the OPTIMADE URL (defaults to the GitHub Actions runner host) Optional gh_actions_host v1+
fail_fast Whether or not to exit and return a non-zero error code on first failure. Optional false v2+
index Whether or not this is an index meta-database Optional false v1+
path Path for the OPTIMADE (versioned) base URL - MUST start with /
Note: If all versioned paths is true, this MUST be un-versioned, e.g., /optimade or /, otherwise it MUST be versioned, e.g., the default value
Optional /v1 v1+
port Port for the OPTIMADE URL Optional 5000 v1+
protocol Protocol for the OPTIMADE URL Optional http v1+
skip_optional Whether or not to skip tests for optional features. Optional false v2+
validator_version Full version of an OPTIMADE Python tools release to PyPI, e.g., 'v0.6.0' or '0.3.4', which hosts the optimade-validator. It can also be a branch, tag, or git commit to use from the GitHub repository, e.g., 'master' or '5a5e903'.
See the pip documentation for more information of what is allowed here.
Finally, it may also be 'latest' (default), which is understood to be the latest official release of the optimade package on PyPI.
Note, for the latest development version, choose 'master'.
Required latest v1+
verbosity The verbosity of the output.
0: minimalistic, 1: informational, 2+: debug
Optional 1 v1+

Running test suite (developers)

The test suite is based on BATS and should be run in Docker. The reason to run in Docker, is that the entrypoint.sh file will install the optimade package. And to not pollute your local environment, it is safer to run it in a Docker container.

Steps to setup your test environment:

  1. Git clone this repository to your local environment

  2. Install Docker (this depends on your OS, see the Docker documentation)

  3. Run in a terminal (based on a Unix system):

    cd /path/to/optimade-validator-action
    docker build --tag optimade_bats ./tests

Now you can run

docker run -i -v "$(pwd):/code" --workdir /code/tests optimade_bats .

or

./run_tests.sh

This is a file that contains the previous line and runs it, for posterity. Furthermore, it takes two arguments.

One is the Docker tag. So if you named the built Docker image something different from optimade_bats, you can pass the name to run_tests.sh and it will work, e.g.,

./run_tests.sh my_custom_image_name

will run the tests with image my_custom_image_name instead of optimade_bats.

Another is the relative or absolute path to the .bats files directory or a single .bats file, e.g.,

./run_tests.sh ./tests/test_verbosity.bats

will run the tests in the test_verbosity.bats file under the tests directory relative to where you're running the run_tests.sh file.

Concerning action versions and optimade-python-tools

Since this action installs optimade-python-tools and runs the validator from this repository, the versions of this Action relies on different versions of the optimade package in the optimade-python-tools repository.

To keep it simple, this overview will only consider the major versions of this Action:

Action version optimade package versions Supported OPTIMADE API specification version(s)
v2 v0.10.0+ v1.0.0
v1 v0.7.0 - v0.9.8 v0.10.0 - v1.0.0-rc2

About

GitHub Actions action to validate OPTIMADE implementations using the validator from Materials-Consortia/optimade-python-tools

Resources

License

Stars

Watchers

Forks

Packages

No packages published