# Git Workflow and Actions

The Head Tracker GitHub page is setup for continuous integration (CI) what this means is every time a change in the code is made to it will compile the result with binary files you can run. This allows anyone to easily download and test recent changes without having to setup the full development environment.&#x20;

The standard way to make a change or addition to the code is for a user to make a fork of the project. A fork is a copy of the base repository that you can modify. After making a fork you are going to create a new branch. You can name this branch something suiting to the change you are planning on creating.

You can create as many branches in your fork as you want if your testing out various ideas or working on multiple ideas at a time.

When you have a branch you want to add to the main project you will then do a Pull request. When you make a pull request, put a short description of the changes in the comments. A maintainer will review the changes, comment may request changes and finally will approve and merge them into the project.

All of the current pull requests from Users will be shown here

{% embed url="https://github.com/dlktdr/HeadTracker/pulls" %}

### Workflows

As soon as you start a Pull request GitHub Actions will start compiling the code changes. Depending on the code that was changed one or more workflows will trigger.&#x20;

{% embed url="https://github.com/dlktdr/headtracker/actions" %}

You will be greeted with a window that looks like this.

<figure><img src="https://1791219135-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FifYnTDP7IFJCZallDj96%2Fuploads%2Fpq5uR98aA2xuBBJHqw3b%2Fimage.png?alt=media&#x26;token=427795b4-acc7-496f-8cc4-7510ec5fc228" alt=""><figcaption></figcaption></figure>

On the left, there are 4 workflows. You can filter the results by clicking these individual items.

* Firmware Build\
  &#x20;\- This builds the firmware that will be written to the Nano and other supported boards
* Linux GUI
* MacOS GUI
*   Windows GUI

    &#x20; \- These are the configuration GUI's for all the supported operating systems.

On the right side of the screen is each workflow that has run. Below is an example created by user gcmcnutt in their branch named SerialUpdate. The green check mark means is successfully compiled. This workflow compiled the Firmware.

<figure><img src="https://1791219135-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FifYnTDP7IFJCZallDj96%2Fuploads%2FAkURaT5djGQYS1bBSU7a%2Fimage.png?alt=media&#x26;token=0947df35-b043-4ce9-8642-22eb39aedc6c" alt=""><figcaption></figcaption></figure>

The main code tree that will eventually become the next release is in a branch called **master.** Below shows an example of an workflow that ran on the master branch. After a pull request is approved it will be merged into this master branch. This workflow compiled the Windows GUI

<figure><img src="https://1791219135-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FifYnTDP7IFJCZallDj96%2Fuploads%2Flm10xF3hAJvt0fA5DC5z%2Fimage.png?alt=media&#x26;token=ddddd314-379d-441e-9f93-e38a87466054" alt=""><figcaption></figcaption></figure>

### Download Artifacts

When a workflow completes successfully (Green Check Mark) it creates artifacts. In the case of the workflows in Head Tracker the artifacts are either the GUI or the Firmware.

Click a workflow to see it's details. Here you can see the process of it building and potentially where it has failed. On successful builds you will see artifacts at the bottom of the page.&#x20;

<figure><img src="https://1791219135-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FifYnTDP7IFJCZallDj96%2Fuploads%2FBvkLKCHWKZdvTgJUY9X9%2Fimage.png?alt=media&#x26;token=82a11664-4a67-4243-8a1a-6d11a39488ce" alt=""><figcaption></figcaption></figure>

In the above example for an action that compiled the Windows GUI there is one artifact called **headtracker\_win**. Clicking this will download the GUI so it can be tested.&#x20;

{% hint style="warning" %}
You must be logged into GitHub to download actions. Otherwise clicking the action will do nothing. GitHub accounts are free.
{% endhint %}

If you were are looking to test out the most recent build you will need to search the list for the newest actions that ran on **master** and will need one GUI that matches your operating system and one firmware.

Download and extract both .zip files to a location on your PC.

When you open the GUI you will need to flash this downloaded firmware. Choose Firmware -> Upload Firmware. You won't be greeted with any available release firmware choices, only local file.&#x20;

<figure><img src="https://1791219135-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FifYnTDP7IFJCZallDj96%2Fuploads%2FCJzUgUcferh0vX2carNn%2Fimage.png?alt=media&#x26;token=e844f3cc-0b3a-4ca5-b978-304960a1bf71" alt=""><figcaption></figcaption></figure>

Using the browse, the three dots navigate to where you extracted these files and choose the firmware that matches the board you own. As of this writing there are two choices.

<figure><img src="https://1791219135-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FifYnTDP7IFJCZallDj96%2Fuploads%2FszQX5osbD9GMNbDGJ1cF%2Fimage.png?alt=media&#x26;token=6c62dd91-1fbc-4ce9-8f84-26f4a1a3c2b1" alt=""><figcaption></figcaption></figure>

After flashing the Firmware, you can test out the current state of the code.

{% hint style="warning" %}
Running these development builds there may be issues. Please help out by reporting any issues found including comments. Create an issue on the Github Issues page or contact a developer on Discord in the [#dev](https://discord.com/channels/827622724565467196/900028126271242250) chat room.

Be sure to make a note of the SHA on your issue, which can be found after clicking the action. Highlighted in yellow below. This is a unique identifier for that particular state of code.
{% endhint %}

<figure><img src="https://1791219135-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FifYnTDP7IFJCZallDj96%2Fuploads%2FVcVCMp0UMAmso5CP6wSP%2Fimage.png?alt=media&#x26;token=65eb715f-02be-4c5e-b07c-0b899c2efdc9" alt=""><figcaption></figcaption></figure>
