examples: add delayed_execution example #204
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
# This workflow will build a golang project | |
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-go | |
name: Go | |
on: | |
push: | |
branches: [ "main" ] | |
pull_request: | |
branches: [ "main" ] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
services: | |
postgres: | |
image: postgres:16 | |
env: | |
POSTGRES_USER: postgres | |
POSTGRES_PASSWORD: postgres | |
POSTGRES_DB: postgres | |
options: >- | |
--health-cmd "pg_isready -U user -d testdb" | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
ports: | |
- 5432:5432 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: '1.24' | |
- name: Build | |
run: go build ./... | |
- name: Test | |
run: | | |
until pg_isready -h 127.0.0.1 -p 5432 -U user; do | |
echo "Waiting for Postgres..."; | |
sleep 3; | |
done | |
GOEXPERIMENT=synctest GODEBUG=asynctimerchan=0 go test -v ./... | |
- name: Examples | |
run: | | |
set -e # Exit on any error | |
for file in examples/*.go; do | |
if [[ "$file" == "examples/setup.go" ]]; then | |
continue | |
fi | |
echo "Running $file" | |
go run "$file" examples/setup.go | |
echo "----------------------" | |
echo | |
done |