SolarShadingRayTracing.jl

Developer documentation

!!! note “Contributing guidelines” If you haven’t, please read the Contributing guidelines first.

If you want to make contributions to this package that involves code, then this guide is for you.

First time clone

!!! tip “If you have writing rights” If you have writing rights, you don’t have to fork. Instead, simply clone and skip ahead. Whenever upstream is mentioned, use origin instead.

If this is the first time you work with this repository, follow the instructions below to clone the repository.

  1. Fork this repo
  2. Clone your repo (this will create a git remote called origin)
  3. Add this repo as a remote:

    git remote add upstream https://github.com/langestefan/SolarShadingRayTracing.jl
    

This will ensure that you have two remotes in your git: origin and upstream. You will create branches and push to origin, and you will fetch and update your local main branch from upstream.

Linting and formatting

Install a plugin on your editor to use EditorConfig. This will ensure that your editor is configured with important formatting settings.

We use https://pre-commit.com to run the linters and formatters. In particular, the Julia code is formatted using JuliaFormatter.jl, so please install it globally first:

julia> # Press ]
pkg> activate
pkg> add JuliaFormatter

To install pre-commit, we recommend using pipx as follows:

# Install pipx following the link
pipx install pre-commit

With pre-commit installed, activate it as a pre-commit hook:

pre-commit install

To run the linting and formatting manually, enter the command below:

pre-commit run -a

Now, you can only commit if all the pre-commit tests pass.

We use lychee for link checking in CI. You can run it locally to avoid waiting for CI. First, install lychee, then run against the repository root using the project config:

lychee --no-progress --config lychee.toml .

Testing

As with most Julia packages, you can just open Julia in the repository folder, activate the environment, and run test:

julia> # press ]
pkg> activate .
pkg> test

Working on a new issue

We try to keep a linear history in this repo, so it is important to keep your branches up-to-date.

  1. Fetch from the remote and fast-forward your local main

    git fetch upstream
    git switch main
    git merge --ff-only upstream/main
    
  2. Branch from main to address the issue (see below for naming)

    git switch -c 42-add-answer-universe
    
  3. Push the new local branch to your personal remote repository

    git push -u origin 42-add-answer-universe
    
  4. Create a pull request to merge your remote branch into the org main.

Branch naming

Commit message

Before creating a pull request

!!! tip “Atomic git commits” Try to create “atomic git commits” (recommended reading: The Utopic Git History).

Building and viewing the documentation locally

Following the latest suggestions, we recommend using LiveServer to build the documentation. Here is how you do it:

  1. Run julia --project=docs to open Julia in the environment of the docs.
  2. If this is the first time building the docs
    1. Press ] to enter pkg mode
    2. Run pkg> dev . to use the development version of your package
    3. Press backspace to leave pkg mode
  3. Run julia> using LiveServer
  4. Run julia> servedocs()

Making a new release

To create a new release, you can follow these simple steps:

After that, you only need to wait and verify: