Skip to content

build/test

build/test #2

Workflow file for this run

name: build/test
on:
workflow_call:
push:
branches:
- main
pull_request:
branches:
- main
release:
types:
- published
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
go-version: ["1.20"]
os: ["linux"]
arch: ["amd64"]
steps:
- uses: actions/checkout@v3
- uses: benjlevesque/short-sha@v2.1
id: short-sha
- name: Set up golang ${{ matrix.go-version }}
uses: actions/setup-go@v4
with:
go-version: ${{ matrix.go-version }}
- name: build
run: |
make binary OS=${{ matrix.os }} ARCH=${{ matrix.arch }}
- name: lint
run: |
make lint
- name: Upload code coverage
uses: codecov/codecov-action@v3
- uses: actions/cache/save@v3
if: always()
with:
file: bin/stacker-bom-*
key: ${{ github.sha }}
release:
if: github.event_name == 'release' && github.event.action== 'published'
runs-on: ubuntu-latest
strategy:
matrix:
go-version: ["1.20"]
os: ["linux"]
arch: ["amd64"]
steps:
- uses: actions/checkout@v3
- name: Set up golang ${{ matrix.go-version }}
uses: actions/setup-go@v4
with:
go-version: ${{ matrix.go-version }}
- name: build
run: |
make binary RELEASE_TAG=${{ github.event.release.tag_name }} OS=${{ matrix.os }} ARCH=${{ matrix.arch }}
- uses: actions/cache/save@v3
if: always()
with:
path: bin/sbom
key: ${{ github.ref }}
- name: Publish artifacts on releases
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: bin/bom-*
tag: ${{ github.ref }}
overwrite: true
file_glob: true