Open-CMSIS-Pack/generator-bridge

View on GitHub
.github/workflows/build.yml

Summary

Maintainability
Test Coverage
name: Build

on:
  push:
    branches: [ main ]
  pull_request:
    paths:
      - '.github/workflows/build.yml'
      - '**/*.go'
      - 'makefile'
      - 'go.mod'
      - 'go.sum'

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

permissions:
  contents: read

jobs:
  build:
    permissions:
      actions: read  # for github/codeql-action/init to get workflow details
      contents: read  # for actions/checkout to fetch code
      security-events: write  # for github/codeql-action/analyze to upload SARIF results
    strategy:
      matrix:
        goos: [windows, linux, darwin]
        arch: [amd64, arm64]

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

    steps:
      - name: Harden Runner
        uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1
        with:
          egress-policy: audit

      - name: Check out repository code
        uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
        with:
          fetch-depth: 0

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

      - name: Initialize CodeQL
        uses: github/codeql-action/init@662472033e021d55d94146f66f6058822b0b39fd # v3.27.0
        with:
          languages: go
          queries: security-and-quality

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

      - name: Upload binary
        uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
        with:
          name: cbridge-${{ matrix.goos }}-${{ matrix.arch }}
          path: build/cbridge*
          retention-days: 1

      - name: Perform CodeQL Analysis
        uses: github/codeql-action/analyze@662472033e021d55d94146f66f6058822b0b39fd # v3.27.0