mirror of
https://github.com/absmach/magistrala.git
synced 2026-06-23 04:10:28 +00:00
ef5c253c51
Signed-off-by: nyagamunene <stevenyaga2014@gmail.com> Signed-off-by: dusan <borovcanindusan1@gmail.com> Co-authored-by: Steve Munene <stevenyaga2014@gmail.com>
84 lines
2.1 KiB
YAML
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 }}
|