Skip to content

Latest commit

 

History

History
57 lines (34 loc) · 2.81 KB

CONTRIBUTING.md

File metadata and controls

57 lines (34 loc) · 2.81 KB

Contributing

Thanks for your interest in contributing to this project! PRs and issues are welcome.

For larger changes, please start a discussion by creating an issue.

How to contribute

First, make sure you can build and run the project:

  1. Ensure you have Rust and Docker installed.
  2. Checkout this repo: git clone https://github.com/railwayapp/nixpacks.git
  3. Build the source: cargo build
  4. Run the tests: cargo test
  5. Build an example: cargo run -- build examples/node --name node
  6. Run the example: docker run node

You should see Hello from Node printed to the console.

Debugging

When debugging it can be useful to see the intermediate files that Nixpacks generates (e.g. Dockerfile). You can do this by saving the build artifact to a specific directory instead of to a temp dir, by executing the following command:

cargo run -- build examples/node --out test

Note: The test directory will contain everything that would be built with Docker. All the files that Nixpacks generates are in .nixpacks. You can manually build the image with docker build test -f test/.nixpacks/Dockerfile.

Snapshot Tests

Nixpacks uses insta for snapshot tests. We use snapshot tests to generate and compare all build plans for the test apps in examples/. If a snapshot test fails due to a change to a provider, that is okay. It just means the snapshot needs to be reviewed and accepted. To test and review all snapshots, you can

  1. Install insta: cargo install cargo-insta
  2. Test and review the generate plan tests: cargo insta test --review --test generate_plan_tests or cargo snapshot

The snapshots are checked into CI and are reviewed as part of every PR. They ensure that a change to one part of Nixpacks does not unexpectedly change an unrelated part.

Read the docs for more information on cargo insta.

Contribution Ideas

The easiest way to contribute is to add support for new languages. There is a list of languages we would like to add here, but languages not on the list are welcome as well. To gauge interest you can always create an issue before working on an implementation.

Making PRs

To make a PR follow GitHubs guide.

PRs are all checked with

  • cargo check
  • cargo test
  • cargo clippy

so you can run these locally to ensure CI passes.

Most PRs should include tests.