generated from keploy/template
-
Notifications
You must be signed in to change notification settings - Fork 75
50 lines (40 loc) · 1.12 KB
/
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
name: Build Go Sample Projects
on:
push:
branches:
- main
pull_request:
types: [opened, edited, synchronize, reopened]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: '1.22'
- name: Build projects
run: |
#!/bin/bash
cd /home/runner/work/samples-go/samples-go
for dir in */; do
if [ -d "$dir" ] && [ -f "${dir}go.mod" ]; then
echo "Building project in $dir"
# Change to the project directory
cd "$dir" || continue
# Build the project
if go build -o app; then
echo "Successfully built $dir"
else
echo "Failed to build $dir" >&2
exit 1
fi
# Return to the base directory
cd ..
else
echo "Skipping $dir, no go.mod file found."
fi
done
echo "All projects processed."