mirror of
https://github.com/hatchet-dev/hatchet.git
synced 2026-01-06 08:49:53 -06:00
67
.github/workflows/sdk-python.yml
vendored
67
.github/workflows/sdk-python.yml
vendored
@@ -58,40 +58,95 @@ jobs:
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Run Hatchet Engine
|
||||
- name: Install Protoc
|
||||
uses: arduino/setup-protoc@v3
|
||||
with:
|
||||
version: '25.1'
|
||||
|
||||
- name: Install Task
|
||||
uses: arduino/setup-task@v2
|
||||
|
||||
- name: Setup Go
|
||||
uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: '1.21'
|
||||
|
||||
- name: Start Docker dependencies
|
||||
working-directory: .
|
||||
run: docker compose up -d
|
||||
|
||||
- name: Generate
|
||||
working-directory: .
|
||||
run: |
|
||||
export DATABASE_URL="postgresql://hatchet:hatchet@127.0.0.1:5431/hatchet"
|
||||
go run ./cmd/hatchet-migrate
|
||||
task generate-go
|
||||
|
||||
- name: Setup
|
||||
working-directory: .
|
||||
run: |
|
||||
export SEED_DEVELOPMENT=true
|
||||
export SERVER_PORT=8080
|
||||
export SERVER_URL=http://localhost:8080
|
||||
export SERVER_AUTH_COOKIE_DOMAIN=localhost
|
||||
export SERVER_AUTH_COOKIE_INSECURE=true
|
||||
|
||||
go run ./cmd/hatchet-admin quickstart
|
||||
|
||||
go run ./cmd/hatchet-engine --config ./generated/ > engine.log 2>&1 &
|
||||
go run ./cmd/hatchet-api --config ./generated/ > api.log 2>&1 &
|
||||
|
||||
sleep 30
|
||||
- name: Set up Python ${{ matrix.python-version }}
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: ${{ matrix.python-version }}
|
||||
|
||||
- name: Display Python version
|
||||
run: python -c "import sys; print(sys.version)"
|
||||
|
||||
- name: Install Poetry
|
||||
uses: snok/install-poetry@v1
|
||||
with:
|
||||
version: 1.5.1
|
||||
virtualenvs-create: true
|
||||
virtualenvs-in-project: true
|
||||
|
||||
- name: Install dependencies
|
||||
run: poetry install --no-interaction --all-extras
|
||||
|
||||
- name: Generate Env File
|
||||
working-directory: .
|
||||
run: |
|
||||
cat <<EOF > .env
|
||||
HATCHET_CLIENT_TOKEN="$(docker compose run --no-deps setup-config /hatchet/hatchet-admin token create --config /hatchet/config --tenant-id 707d0855-80ab-4e1f-a156-f1c4546cbf52 | xargs)"
|
||||
HATCHET_CLIENT_TLS_STRATEGY=none
|
||||
EOF
|
||||
echo "HATCHET_CLIENT_TOKEN=$(go run ./cmd/hatchet-admin token create --config ./generated/ --tenant-id 707d0855-80ab-4e1f-a156-f1c4546cbf52)" >> $GITHUB_ENV
|
||||
echo "HATCHET_CLIENT_TLS_ROOT_CA_FILE=../../certs/ca.cert" >> $GITHUB_ENV
|
||||
echo "HATCHET_CLIENT_WORKER_HEALTHCHECK_ENABLED=True" >> $GITHUB_ENV
|
||||
|
||||
- name: Set HATCHET_CLIENT_NAMESPACE
|
||||
run: |
|
||||
PYTHON_VERSION=$(python -c "import sys; print(f'py{sys.version_info.major}{sys.version_info.minor}')")
|
||||
SHORT_SHA=$(git rev-parse --short HEAD)
|
||||
echo "HATCHET_CLIENT_NAMESPACE=${PYTHON_VERSION}-${SHORT_SHA}" >> $GITHUB_ENV
|
||||
|
||||
- name: Run pytest
|
||||
run: |
|
||||
echo "Using HATCHET_CLIENT_NAMESPACE: $HATCHET_CLIENT_NAMESPACE"
|
||||
poetry run pytest -s -vvv --maxfail=5 --timeout=180 --capture=no
|
||||
|
||||
poetry run pytest -s -vvv --maxfail=5 --timeout=180 --capture=no -n 5
|
||||
|
||||
- name: Upload engine logs
|
||||
if: always()
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: $HATCHET_CLIENT_NAMESPACE-engine-logs
|
||||
path: $HATCHET_CLIENT_NAMESPACE-engine.log
|
||||
|
||||
- name: Upload API logs
|
||||
if: always()
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: $HATCHET_CLIENT_NAMESPACE-api-logs
|
||||
path: $HATCHET_CLIENT_NAMESPACE-api.log
|
||||
|
||||
publish:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
54
.github/workflows/sdk-typescript-manual-publish.yml
vendored
Normal file
54
.github/workflows/sdk-typescript-manual-publish.yml
vendored
Normal file
@@ -0,0 +1,54 @@
|
||||
name: typescript-manual-publish
|
||||
on:
|
||||
workflow_dispatch:
|
||||
|
||||
defaults:
|
||||
run:
|
||||
working-directory: ./sdks/typescript
|
||||
|
||||
jobs:
|
||||
publish:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: recursive
|
||||
|
||||
- name: Install pnpm
|
||||
run: npm install -g pnpm@8
|
||||
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: "20.x"
|
||||
registry-url: "https://registry.npmjs.org"
|
||||
|
||||
- name: Get pnpm store directory
|
||||
shell: bash
|
||||
run: |
|
||||
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
|
||||
|
||||
- name: Setup pnpm cache
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: ${{ env.STORE_PATH }}
|
||||
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('pnpm-lock.yaml') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-pnpm-store-
|
||||
|
||||
- name: Install dependencies
|
||||
run: pnpm install
|
||||
|
||||
- name: Build and Publish SDK
|
||||
run: |
|
||||
VERSION=$(jq '.version' package.json)
|
||||
|
||||
## If the version contains `alpha`, it's an alpha version
|
||||
## and we should tag it as such.=
|
||||
if [[ "$VERSION" == *alpha* ]]; then
|
||||
pnpm publish:ci:alpha
|
||||
else
|
||||
pnpm publish:ci
|
||||
fi
|
||||
env:
|
||||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
||||
207
.github/workflows/sdk-typescript.yml
vendored
Normal file
207
.github/workflows/sdk-typescript.yml
vendored
Normal file
@@ -0,0 +1,207 @@
|
||||
name: typescript
|
||||
on:
|
||||
pull_request:
|
||||
paths:
|
||||
- 'sdks/typescript/**'
|
||||
- '.github/**'
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
paths:
|
||||
- 'sdks/typescript/**'
|
||||
- '.github/**'
|
||||
|
||||
defaults:
|
||||
run:
|
||||
working-directory: ./sdks/typescript
|
||||
|
||||
jobs:
|
||||
lint:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: recursive
|
||||
|
||||
- name: Install pnpm
|
||||
run: npm install -g pnpm@8
|
||||
|
||||
- name: Get pnpm store directory
|
||||
shell: bash
|
||||
run: |
|
||||
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
|
||||
|
||||
- name: Setup pnpm cache
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: ${{ env.STORE_PATH }}
|
||||
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('pnpm-lock.yaml') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-pnpm-store-
|
||||
|
||||
- name: Install dependencies
|
||||
run: pnpm install
|
||||
|
||||
- name: Lint
|
||||
run: pnpm lint:check
|
||||
|
||||
test-unit:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: recursive
|
||||
|
||||
- name: Install pnpm
|
||||
run: npm install -g pnpm@8
|
||||
|
||||
- name: Get pnpm store directory
|
||||
shell: bash
|
||||
run: |
|
||||
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
|
||||
|
||||
- name: Setup pnpm cache
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: ${{ env.STORE_PATH }}
|
||||
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('pnpm-lock.yaml') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-pnpm-store-
|
||||
|
||||
- name: Install dependencies
|
||||
run: pnpm install
|
||||
|
||||
- name: Unit tests
|
||||
run: pnpm test:unit
|
||||
|
||||
test-e2e:
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 10
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
- name: Sync Submodule Branch
|
||||
shell: bash
|
||||
run: |
|
||||
./branch-sync.sh
|
||||
- name: Install Protoc
|
||||
uses: arduino/setup-protoc@v3
|
||||
with:
|
||||
version: '25.1'
|
||||
|
||||
- name: Install Task
|
||||
uses: arduino/setup-task@v2
|
||||
|
||||
- name: Setup Go
|
||||
uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: '1.21'
|
||||
|
||||
- name: Install pnpm
|
||||
run: npm install -g pnpm@8
|
||||
|
||||
- name: Install Atlas
|
||||
run: |
|
||||
curl -sSf https://atlasgo.sh | sh
|
||||
|
||||
- name: Get pnpm store directory
|
||||
shell: bash
|
||||
run: |
|
||||
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
|
||||
|
||||
- name: Setup pnpm cache
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: ${{ env.STORE_PATH }}
|
||||
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('pnpm-lock.yaml') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-pnpm-store-
|
||||
|
||||
- name: Compose
|
||||
working-directory: .
|
||||
run: docker compose up -d
|
||||
|
||||
- name: Install dependencies
|
||||
run: pnpm install
|
||||
|
||||
- name: Generate
|
||||
working-directory: .
|
||||
run: |
|
||||
export DATABASE_URL="postgresql://hatchet:hatchet@127.0.0.1:5431/hatchet"
|
||||
go run ./cmd/hatchet-migrate
|
||||
task generate-go
|
||||
|
||||
- name: Setup
|
||||
working-directory: .
|
||||
run: |
|
||||
export SEED_DEVELOPMENT=true
|
||||
export SERVER_PORT=8080
|
||||
export SERVER_URL=http://localhost:8080
|
||||
export SERVER_AUTH_COOKIE_DOMAIN=localhost
|
||||
export SERVER_AUTH_COOKIE_INSECURE=true
|
||||
|
||||
go run ./cmd/hatchet-admin quickstart
|
||||
|
||||
go run ./cmd/hatchet-engine --config ./generated/ &
|
||||
go run ./cmd/hatchet-api --config ./generated/ &
|
||||
|
||||
sleep 30
|
||||
- name: E2E tests
|
||||
run: |
|
||||
cd ../..
|
||||
export HATCHET_CLIENT_TOKEN="$(go run ./cmd/hatchet-admin token create --config ./generated/ --tenant-id 707d0855-80ab-4e1f-a156-f1c4546cbf52)"
|
||||
|
||||
cd sdks/typescript
|
||||
export HATCHET_CLIENT_TLS_ROOT_CA_FILE=../../certs/ca.cert
|
||||
export NODE_TLS_REJECT_UNAUTHORIZED=0
|
||||
pnpm test:e2e
|
||||
|
||||
publish:
|
||||
runs-on: ubuntu-latest
|
||||
needs: [lint, test-unit, test-e2e]
|
||||
if: github.ref == 'refs/heads/main'
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: recursive
|
||||
|
||||
- name: Install pnpm
|
||||
run: npm install -g pnpm@8
|
||||
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: "20.x"
|
||||
registry-url: "https://registry.npmjs.org"
|
||||
|
||||
- name: Get pnpm store directory
|
||||
shell: bash
|
||||
run: |
|
||||
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
|
||||
|
||||
- name: Setup pnpm cache
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: ${{ env.STORE_PATH }}
|
||||
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('pnpm-lock.yaml') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-pnpm-store-
|
||||
|
||||
- name: Install dependencies
|
||||
run: pnpm install
|
||||
|
||||
- name: Build and Publish SDK
|
||||
run: |
|
||||
VERSION=$(jq '.version' package.json)
|
||||
|
||||
## If the version contains `alpha`, it's an alpha version
|
||||
## and we should tag it as such.=
|
||||
if [[ "$VERSION" == *alpha* ]]; then
|
||||
pnpm publish:ci:alpha
|
||||
else
|
||||
pnpm publish:ci
|
||||
fi
|
||||
env:
|
||||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
||||
Reference in New Issue
Block a user