Github CI setting plus issue tracking system on YouTrack

devops-logo-2.png?w=2924

This note is for anyone who wants to set up the continuous integration environment on Github. The note includes adding a commit template when you send a PR (Pull Request) and also wants to combine the issue tracking system - YouTrack for their projects which I think should be faster than Jira. Let’s go.

Commit message template

Let’s create a template file called .gitmessage and put it here [~/.gitmessage]. I recommend this template format from Udacity Nanodegree Style Guide, the template would look like this:

1
2
3
4
5
type: subject

body

footer

The type keyword which is contained within the title can be one of these types:

  • feat: a new feature
  • fix: a bug fix
  • docs: changes to documentation
  • style: formatting, missing semicolons, and other improvements about UI/string content; no code change
  • refactor: refactoring production code
  • test: adding tests, refactoring test; no production code change
  • chore: updating build tasks, package manager configs, and other configurations for project processing; no production code change

Subject, body, and footer are the descriptions for this commit. After creating this .gitmessage file. Open the .gitconfig and add the following code:

1
2
[commit]
template = ~/.gitmessage

When you use git commit, it would automatically bring the template out, and all you need to do is to fill in the related information for this commit.

Circle CI on Github

You can set up Circle CI on Github from the GitHub Marketplace and install the service. Circle CI provides several plans; for now, I think the free plan is enough to go.
circle-ci-plan.png
Circle CI Plans

After you integrate with Circle CI, you would get a failed message when trying to build at the first build. That’s because we haven’t had any configurations for Circle CI yet. You would need to create a .circleci. folder and config.yml file in the project. Let’s see my configuration file in my mobile project as an example. It’s super easy to understand and config.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
version: 1
jobs:
build:
working_directory: ~/code
docker:
- image: circleci/android:api-25-alpha
environment:
JVM_OPTS: -Xmx3200m
steps:
- checkout
- restore_cache:
key: jars-{{ checksum "build.gradle" }}-{{ checksum "app/build.gradle" }}
# - run:
# name: Chmod permissions #if permission for Gradlew Dependencies fail, use this.
# command: sudo chmod +x ./gradlew
- run: yes | sdkmanager --licenses || exit 0
- run: yes | sdkmanager --update || exit 0
- run:
name: Download Dependencies
command: ./gradlew androidDependencies
- save_cache:
paths:
- ~/.gradle
key: jars-{{ checksum "build.gradle" }}-{{ checksum "app/build.gradle" }}
- run:
name: Run Tests
command: ./gradlew lint test
- store_artifacts: # for display in Artifacts: https://circleci.com/docs/2.0/artifacts/
path: app/build/reports
destination: reports
- store_test_results: # for display in Test Summary: https://circleci.com/docs/2.0/collect-test-data/
path: app/build/test-results
# See https://circleci.com/docs/2.0/deployment-integrations/ for deploy examples

A few hints here:

  • If you are using Kotlin DSL now, especially using the build.gradle.kts. Remember to change all the gradle file names in configuration file to build.gradle.kts:

    1
    jars-{{ checksum "build.gradle.kts" }}-{{ checksum  "app/build.gradle.kts" }}
  • You might encounter the Android SDK license agreement issue, add the following commands:

    1
    2
    - run: yes | sdkmanager --licenses || exit 0
    - run: yes | sdkmanager --update || exit 0

Issue tracking system by YouTrack

Many developers nowadays are using Jira as an issue/project tracking system in their usual work. Jira lets you plan, track, and manage your agile and software development projects by combining the so-called agile software process or scrum process. You can customize your workflow, collaborate, and release your product.

Although many good points for using Jira, it still has some drawbacks for me to use.

  1. Slow reaction system: I can’t tell if that’s an internal network connection issue, or it’s just so slow.

  2. The system interface is pretty complicated for me.

  3. It’s not free - a critical factor for an independent developer like me. In the very beginning, independent developers might not have enough money to use such an expensive system. So, is there any good alternative to substitute? Yes, YouTrack.

Here’s the introduction for YouTrack from JetBrains. It’s almost the same as Jira, but quicker responding time, and it’s free for less or equals 3 developers.

YouTrack Overview

How do we integrate with Github for tracking PRs? The first step is to establish a connection between your project in YouTrack and a repository in GitHub. To connect with GitHub, you need to generate and store a personal access token. This token grants YouTrack access to the repository based on the access that is granted to your GitHub account.

You can use a single access token to set up multiple integrations. If you don’t have a personal access token, you can use the direct link from YouTrack to generate it during this setup procedure.

youtrack-github-integration.png
Integration with Github on YouTrack

You can read more detail information in here: GitHub Integration - Help | YouTrack Standalone

Once finishing the integration, you can track your commit to YouTrack now.

youtrack-github-integration-2.png

Happy coding, enjoy.