Open-CMSIS-Pack/cpackget

View on GitHub
.github/workflows/build.yml

Summary

Maintainability
Test Coverage
name: Build

on:
  workflow_dispatch:
  push:
    branches:
      - main
  pull_request:
    paths:
      - .github/workflows/build.yml
      - cmd/**/*.go
      - makefile
      - go.mod
      - go.sum

concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true

jobs:
  build:
    strategy:
      matrix:
        goos: [windows, linux, darwin]
        arch: [amd64, arm64]

    name: "${{ matrix.goos }} | ${{ matrix.arch }}"
    runs-on: ubuntu-latest

    steps:
      - name: Check out repository code
        uses: actions/checkout@v4
        with:
          fetch-depth: 0

      - name: Install Go
        uses: actions/setup-go@v5
        with:
          go-version-file: go.mod
          check-latest: true

      - name: Build
        run: |
          make OS=${{ matrix.goos }} ARCH=${{ matrix.arch }} build

      - name: Upload binary
        uses: actions/upload-artifact@v4
        with:
          name: cpackget-${{ matrix.goos }}-${{ matrix.arch }}
          path: build/cpackget*
          retention-days: 7