Skip to content

Fix max timeout

Fix max timeout #1924

Workflow file for this run

name: ci
on:
push:
branches:
- main
paths-ignore:
- "**.md"
- LICENSE
- "docker-compose.yml"
- ".github/ISSUE_TEMPLATE/*.yml"
- ".github/dependabot.yml"
- ".github/release-drafter.yml"
pull_request:
branches:
- "*"
paths-ignore:
- "**.md"
- LICENSE
- "docker-compose.dev.yml"
- ".github/ISSUE_TEMPLATE/*.yml"
- ".github/dependabot.yml"
- ".github/release-drafter.yml"
jobs:
ci:
strategy:
matrix:
go-version: [1.25.x]
postgres-version: [15, 16]
runs-on: ubuntu-24.04
services:
postgres:
image: postgres:${{ matrix.postgres-version }}
env:
POSTGRES_DB: tork
POSTGRES_PASSWORD: tork
POSTGRES_USER: tork
POSTGRES_PORT: 5432
ports:
- 5432:5432
# Set health checks to wait until postgres has started
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
rabbitmq:
image: rabbitmq:3-management
ports:
- 5672:5672
- 15672:15672
steps:
- name: Check out repository code
uses: actions/checkout@v6
- name: Set up Go
uses: actions/setup-go@v6
with:
go-version: '${{ matrix.go-version }}'
- name: Build Tork
run: |
go build -o tork cmd/main.go
- name: Run DB migration
run: |
TORK_CONFIG=configs/config.ci.toml ./tork migration
- name: Test Tork
run: |
# start tork
./tork run standalone &
PID=$!
# give it a second to start
sleep 1
# perform a health check
STATUS=$(curl -f -s http://localhost:8000/health | jq -r .status)
echo "STATUS: $STATUS"
if [ "$STATUS" != "UP" ]; then
exit 1
fi
# submit a simple job
JOB_ID=$(curl -s -X POST --data-binary @examples/hello.yaml \
-H "Content-type: text/yaml" http://localhost:8000/jobs | jq -r .id)
for i in {1..5}
do
JOB_STATE=$(curl -s http://localhost:8000/jobs/$JOB_ID | jq -r .state)
echo "$JOB_ID $JOB_STATE"
if [ "$JOB_STATE" == "COMPLETED" ]; then
break
fi
sleep 0.5
done
# submit a simple job
JOB_ID=$(curl -s -X POST --data-binary @examples/hello.yaml \
-H "Content-type: text/yaml" http://localhost:8000/jobs | jq -r .id)
for i in {1..10}
do
JOB_STATE=$(curl -s http://localhost:8000/jobs/$JOB_ID | jq -r .state)
echo "$JOB_ID $JOB_STATE"
if [ "$JOB_STATE" == "COMPLETED" ]; then
break
fi
sleep 0.5
done
if [ "$JOB_STATE" != "COMPLETED" ]; then
exit 1
fi
JOB_RESULT=$(curl -s http://localhost:8000/jobs/$JOB_ID | jq -r .result)
if [ "$JOB_RESULT" != "hello world" ]; then
echo "invalid job result"
exit 1
fi
# terminate Tork
kill -9 $PID
- name: Run tests
run: go test ./... -v -race