-
Notifications
You must be signed in to change notification settings - Fork 24
106 lines (103 loc) · 2.82 KB
/
ci.yml
File metadata and controls
106 lines (103 loc) · 2.82 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
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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
name: CI
on:
push:
paths-ignore: ['**/*.md']
pull_request:
paths-ignore: ['**/*.md']
workflow_dispatch:
jobs:
build-go-mod-project:
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
fail-fast: false
runs-on: ${{ matrix.os }}
env:
TEST_PROJECT: 'go-webui-project'
defaults:
run:
shell: bash
steps:
- uses: actions/checkout@v4
with:
submodules: true
path: go-webui
- uses: maxim-lobanov/setup-xcode@v1
if: runner.os == 'macOS'
with:
xcode-version: latest-stable
- uses: actions/setup-go@v5
if: runner.os == 'macOS'
with:
go-version: '1.21'
- name: Setup test project
run: |
mkdir $TEST_PROJECT && cd $TEST_PROJECT
go mod init $TEST_PROJECT && ls -lh
cp ../go-webui/examples/call_go_from_js.go ./main.go
- name: Setup WebUI library
run: |
cd $TEST_PROJECT
sh ../go-webui/setup.sh
sh ../go-webui/setup.sh # TODO: investigate why a second execution is required here.
- name: Build
run: |
cd $TEST_PROJECT
go build main.go
build-examples:
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
fail-fast: false
runs-on: ${{ matrix.os }}
env:
TEST_PROJECT: 'go-webui-project'
steps:
- uses: actions/checkout@v4
with:
submodules: true
- uses: maxim-lobanov/setup-xcode@v1
if: runner.os == 'macOS'
with:
xcode-version: latest-stable
- uses: actions/setup-go@v5
with:
go-version: '1.21'
- name: Build examples
if: runner.os != 'Windows'
run: |
cd examples
for path in $(find * -maxdepth 0); do
if [[ -d "$path" ]]; then
cd $path
cmd="go build main.go"
elif [[ "$path" == *.go ]]; then
cmd="go build $path"
fi
if [[ -n $cmd ]]; then
echo "Building example \`$path\`"
eval "$cmd"
if [[ $? -ne 0 ]]; then
exit_code=1
fi
fi
done
exit $exit_code
- name: Build examples (Windows)
if: runner.os == 'Windows'
run: |
cd examples
$examplePaths = Get-ChildItem -Depth 0
foreach ($path in $examplePaths) {
if ($path.PSIsContainer) {
cd $path
$cmd="go build main.go"
}
elseif ($path -like "*.go") {
$cmd="go build $path"
}
if ($cmd -ne $null) {
Write-Output "Building example '$path'"
Invoke-Expression $cmd
}
}