helloworld project sample for Typescript
#2150
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: Continuous Integration | |
| permissions: | |
| contents: read | |
| actions: write | |
| checks: write | |
| env: | |
| MISE_VERSION: v2025.12.1 | |
| MISE_NODE_VERIFY: no | |
| on: # rebuild any PRs and main branch changes | |
| pull_request: | |
| push: | |
| branches: | |
| - main | |
| jobs: | |
| test-omes: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repo | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 | |
| - uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6 | |
| with: | |
| go-version-file: "go.mod" | |
| - name: Install mise | |
| uses: jdx/mise-action@1648a7812b9aeae629881980618f079932869151 # v4 | |
| with: | |
| version: ${{ env.MISE_VERSION }} | |
| # Scope to just Python for project build tests | |
| - name: Install Tools | |
| run: | | |
| go run ./cmd/dev install python | |
| - name: Run tests | |
| run: | | |
| go test -v -race ./... 2>&1 | \ | |
| go run github.com/jstemmer/go-junit-report/v2@latest \ | |
| -set-exit-code -iocopy -out junit-omes.xml | |
| - name: Publish Test Results | |
| uses: mikepenz/action-junit-report@bccf2e31636835cf0874589931c4116687171386 # v6 | |
| if: failure() | |
| with: | |
| report_paths: "junit-omes.xml" | |
| check_name: "Omes Test Failures" | |
| detailed_summary: true | |
| check_annotations: false | |
| annotate_only: true | |
| skip_annotations: true | |
| check-worker: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| target: [go, java, python, ruby, typescript, dotnet, kitchensink-gen] | |
| include: | |
| - target: go | |
| tools: go | |
| - target: java | |
| tools: java go | |
| - target: python | |
| tools: python go | |
| - target: ruby | |
| tools: ruby go | |
| - target: typescript | |
| tools: rust go node protoc | |
| - target: dotnet | |
| tools: dotnet go | |
| - target: kitchensink-gen | |
| tools: rust go protoc | |
| steps: | |
| - name: Checkout repo | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 | |
| with: | |
| submodules: true | |
| - name: Install mise | |
| uses: jdx/mise-action@1648a7812b9aeae629881980618f079932869151 # v4 | |
| with: | |
| version: ${{ env.MISE_VERSION }} | |
| - name: Install Tools | |
| run: | | |
| go run ./cmd/dev install ${{ matrix.tools }} | |
| - name: Ensure rustfmt | |
| if: matrix.target == 'kitchensink-gen' | |
| run: | | |
| rustup component add rustfmt || echo "rustup not available, skipping rustfmt component add" | |
| - name: Add Go bin to PATH | |
| run: | | |
| echo "$(go env GOPATH)/bin" >> $GITHUB_PATH | |
| - name: Lint and format ${{ matrix.target }} worker | |
| run: | | |
| go run ./cmd/dev lint-and-format ${{ matrix.target }} | |
| - name: Check formatting | |
| run: | | |
| git diff --exit-code || (echo "${{ matrix.target }} worker has uncommitted formatting changes" && exit 1) | |
| - name: Test ${{ matrix.target }} worker | |
| run: | | |
| go run ./cmd/dev test ${{ matrix.target }} | |
| build-worker: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| sdk: [go, java, python, ruby, typescript, dotnet] | |
| steps: | |
| - name: Checkout repo | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 | |
| with: | |
| submodules: true | |
| - name: Build ${{ matrix.sdk }} worker image | |
| run: | | |
| go run ./cmd/dev build-worker-image \ | |
| --language ${{ matrix.sdk }} \ | |
| --tag-as-latest | |
| - name: Start ${{ matrix.sdk }} worker image | |
| run: | | |
| docker run \ | |
| --rm \ | |
| -i -p 10233:10233 omes:${{ matrix.sdk }}-latest \ | |
| --scenario workflow_with_single_noop_activity \ | |
| --log-level debug \ | |
| --language ${{ matrix.sdk }} \ | |
| --run-id ${{ github.run_id }} \ | |
| --embedded-server-address 0.0.0.0:10233 & | |
| - name: Wait for ${{ matrix.sdk }} worker image to start | |
| run: | | |
| timeout 30 bash -c 'until nc -z 127.0.0.1 10233; do sleep 1; done' || (echo "Server failed to start" && exit 1) | |
| - name: Start ${{ matrix.sdk }} worker image | |
| run: | | |
| go run ./cmd run-scenario \ | |
| --scenario workflow_with_single_noop_activity \ | |
| --log-level debug \ | |
| --server-address 127.0.0.1:10233 \ | |
| --run-id ${{ github.run_id }} \ | |
| --connect-timeout 1m \ | |
| --iterations 5 | |
| - name: Smoke test throughput_stress to confirm build is usable against ${{ matrix.sdk }} worker | |
| timeout-minutes: 10 | |
| run: | | |
| go run ./cmd run-scenario \ | |
| --scenario throughput_stress \ | |
| --log-level debug \ | |
| --server-address 127.0.0.1:10233 \ | |
| --run-id ${{ github.run_id }} \ | |
| --connect-timeout 1m \ | |
| --iterations 2 \ | |
| --timeout 5m \ | |
| --option internal-iterations=2 \ | |
| --option continue-as-new-after-iterations=1 \ | |
| --option sleep-time=1ms \ | |
| --option visibility-count-timeout=2m | |
| build-project: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - sdk: python | |
| project: helloworld | |
| dockerfile: dockerfiles/python.Dockerfile | |
| sdk_version_env: PYTHON_SDK_VERSION | |
| sdk_version_prefix: v | |
| - sdk: typescript | |
| project: helloworld | |
| dockerfile: dockerfiles/typescript.Dockerfile | |
| sdk_version_env: TYPESCRIPT_SDK_VERSION | |
| sdk_version_prefix: "" | |
| steps: | |
| - name: Checkout repo | |
| uses: actions/checkout@v4 | |
| with: | |
| submodules: true | |
| - name: Load versions | |
| run: | | |
| set -a && source versions.env && set +a | |
| printenv >> $GITHUB_ENV | |
| - name: Set ${{ matrix.sdk }} project image metadata | |
| run: | | |
| sdk_version_env=${{ matrix.sdk_version_env }} | |
| echo "PROJECT_IMAGE_SDK_VERSION=${{ matrix.sdk_version_prefix }}${!sdk_version_env}" >> "$GITHUB_ENV" | |
| echo "PROJECT_IMAGE_TAG=omes-project-${{ matrix.sdk }}-${{ matrix.project }}" >> "$GITHUB_ENV" | |
| echo "PROJECT_WORKER_CONTAINER=omes-project-${{ matrix.sdk }}-${{ matrix.project }}-worker" >> "$GITHUB_ENV" | |
| echo "PROJECT_RUN_ID=project-${{ github.run_id }}-${{ matrix.sdk }}-${{ matrix.project }}" >> "$GITHUB_ENV" | |
| - name: Build ${{ matrix.sdk }} ${{ matrix.project }} project image | |
| run: | | |
| docker build \ | |
| -f ${{ matrix.dockerfile }} \ | |
| --build-arg PROJECT_NAME=${{ matrix.project }} \ | |
| --build-arg SDK_VERSION=${PROJECT_IMAGE_SDK_VERSION} \ | |
| -t ${PROJECT_IMAGE_TAG} . | |
| - name: Create Docker network | |
| run: | | |
| docker network create omes-project-net | |
| - name: Start ${{ matrix.sdk }} ${{ matrix.project }} project worker image | |
| run: | | |
| docker run \ | |
| --rm \ | |
| --name ${PROJECT_WORKER_CONTAINER} \ | |
| --network omes-project-net \ | |
| -p 7233:7233 \ | |
| ${PROJECT_IMAGE_TAG} \ | |
| --run-id ${PROJECT_RUN_ID} \ | |
| --embedded-server-address 0.0.0.0:7233 & | |
| - name: Wait for embedded server | |
| run: | | |
| timeout 30 bash -c 'until nc -z 127.0.0.1 7233; do sleep 1; done' || (echo "Project worker failed to start" && exit 1) | |
| - name: Run project scenario against ${{ matrix.sdk }} ${{ matrix.project }} worker image | |
| run: | | |
| docker run --rm \ | |
| --network omes-project-net \ | |
| ${PROJECT_IMAGE_TAG} \ | |
| run-scenario \ | |
| --scenario project \ | |
| --run-id ${PROJECT_RUN_ID} \ | |
| --server-address ${PROJECT_WORKER_CONTAINER}:7233 \ | |
| --iterations 1 \ | |
| --connect-timeout 30s | |
| - name: Print project worker logs | |
| if: failure() | |
| run: | | |
| docker logs ${PROJECT_WORKER_CONTAINER} || true | |
| - name: Stop ${{ matrix.sdk }} ${{ matrix.project }} project worker image | |
| if: always() | |
| run: | | |
| docker stop ${PROJECT_WORKER_CONTAINER} || true | |
| - name: Remove Docker network | |
| if: always() | |
| run: | | |
| docker network rm omes-project-net || true | |
| test-kitchensink: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| sdk: [go, java, python, ruby, typescript, dotnet] | |
| include: | |
| - sdk: go | |
| tools: go | |
| - sdk: java | |
| tools: java go | |
| - sdk: python | |
| tools: python go | |
| - sdk: ruby | |
| tools: ruby go | |
| - sdk: typescript | |
| tools: node go | |
| - sdk: dotnet | |
| tools: dotnet go | |
| steps: | |
| - name: Checkout repo | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 | |
| with: | |
| submodules: true | |
| - name: Install mise | |
| uses: jdx/mise-action@1648a7812b9aeae629881980618f079932869151 # v4 | |
| with: | |
| version: ${{ env.MISE_VERSION }} | |
| - name: Install Tools | |
| run: | | |
| go run ./cmd/dev install ${{ matrix.tools }} | |
| - name: Ensure rustfmt | |
| if: matrix.target == 'kitchensink-gen' | |
| run: | | |
| rustup component add rustfmt || echo "rustup not available, skipping rustfmt component add" | |
| - name: Test Kitchensink ${{ matrix.sdk }} | |
| run: | | |
| SDK=${{ matrix.sdk }} go test -v -race ./loadgen -run TestKitchenSink 2>&1 | \ | |
| go run github.com/jstemmer/go-junit-report/v2@latest \ | |
| -set-exit-code -iocopy -out junit-kitchensink-${{ matrix.sdk }}.xml | |
| - name: Publish Kitchensink Test Results | |
| uses: mikepenz/action-junit-report@bccf2e31636835cf0874589931c4116687171386 # v6 | |
| if: failure() | |
| with: | |
| report_paths: "junit-kitchensink-${{ matrix.sdk }}.xml" | |
| check_name: "Kitchensink Test Failures (${{ matrix.sdk }})" | |
| detailed_summary: true | |
| check_annotations: false | |
| annotate_only: true | |
| skip_annotations: true | |
| build-ks-gen-and-ensure-protos-up-to-date: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repo | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 | |
| with: | |
| submodules: "true" | |
| - name: Install mise | |
| uses: jdx/mise-action@1648a7812b9aeae629881980618f079932869151 # v4 | |
| with: | |
| version: ${{ env.MISE_VERSION }} | |
| - name: Install Tools | |
| run: | | |
| go run ./cmd/dev install rust go protoc node buf | |
| - name: Add Go bin to PATH | |
| run: | | |
| echo "$(go env GOPATH)/bin" >> $GITHUB_PATH | |
| - name: Build proto | |
| run: | | |
| go run ./cmd/dev build-proto | |
| - name: Check diff | |
| run: | | |
| git config --global core.safecrlf false | |
| git diff > generator.diff | |
| git diff --exit-code | |
| - name: Upload generator diff | |
| uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7 | |
| if: always() | |
| with: | |
| name: generator-diff | |
| path: generator.diff | |
| if-no-files-found: ignore | |
| build-cli: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repo | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 | |
| with: | |
| submodules: true | |
| - uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6 | |
| with: | |
| go-version-file: "go.mod" | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@4d04d5d9486b7bd6fa91e7baf45bbb4f8b9deedd # v4 | |
| - name: Build CLI image | |
| run: | | |
| go run ./cmd/dev build-cli-image | |
| - name: Test CLI image | |
| run: | | |
| IMAGE_TAG=$(echo "$BUILT_IMAGE_TAGS" | cut -d';' -f1) | |
| docker run --rm --pull never $IMAGE_TAG --help | |
| docker run --rm --pull never $IMAGE_TAG list-scenarios | |
| docker run --rm --pull never --entrypoint /app/kitchen-sink-gen $IMAGE_TAG --help | |
| # env cannot be referenced in jobs.<job_id>.with.<with_id>, so we need a job to run before | |
| # to append a "v" to the version string | |
| prepare-for-docker-push: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| go-sdk-version: ${{ steps.set-output.outputs.go-sdk-version }} | |
| ts-sdk-version: ${{ steps.set-output.outputs.ts-sdk-version }} | |
| java-sdk-version: ${{ steps.set-output.outputs.java-sdk-version }} | |
| python-sdk-version: ${{ steps.set-output.outputs.python-sdk-version }} | |
| dotnet-sdk-version: ${{ steps.set-output.outputs.dotnet-sdk-version }} | |
| ruby-sdk-version: ${{ steps.set-output.outputs.ruby-sdk-version }} | |
| steps: | |
| - name: Checkout repo | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 | |
| - name: Load versions | |
| run: | | |
| set -a && source versions.env && set +a | |
| printenv >> $GITHUB_ENV | |
| - name: Set output variables to pass to docker YML | |
| id: set-output | |
| run: | | |
| echo "go-sdk-version=v${{ env.GO_SDK_VERSION }}" >> "$GITHUB_OUTPUT" | |
| echo "ts-sdk-version=v${{ env.TYPESCRIPT_SDK_VERSION }}" >> "$GITHUB_OUTPUT" | |
| echo "java-sdk-version=v${{ env.JAVA_SDK_VERSION }}" >> "$GITHUB_OUTPUT" | |
| echo "python-sdk-version=v${{ env.PYTHON_SDK_VERSION }}" >> "$GITHUB_OUTPUT" | |
| echo "dotnet-sdk-version=v${{ env.DOTNET_SDK_VERSION }}" >> "$GITHUB_OUTPUT" | |
| echo "ruby-sdk-version=v${{ env.RUBY_SDK_VERSION }}" >> "$GITHUB_OUTPUT" | |
| push-docker-images: | |
| needs: prepare-for-docker-push | |
| uses: ./.github/workflows/all-docker-images.yml | |
| secrets: inherit | |
| with: | |
| # Only images that are built from `main` are tagged as `latest`. | |
| # This ensures that internal systems can rely on the latest tag to be stable. | |
| as-latest: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }} | |
| do-push: true | |
| go-version: ${{ needs.prepare-for-docker-push.outputs.go-sdk-version }} | |
| ts-version: ${{ needs.prepare-for-docker-push.outputs.ts-sdk-version }} | |
| java-version: ${{ needs.prepare-for-docker-push.outputs.java-sdk-version }} | |
| py-version: ${{ needs.prepare-for-docker-push.outputs.python-sdk-version }} | |
| dotnet-version: ${{ needs.prepare-for-docker-push.outputs.dotnet-sdk-version }} | |
| ruby-version: ${{ needs.prepare-for-docker-push.outputs.ruby-sdk-version }} |