feat: speakeasy ci #3
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: Test Composite Action | |
| on: | |
| pull_request: | |
| workflow_dispatch: | |
| jobs: | |
| test-run-workflow-pr-mode: | |
| name: "Test: run-workflow (PR mode)" | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Run action in PR mode | |
| id: run | |
| uses: ./ | |
| with: | |
| github_access_token: ${{ secrets.GITHUB_TOKEN }} | |
| speakeasy_api_key: ${{ secrets.SPEAKEASY_API_KEY }} | |
| action: run-workflow | |
| mode: pr | |
| force: "true" | |
| github_repository: speakeasy-api/sdk-generation-action-test-repo | |
| env: | |
| INPUT_DEBUG: "true" | |
| - name: Verify outputs | |
| env: | |
| BRANCH_NAME: ${{ steps.run.outputs.branch_name }} | |
| PYTHON_REGENERATED: ${{ steps.run.outputs.python_regenerated }} | |
| TYPESCRIPT_REGENERATED: ${{ steps.run.outputs.typescript_regenerated }} | |
| GO_REGENERATED: ${{ steps.run.outputs.go_regenerated }} | |
| JAVA_REGENERATED: ${{ steps.run.outputs.java_regenerated }} | |
| PYTHON_DIRECTORY: ${{ steps.run.outputs.python_directory }} | |
| TYPESCRIPT_DIRECTORY: ${{ steps.run.outputs.typescript_directory }} | |
| GO_DIRECTORY: ${{ steps.run.outputs.go_directory }} | |
| JAVA_DIRECTORY: ${{ steps.run.outputs.java_directory }} | |
| run: | | |
| echo "=== Verifying run-workflow (PR mode) outputs ===" | |
| echo "branch_name=${BRANCH_NAME}" | |
| echo "python_regenerated=${PYTHON_REGENERATED}" | |
| echo "typescript_regenerated=${TYPESCRIPT_REGENERATED}" | |
| echo "go_regenerated=${GO_REGENERATED}" | |
| echo "java_regenerated=${JAVA_REGENERATED}" | |
| echo "python_directory=${PYTHON_DIRECTORY}" | |
| echo "typescript_directory=${TYPESCRIPT_DIRECTORY}" | |
| echo "go_directory=${GO_DIRECTORY}" | |
| echo "java_directory=${JAVA_DIRECTORY}" | |
| # Verify that at least one regenerated flag was set (the test repo should produce output) | |
| if [ -n "${PYTHON_REGENERATED}" ] || [ -n "${TYPESCRIPT_REGENERATED}" ] || [ -n "${GO_REGENERATED}" ] || [ -n "${JAVA_REGENERATED}" ]; then | |
| echo "PASS: At least one language regeneration output was set" | |
| else | |
| echo "WARN: No language regeneration outputs detected (may be expected if test repo has no targets)" | |
| fi | |
| echo "=== PR mode test complete ===" | |
| test-run-workflow-direct-mode: | |
| name: "Test: run-workflow (direct mode)" | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Run action in direct mode | |
| id: run | |
| uses: ./ | |
| with: | |
| github_access_token: ${{ secrets.GITHUB_TOKEN }} | |
| speakeasy_api_key: ${{ secrets.SPEAKEASY_API_KEY }} | |
| action: run-workflow | |
| mode: direct | |
| force: "true" | |
| github_repository: speakeasy-api/sdk-generation-action-test-repo | |
| env: | |
| INPUT_DEBUG: "true" | |
| - name: Verify outputs | |
| env: | |
| COMMIT_HASH: ${{ steps.run.outputs.commit_hash }} | |
| BRANCH_NAME: ${{ steps.run.outputs.branch_name }} | |
| PYTHON_REGENERATED: ${{ steps.run.outputs.python_regenerated }} | |
| TYPESCRIPT_REGENERATED: ${{ steps.run.outputs.typescript_regenerated }} | |
| GO_REGENERATED: ${{ steps.run.outputs.go_regenerated }} | |
| JAVA_REGENERATED: ${{ steps.run.outputs.java_regenerated }} | |
| PYTHON_DIRECTORY: ${{ steps.run.outputs.python_directory }} | |
| TYPESCRIPT_DIRECTORY: ${{ steps.run.outputs.typescript_directory }} | |
| GO_DIRECTORY: ${{ steps.run.outputs.go_directory }} | |
| JAVA_DIRECTORY: ${{ steps.run.outputs.java_directory }} | |
| run: | | |
| echo "=== Verifying run-workflow (direct mode) outputs ===" | |
| echo "commit_hash=${COMMIT_HASH}" | |
| echo "branch_name=${BRANCH_NAME}" | |
| echo "python_regenerated=${PYTHON_REGENERATED}" | |
| echo "typescript_regenerated=${TYPESCRIPT_REGENERATED}" | |
| echo "go_regenerated=${GO_REGENERATED}" | |
| echo "java_regenerated=${JAVA_REGENERATED}" | |
| echo "python_directory=${PYTHON_DIRECTORY}" | |
| echo "typescript_directory=${TYPESCRIPT_DIRECTORY}" | |
| echo "go_directory=${GO_DIRECTORY}" | |
| echo "java_directory=${JAVA_DIRECTORY}" | |
| if [ -n "${PYTHON_REGENERATED}" ] || [ -n "${TYPESCRIPT_REGENERATED}" ] || [ -n "${GO_REGENERATED}" ] || [ -n "${JAVA_REGENERATED}" ]; then | |
| echo "PASS: At least one language regeneration output was set" | |
| else | |
| echo "WARN: No language regeneration outputs detected (may be expected if test repo has no targets)" | |
| fi | |
| echo "=== Direct mode test complete ===" | |
| test-release: | |
| name: "Test: release" | |
| runs-on: ubuntu-latest | |
| needs: [test-run-workflow-direct-mode] | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Run action in release mode | |
| id: run | |
| uses: ./ | |
| with: | |
| github_access_token: ${{ secrets.GITHUB_TOKEN }} | |
| speakeasy_api_key: ${{ secrets.SPEAKEASY_API_KEY }} | |
| action: release | |
| github_repository: speakeasy-api/sdk-generation-action-test-repo | |
| env: | |
| INPUT_DEBUG: "true" | |
| - name: Verify release outputs | |
| env: | |
| PUBLISH_PYTHON: ${{ steps.run.outputs.publish_python }} | |
| PUBLISH_TYPESCRIPT: ${{ steps.run.outputs.publish_typescript }} | |
| PUBLISH_JAVA: ${{ steps.run.outputs.publish_java }} | |
| PUBLISH_PHP: ${{ steps.run.outputs.publish_php }} | |
| PUBLISH_RUBY: ${{ steps.run.outputs.publish_ruby }} | |
| PUBLISH_CSHARP: ${{ steps.run.outputs.publish_csharp }} | |
| PUBLISH_TERRAFORM: ${{ steps.run.outputs.publish_terraform }} | |
| run: | | |
| echo "=== Verifying release outputs ===" | |
| echo "publish_python=${PUBLISH_PYTHON}" | |
| echo "publish_typescript=${PUBLISH_TYPESCRIPT}" | |
| echo "publish_java=${PUBLISH_JAVA}" | |
| echo "publish_php=${PUBLISH_PHP}" | |
| echo "publish_ruby=${PUBLISH_RUBY}" | |
| echo "publish_csharp=${PUBLISH_CSHARP}" | |
| echo "publish_terraform=${PUBLISH_TERRAFORM}" | |
| echo "=== Release test complete ===" | |
| test-tag: | |
| name: "Test: tag" | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Run action in tag mode | |
| id: run | |
| uses: ./ | |
| with: | |
| github_access_token: ${{ secrets.GITHUB_TOKEN }} | |
| speakeasy_api_key: ${{ secrets.SPEAKEASY_API_KEY }} | |
| action: tag | |
| github_repository: speakeasy-api/sdk-generation-action-test-repo | |
| env: | |
| INPUT_DEBUG: "true" | |
| - name: Verify tag completed | |
| run: | | |
| echo "=== Tag action completed successfully ===" |