tractusx-quality-checks

command module
v0.9.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 3, 2023 License: Apache-2.0 Imports: 1 Imported by: 0

README

Eclipse Tractus-X quality checks

The Eclipse Tractus-X quality checks is an automation effort to ensure basic quality alignment across Tractus-X OSS products.

The checks will be aligned with the Tractus-X release guidelines and are available as library to use in multiple usecases. These could be:

  • PR checks to test, if contributions follow release guidelines
  • Dashboards to show overall alignment of products
  • Binaries to check code locally (manual run, pre-commit hooks, ...)
  • ...

Local build

If you want to build the command locally, you just need Golang version 1.20 and run go build on the root level of this repository.

Git pre-commit hook

It is possible to add quality checks as git pre-commit hook in the repository which will run checks triggered by git commit command. To achieve that please follow below steps:

  1. Download latest version of the tractusx-quality-checks tool for your platform under Asset section at https://github.com/eclipse-tractusx/tractusx-quality-checks/releases/latest
  2. Add executable permission if necessary and copy the binary (changing file name to tractusx-quality-checks) into one of the $PATH location depending on your OS.
macOS example:
$ chmod +x tractusx-quality-checks-0.8.0-darwin-arm64
$ sudo cp tractusx-quality-checks-0.8.0-darwin-arm64 /usr/local/bin/tractusx-quality-checks
  1. Inside your repo copy below to .git/hooks/pre-commit:
    #!/usr/bin/env bash
    # ^ Note the above "shebang" line. This says "This is an executable shell script"
    # Name this script "pre-commit" and place it in the ".git/hooks/" directory

    # Exit immediately with that command's exit status if the command fails
    set -eo pipefail

    # Run Tractus-X quality checks
    tractusx-quality-checks checkLocal
    echo -e "\n\n--- TRG checks passed! ---\n\n"
  1. Make .git/hooks/pre-commit executable.
  2. Pre-commit setup is complete and initiates checks each time git commit is ran.

Custom GitHub action

The tractusx-quality-checks can be run as a GitHub action. This action is build as a composite action. This approach was chosen, because it allows us to run our Golang code without the need to maintain a container image for it.

...
jobs:
  quality-check:
    steps:
      # Checkout your repo, since the quality action is working on a local copy
      - uses: actions/checkout@v3

      # Setup go as a prerequisite for the quality-check action
      - name: Set up Go
        uses: actions/setup-go@v4
        with:
          go-version: 1.20

      # Use the quality check aciton
      - name: Run quality check command
        uses: eclipse-tractusx/tractusx-quality-checks@v1

Documentation

Overview

******************************************************************************

  • Copyright (c) 2023 Contributors to the Eclipse Foundation *
  • See the NOTICE file(s) distributed with this work for additional
  • information regarding copyright ownership. *
  • This program and the accompanying materials are made available under the
  • terms of the Apache License, Version 2.0 which is available at
  • https://www.apache.org/licenses/LICENSE-2.0. *
  • Unless required by applicable law or agreed to in writing, software
  • distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
  • WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
  • License for the specific language governing permissions and limitations
  • under the License. *
  • SPDX-License-Identifier: Apache-2.0 *****************************************************************************

Directories

Path Synopsis
pkg

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL