48 lines
1.2 KiB
YAML
48 lines
1.2 KiB
YAML
name: Build
|
|
on:
|
|
workflow_call:
|
|
pull_request:
|
|
push:
|
|
branches:
|
|
- main
|
|
- release/**
|
|
|
|
# This workflow makes amd64 and arm64 binaries for macOS and Linux.
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
matrix:
|
|
arch: [amd64, arm64]
|
|
targetos: [darwin, linux]
|
|
name: price-feeder ${{ matrix.arch }} for ${{ matrix.targetos }}
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- name: Cache binaries
|
|
id: cache-binaries
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: ./cmd
|
|
key: price-feeder-${{ matrix.targetos }}-${{ matrix.arch }}
|
|
- uses: technote-space/get-diff-action@v6.1.2
|
|
with:
|
|
PATTERNS: |
|
|
**/**.go
|
|
go.mod
|
|
go.sum
|
|
- name: Setup go
|
|
if: steps.cache-binaries.outputs.cache-hit != 'true' && env.GIT_DIFF
|
|
uses: actions/setup-go@v5
|
|
with:
|
|
go-version: 1.21.1
|
|
cache: true
|
|
env:
|
|
GOOS: ${{ matrix.targetos }}
|
|
GOARCH: ${{ matrix.arch }}
|
|
- name: Compile
|
|
if: steps.cache-binaries.outputs.cache-hit != 'true' && env.GIT_DIFF
|
|
run: |
|
|
go mod download
|
|
cd cmd
|
|
go build .
|