|
| 1 | +name: Integration Tests |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - main |
| 7 | + paths: |
| 8 | + - 'src/api/providers/kanban/**' |
| 9 | + - 'src/git/**' |
| 10 | + - 'tests/kanban_integration.rs' |
| 11 | + - 'tests/git_integration.rs' |
| 12 | + - '.github/workflows/integration-tests.yml' |
| 13 | + pull_request: |
| 14 | + branches: |
| 15 | + - main |
| 16 | + paths: |
| 17 | + - 'src/api/providers/kanban/**' |
| 18 | + - 'src/git/**' |
| 19 | + - 'tests/kanban_integration.rs' |
| 20 | + - 'tests/git_integration.rs' |
| 21 | + workflow_dispatch: |
| 22 | + inputs: |
| 23 | + run_jira: |
| 24 | + description: 'Run Jira integration tests' |
| 25 | + type: boolean |
| 26 | + default: true |
| 27 | + run_linear: |
| 28 | + description: 'Run Linear integration tests' |
| 29 | + type: boolean |
| 30 | + default: true |
| 31 | + run_git: |
| 32 | + description: 'Run Git integration tests' |
| 33 | + type: boolean |
| 34 | + default: true |
| 35 | + run_git_push: |
| 36 | + description: 'Run Git push tests (creates/deletes optest/ branches)' |
| 37 | + type: boolean |
| 38 | + default: false |
| 39 | + |
| 40 | +jobs: |
| 41 | + integration-tests: |
| 42 | + runs-on: ubuntu-latest |
| 43 | + steps: |
| 44 | + - name: Checkout |
| 45 | + uses: actions/checkout@v4 |
| 46 | + with: |
| 47 | + fetch-depth: 0 # Full history needed for git operations |
| 48 | + |
| 49 | + - name: Configure Git for tests |
| 50 | + run: | |
| 51 | + git config user.email "[email protected]" |
| 52 | + git config user.name "CI" |
| 53 | + # Set origin/HEAD if not set (needed for get_default_branch) |
| 54 | + git remote set-head origin --auto || true |
| 55 | +
|
| 56 | + - name: Install Rust toolchain |
| 57 | + |
| 58 | + |
| 59 | + - name: Cache cargo |
| 60 | + uses: actions/cache@v4 |
| 61 | + with: |
| 62 | + path: | |
| 63 | + ~/.cargo/registry |
| 64 | + ~/.cargo/git |
| 65 | + target |
| 66 | + key: ${{ runner.os }}-cargo-integration-${{ hashFiles('**/Cargo.lock') }} |
| 67 | + restore-keys: ${{ runner.os }}-cargo-integration- |
| 68 | + |
| 69 | + - name: Run Jira integration tests |
| 70 | + if: >- |
| 71 | + (github.event_name != 'workflow_dispatch' || inputs.run_jira) && |
| 72 | + env.OPERATOR_JIRA_DOMAIN != '' |
| 73 | + env: |
| 74 | + OPERATOR_JIRA_DOMAIN: ${{ secrets.OPERATOR_JIRA_DOMAIN }} |
| 75 | + OPERATOR_JIRA_EMAIL: ${{ secrets.OPERATOR_JIRA_EMAIL }} |
| 76 | + OPERATOR_JIRA_API_KEY: ${{ secrets.OPERATOR_JIRA_API_KEY }} |
| 77 | + OPERATOR_JIRA_TEST_PROJECT: ${{ secrets.OPERATOR_JIRA_TEST_PROJECT }} |
| 78 | + run: cargo test --test kanban_integration jira_tests -- --nocapture --test-threads=1 |
| 79 | + |
| 80 | + - name: Run Linear integration tests |
| 81 | + if: >- |
| 82 | + (github.event_name != 'workflow_dispatch' || inputs.run_linear) && |
| 83 | + env.OPERATOR_LINEAR_API_KEY != '' |
| 84 | + env: |
| 85 | + OPERATOR_LINEAR_API_KEY: ${{ secrets.OPERATOR_LINEAR_API_KEY }} |
| 86 | + OPERATOR_LINEAR_TEST_TEAM: ${{ secrets.OPERATOR_LINEAR_TEST_TEAM }} |
| 87 | + run: cargo test --test kanban_integration linear_tests -- --nocapture --test-threads=1 |
| 88 | + |
| 89 | + - name: Run cross-provider tests |
| 90 | + env: |
| 91 | + OPERATOR_JIRA_DOMAIN: ${{ secrets.OPERATOR_JIRA_DOMAIN }} |
| 92 | + OPERATOR_JIRA_EMAIL: ${{ secrets.OPERATOR_JIRA_EMAIL }} |
| 93 | + OPERATOR_JIRA_API_KEY: ${{ secrets.OPERATOR_JIRA_API_KEY }} |
| 94 | + OPERATOR_JIRA_TEST_PROJECT: ${{ secrets.OPERATOR_JIRA_TEST_PROJECT }} |
| 95 | + OPERATOR_LINEAR_API_KEY: ${{ secrets.OPERATOR_LINEAR_API_KEY }} |
| 96 | + OPERATOR_LINEAR_TEST_TEAM: ${{ secrets.OPERATOR_LINEAR_TEST_TEAM }} |
| 97 | + run: cargo test --test kanban_integration test_provider_interface_consistency -- --nocapture |
| 98 | + |
| 99 | + # Git Integration Tests |
| 100 | + - name: Run Git integration tests (read-only) |
| 101 | + if: github.event_name != 'workflow_dispatch' || inputs.run_git |
| 102 | + env: |
| 103 | + OPERATOR_GIT_TEST_ENABLED: 'true' |
| 104 | + run: cargo test --test git_integration -- --nocapture --test-threads=1 |
| 105 | + |
| 106 | + - name: Run Git push integration tests |
| 107 | + if: >- |
| 108 | + github.event_name == 'push' || |
| 109 | + (github.event_name == 'workflow_dispatch' && inputs.run_git_push) |
| 110 | + env: |
| 111 | + OPERATOR_GIT_TEST_ENABLED: 'true' |
| 112 | + OPERATOR_GIT_PUSH_ENABLED: 'true' |
| 113 | + run: cargo test --test git_integration git_cli_branch_lifecycle_tests -- --nocapture --test-threads=1 |
| 114 | + |
| 115 | + - name: Cleanup optest branches |
| 116 | + if: always() |
| 117 | + run: | |
| 118 | + # Remove any remaining optest/ branches from remote |
| 119 | + git fetch --prune origin |
| 120 | + for branch in $(git branch -r | grep 'origin/optest/' | sed 's|origin/||' | xargs); do |
| 121 | + echo "Cleaning up orphaned test branch: $branch" |
| 122 | + git push origin --delete "$branch" || true |
| 123 | + done |
0 commit comments