Files
magistrala/.github/workflows/lint-and-build.yaml
T
Dušan Borovčanin ef5c253c51 SMQ-3399 - Unify Magistrala and SuperMQ (#3400)
Signed-off-by: nyagamunene <stevenyaga2014@gmail.com>
Signed-off-by: dusan <borovcanindusan1@gmail.com>
Co-authored-by: Steve Munene <stevenyaga2014@gmail.com>
2026-04-01 09:55:11 +02:00

84 lines
2.1 KiB
YAML

# Copyright (c) Abstract Machines
# SPDX-License-Identifier: Apache-2.0
name: Lint and Build
on:
workflow_call:
jobs:
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Get Go version from go.mod
id: go-version
run: echo "version=$(grep '^go ' go.mod | awk '{print $2}')" >> $GITHUB_OUTPUT
- name: Setup Go
uses: actions/setup-go@v6
with:
go-version: ${{ steps.go-version.outputs.version }}
cache-dependency-path: "go.sum"
- name: Run linters
uses: golangci/golangci-lint-action@v9.2.0
with:
version: v2.10.1
args: --config ./tools/config/.golangci.yaml
build:
name: Build All Binaries
runs-on: ubuntu-latest
needs: lint
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Get Go version from go.mod
id: go-version
run: echo "version=$(grep '^go ' go.mod | awk '{print $2}')" >> $GITHUB_OUTPUT
- name: Setup Go
uses: actions/setup-go@v6
with:
go-version: ${{ steps.go-version.outputs.version }}
cache-dependency-path: "go.sum"
- name: Build all binaries
run: |
make all -j $(nproc)
compile-check:
name: Compile Check ${{ matrix.variant.name }}
runs-on: ubuntu-latest
needs: lint
strategy:
fail-fast: true
matrix:
variant:
- name: redis
env: MG_ES_TYPE=es_redis
target: fluxmq
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Get Go version from go.mod
id: go-version
run: echo "version=$(grep '^go ' go.mod | awk '{print $2}')" >> $GITHUB_OUTPUT
- name: Setup Go
uses: actions/setup-go@v6
with:
go-version: ${{ steps.go-version.outputs.version }}
cache-dependency-path: "go.sum"
- name: Compile check for ${{ matrix.variant.name }}
run: |
${{ matrix.variant.env }} make ${{ matrix.variant.target }}