diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 712915b..5b9f222 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -21,7 +21,7 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: token: ${{ secrets.gh_pat }} submodules: pwdrecursive diff --git a/docs/00-overview.md b/docs/00-overview.md index 5a670ba..80d60af 100644 --- a/docs/00-overview.md +++ b/docs/00-overview.md @@ -1,3 +1,43 @@ # Overview -TODO: CI/CD infrastructure overview +This repository contains **reusable GitHub Actions workflows** that are used by most of the services and libraries written in different languages across our organization. The actions standardize and streamline the **CI/CD** pipeline by allowing the common build, test and release logic to be a modular and shareable workflow. + +## The Available Reusable Actions + +### 1. build-and-upload.yaml + +This workflow builds and packages the services for a release. The workflow runs on our [self-hosted runner](03-debixbuilder.md) and is triggered on `pull-request` and `release` events. + +The workflow builds the service using `make build`, which is triggered for both events. However, if the event is `release` then we also perform the following steps after building the service: + +- Update the `service.yaml` to include the newest version number from the release +- Then zip up the binary and the `service.yaml` +- Finally, upload the package as a GitHub Release Asset. + +### 2. release.yaml + +This workflow is used to automate the versioning and changelog generation process by using [Release Please](https://github.com/googleapis/release-please). It doesn't run on our [self-hosted runner](03-debixbuilder.md), instead, it uses GitHub's default `ubuntu-latest` runner. + +It is triggered by a `workflow_call` from the repositories, which have a push to `main` as an event trigger themselves. The workflow also requires a `release_please_token` to be passed, which is stored as a Personal Access Token. + +It is responsible for: + +- Analyzing the commit messages to determine the version bump. It always looks at the highest priority commit (feat! → feat → fix) and updates the version by 1 increment, regardless of how many commits there have been. +- It automatically creates a **release pull request** which includes a version bump (e.g., from v0.3.1 to v0.3.2) and an updated `CHANGELOG.md`. + +Some additional details include: + +- The workflow sets `bump-minor-pre-major: true` which indicates that v0.1.0 → v0.2.0 indicates a breaking change, before the release of 1.0.0 +- The release pull request title shows the following pattern: **chore(main): release 1.2.5** + +### 3. test.yaml + +The workflow is responsible for running the tests of the service/library (if implemented) in its own Devcontainer. It also runs using the GitHub's default `ubuntu-latest` runner. + +It is triggered on every push and also requires a `gh_pat` to be passed, which is again stored as a Personal Access Token. The token is used to checkout the repository with submodule support. + +The main steps are: + +- Check out the repository with the submodule support +- Use the [Devcontainer Github Action](https://github.com/devcontainers/ci) to open the container of the associated service/library +- Inside the Devcontainer, run `make test` to run the unit tests (if implemented) \ No newline at end of file diff --git a/docs/01-why.md b/docs/01-why.md new file mode 100644 index 0000000..c21d382 --- /dev/null +++ b/docs/01-why.md @@ -0,0 +1,35 @@ +# Why we need CI/CD + +With the help of CI/CD (Continuous Integration and Continuous Development) we can **automate** the software development lifecycle and also **reduce human error**. All in all, it ensures that all changes are automatically built, tested, and packaged giving us the benefits of shipping reliable code faster. + +Some of the benefits due to using CI/CD: + +- **Automatic testing** +- **Consistent and automated release process** +- **Faster feedback** +- **Saving time** + +## What It Means to Build and Release Software + +Building and releasing software is the process of turning source code into a packaged and versioned product that is ready for distribution or deployment. + +We follow a structured approach to releasing software by using **conventional commits** and the [Release Please](https://github.com/googleapis/release-please) GitHub Action. + +### Conventional Commits + +All commit messages should follow the [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/) standard, which looks like: + +``` +feat: add dependent service +fix: correct service yaml value +chore: update dependencies +``` + +Using this format allows us to **automatically determine the next version number**. + +### Using Release Please + +The following are the steps of how Release Please automates the release process: + +- Scan commit history for conventional commits +- Creates a **release pull request** with a new version number and updated `CHANGELOG.md` diff --git a/docs/02-reusable.md b/docs/02-reusable.md new file mode 100644 index 0000000..dc07fb0 --- /dev/null +++ b/docs/02-reusable.md @@ -0,0 +1,114 @@ +# List of Repos and their build action + +The following is a comprehensive list of repositories and whether they have reusable or specific actions implemented: + +
| Repo | +Build and Upload | +Release | +Test | +
|---|---|---|---|
roverlib-go |
+ No Build | +Reusable | +Reusable | +
roverlib-c |
+ No Build | +Reusable | +Reusable | +
roverlib-python |
+ No Build | +Reusable | +Reusable | +
docs |
+ Its own action called fetch-and-deploy |
+ ||
rover |
+ Its own version of build | +Reusable | ++ |
imaging |
+ Reusable | +Reusable | +Reusable | +
actuator |
+ Reusable | +Reusable | +Reusable | +
controller |
+ Reusable | +Reusable | +Reusable | +
actuator-tester |
+ Reusable | +Reusable | +Reusable | +
energy |
+ Reusable | +Reusable | +Reusable | +
remote-control |
+ Reusable | +Reusable | +Reusable | +
transceiver |
+ Reusable | +Reusable | +Reusable | +
display |
+ Reusable | +Reusable | +Reusable | +
battery |
+ Reusable | +Reusable | +Reusable | +
distance |
+ Reusable | +Reusable | +Reusable | +
roverlib-c-sharp |
+ Old CI/CD configuration (needs to be updated to standard) + | ||
lidar |
+ Reusable | +Reusable | +Reusable | +