Skip to content

Adding new APIs

Adding new APIs #104

Workflow file for this run

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
}
}