-
Notifications
You must be signed in to change notification settings - Fork 13
88 lines (83 loc) · 2.19 KB
/
ci-sdk-go-build.yml
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
name: ci-sdk-go-build
on:
pull_request:
types:
- opened
- synchronize
- reopened
- ready_for_review
paths:
- sdk/go/**
permissions:
contents: read
jobs:
get-dirs:
if: github.event_name == 'pull_request'
name: search
runs-on: ubuntu-latest
outputs:
tools_dirs: ${{ steps.get-tools-dirs.outputs.dirs }}
examples_dirs: ${{ steps.get-examples-dirs.outputs.dirs }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Find tools
id: get-tools-dirs
run: >
echo "dirs=$(
find ./sdk/go/tools -mindepth 1 -maxdepth 1 -type d |
sed 's|^\./||' |
jq -Rsc 'split("\n")[:-1]'
)" >> ${GITHUB_OUTPUT}
- name: Find examples
id: get-examples-dirs
run: >
echo "dirs=$(
find ./sdk/go/examples -mindepth 1 -maxdepth 1 -type d |
sed 's|^\./||' |
jq -Rsc 'split("\n")[:-1]'
)" >> ${GITHUB_OUTPUT}
sdk-go-build-tools:
needs: get-dirs
if: github.event_name == 'pull_request'
name: build
runs-on: ubuntu-latest
strategy:
matrix:
dir: ${{ fromJson(needs.get-dirs.outputs.tools_dirs) }}
defaults:
run:
working-directory: ${{ matrix.dir }}
steps:
- uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: 1.23.4
cache-dependency-path: ./sdk/go/go.sum
- name: Build Program
run: go build .
sdk-go-build-examples:
needs: get-dirs
if: github.event_name == 'pull_request'
name: build
runs-on: ubuntu-latest
strategy:
matrix:
dir: ${{ fromJson(needs.get-dirs.outputs.examples_dirs) }}
defaults:
run:
working-directory: ${{ matrix.dir }}
steps:
- uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: 1.23.4
cache-dependency-path: "${{ matrix.dir }}/go.sum"
- name: Setup TinyGo
uses: acifani/setup-tinygo@v2
with:
tinygo-version: 0.35.0
- name: Build Program
run: ./build.sh