Repository navigation
59 lines (56 loc) · 1.8 KB
/
Copy pathstack-go.yml
File metadata and controls
59 lines (56 loc) · 1.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
name: stack-go
on:
workflow_call:
inputs:
go-versions:
description: JSON list of Go versions for actions/setup-go ("stable", "1.24")
type: string
default: '["stable"]'
os:
description: JSON list of runner labels
type: string
default: '["ubuntu-latest"]'
commands:
description: JSON list of shell commands run in order
type: string
default: '["go vet ./...","go test ./..."]'
working-directory:
description: Directory holding go.mod
type: string
default: .
permissions:
contents: read
jobs:
go:
name: go ${{ matrix.go }} (${{ matrix.os }})
strategy:
fail-fast: false
matrix:
os: ${{ fromJSON(inputs.os) }}
go: ${{ fromJSON(inputs.go-versions) }}
runs-on: ${{ matrix.os }}
permissions:
contents: read
defaults:
run:
shell: bash
working-directory: ${{ inputs.working-directory }}
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
with:
go-version: ${{ matrix.go }}
# modules without dependencies have no go.sum to key the cache on
cache: ${{ hashFiles(format('{0}/go.sum', inputs.working-directory)) != '' }}
cache-dependency-path: ${{ inputs.working-directory }}/go.sum
- name: Run checks
env:
COMMANDS: ${{ inputs.commands }}
run: |
node -e 'for (const c of JSON.parse(process.env.COMMANDS)) console.log(c)' | while IFS= read -r command; do
echo "::group::$command"
bash -c "$command" </dev/null
echo "::endgroup::"
done