Fix infinite wait #120
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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: | |
| 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 | |
| # The WebUI C library ships inside the go-webui module (v2/webui subtree), | |
| # so consuming the checkout is all the setup that is needed. | |
| go mod edit -replace=github.com/webui-dev/go-webui/v2=../go-webui/v2 | |
| go mod tidy | |
| - 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 | |
| - 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 | |
| } | |
| } |