Skip to content

feat: add GitHub Actions integration test workflow#135

Closed
reyhankoyun wants to merge 4 commits intoaws:mainfrom
reyhankoyun:feature/github-actions-workflow
Closed

feat: add GitHub Actions integration test workflow#135
reyhankoyun wants to merge 4 commits intoaws:mainfrom
reyhankoyun:feature/github-actions-workflow

Conversation

@reyhankoyun
Copy link
Copy Markdown
Contributor

@reyhankoyun reyhankoyun commented Oct 14, 2025

Issue #, if available:

Description of changes: This PR adds integration test workflow that will run on all PRs. Currently fails in main repo due to missing AWS IAM roles (infrastructure in progress). Workflow tested successfully in fork with temporary credentials.

  • Add workflow to run integration tests on PRs and pushes
  • Use credential-based authentication temporarily
  • Prepared for future OIDC role-based authentication
  • Tests run with --test-threads=1 for proper isolation

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

- Add workflow to run integration tests on PRs and pushes
- Use credential-based authentication temporarily
- Prepared for future OIDC role-based authentication
- Tests run with --test-threads=1 for proper isolation
@reyhankoyun reyhankoyun requested a review from a team as a code owner October 14, 2025 18:32
- Replace dtolnay/rust-toolchain with actions-rs/toolchain
- actions-rs/* is in the allowed patterns for aws organization
- Isengard provides temporary credentials requiring session token
- Add session token parameter to aws-actions/configure-aws-credentials
@codecov
Copy link
Copy Markdown

codecov bot commented Oct 14, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 91.72%. Comparing base (bad0177) to head (6593de7).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #135   +/-   ##
=======================================
  Coverage   91.72%   91.72%           
=======================================
  Files          14       14           
  Lines        2418     2418           
  Branches     2418     2418           
=======================================
  Hits         2218     2218           
  Misses        150      150           
  Partials       50       50           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@reyhankoyun reyhankoyun marked this pull request as draft October 14, 2025 18:54

on:
workflow_dispatch:
pull_request:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pull_request tasks are not going to be able to retrieve credentials using OIDC from forks. We need to use pull_request_target but should wait until we have a working test workflow using workflow_dispatch and have added a way to gate running integration tests on a tag.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll remove pull_request for now. So:

  • Current state: workflow_dispatch + push to main only
  • Next step: Get OIDC working with IAM roles
  • Future step: Add pull_request_target with proper label/tag gating

- name: Run integration tests
run: |
cd integration-tests
cargo test -- --test-threads=1 --ignored No newline at end of file
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IIRC cargo test uses the debug target, I'm not sure building using --release above does much for you.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can remove the release build since cargo test will build the debug binary that the tests expect. So cargo test will:

  • Build the agent binary in debug mode (target/debug/aws_secretsmanager_agent)
  • Build and run the integration tests
  • The tests will find the debug binary and use it

~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does the cache get invalidated when the Rust stable version changes?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, the current cache key doesn't include the Rust version, so it won't invalidate when Rust stable updates. I guess this could cause issues with stale compiled artifacts. Would including the Rust toolchain in the cache key fix it?

# - name: Determine IAM role
# id: role
# run: |
# if [[ "${{ github.event_name }}" == "pull_request" && "${{ github.event.pull_request.head.repo.full_name }}" != "${{ github.repository }}" ]]; then
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we need to do this on a pull_request_target

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With pull_request_target, don't we just need to add proper gating (like requiring a specific label) before we enable it, since it runs with elevated permissions? Wouldn't the rest be the same? I can make it more explicit like:

#     if [[ ("${{ github.event_name }}" == "pull_request" || "${{ github.event_name }}" == "pull_request_target") && "${{ github.event.pull_request.head.repo.full_name }}" != "${{ github.repository }}" ]]; then

@reyhankoyun reyhankoyun deleted the feature/github-actions-workflow branch October 20, 2025 20:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants