Skip to content

Latest commit

 

History

History
100 lines (69 loc) · 2.78 KB

CONTRIBUTING.md

File metadata and controls

100 lines (69 loc) · 2.78 KB

Contributing

So you found a bug, fixed it and would like us to include it in the next release. If so, please read-on.

Outline

Running tests using act

This is how CI pipleine does it.

This CI pipeline can be run locally using https://github.com/nektos/act which will use Docker to run the GitHub Actions workflow.

On your first invocation of act, select the "Medium" runner image, as the workflow has been tested using that. Refer to https://github.com/nektos/act#runners for more information.

As it installs many large dependencies, languages and packages, be sure to use act --reuse --job build to reuse the same container for each invocation.

Setting up your Ubuntu machine

Here are some notes for ubuntu 20.04

Ubuntu 20.04 + python3

sudo apt install python3 python3-pip python3-pytest tox black flake8

Ubuntu 20.04 + C++

sudo apt install clang-format clang++ libc++-dev libc++abi-dev

Ubuntu 20.04 + Rust

rustup install nightly
rustup component add --toolchain nightly clippy
rustup component add --toolchain nightly rustfmt

MacOS dependencies

The following commands will install most of the dependencies on MacOS

brew install astyle clang-format flutter gcc go julia kotlin maven nim rust vlang z3

Setting up python dependencies

pip3 install -e .[test]

Running tests for C++ only

pytest-3 -k cpp -v

Other languages will be similar.

Updating expected output

Most test cases live in <repo>/tests/cases/*.py and the expected output after transpilation are in <repo>/tests/expected. If you make changes to any of the tests, follow the recipe below and inspect the updated files in tests/expected.

export UPDATE_EXPECTED=1
pytest-3 -k cli -v

When tests are run, temporary files are generated, compared against expected golden output and then discarded. If you want to keep them around for debugging purposes, you can use:

export KEEP_GENERATED=1
pytest-3 -k some_test -v

Running tests via CI

  • Submit your pull request (PR) using the process outlined above
  • Navigate to your pull request
  • First time committers require their PRs to be approved for CI
  • Once approved (automatic on your second PR), you'll see a list of jobs at the bottom of the page. Once all tests pass, your PR is ready to be reviewed for merging.