Skip to content

Run the standard SDK tests in CI with OIDC AWS credentials - #12

Closed
tobiascadee wants to merge 1 commit into
tobias/update-dependenciesfrom
tobias/add-standard-tests-workflow
Closed

tobiascadee wants to merge 1 commit into
tobias/update-dependenciesfrom
tobias/add-standard-tests-workflow

Conversation

@tobiascadee

Copy link
Copy Markdown
Collaborator

What

Make the Test tap-s3 workflow run the standard singer-sdk tap tests on every PR, with AWS access through GitHub OIDC.

Stacked on #11 (tobias/update-dependencies); retarget to main once #11 merges.

Why

The workflow is disabled_manually: its only run failed with NoCredentialsError because the SDK tests read real Parquet files from S3 and CI had no AWS credentials. Running them on PRs catches singer-sdk/pyarrow regressions before a tag is pinned in data-transformations' meltano.yml.

Changes

  • pytest job assumes an IAM role via aws-actions/configure-aws-credentials v6.3.0 (SHA-pinned), role-to-assume: ${{ vars.AWS_ROLE_ARN }}, region eu-west-1; id-token: write on that job only
  • TAP_S3_BUCKET / TAP_S3_PREFIX from repo variables on the tox step (singer-sdk env config overrides the placeholder SAMPLE_CONFIG)
  • tox pass_env adds AWS_* so the temporary credentials and region reach pytest
  • matrix Python version passed via env instead of templated into run: (drops the zizmor: ignore comment); removed the template TODO header
  • Rest of the workflow already matches the current Meltano tap template (build-package -> pytest matrix -> typing)

Local check: uvx --with=tox-uv tox -e 3.11 with env-var credentials (as OIDC provides them) and the Solvimon prefix: 18 passed. zizmor 1.31.1: no findings.

Needed before the tests can pass

  • Repo variable AWS_ROLE_ARN: IAM role trusting token.actions.githubusercontent.com (aud sts.amazonaws.com, sub repo:TicketSwap/tap-s3:*), with s3:ListBucket on ticketswap-clickhouse (prefix reverse-etl/retl_solvimon_ticket_events/) and s3:GetObject on ticketswap-clickhouse/reverse-etl/retl_solvimon_ticket_events/*
  • Repo variable TAP_S3_BUCKET = ticketswap-clickhouse
  • Repo variable TAP_S3_PREFIX = reverse-etl/retl_solvimon_ticket_events/
  • Enable the workflow: gh workflow enable test.yml -R TicketSwap/tap-s3

LLM Transparency

Note

LLM usage: 100 %

To be notified

Links

🤖 Generated with Claude Code

The Test workflow was disabled after its first run failed with
NoCredentialsError: the standard singer-sdk tap tests list and read
real Parquet objects from S3, and CI had no AWS credentials.

The pytest job now assumes an IAM role through GitHub OIDC
(configure-aws-credentials, role ARN from the AWS_ROLE_ARN repo
variable), so no long-lived keys are stored in the repo. id-token:
write is granted to that job only. The tap reads bucket and prefix
from TAP_S3_BUCKET / TAP_S3_PREFIX (singer-sdk env config, the same
names as in data-transformations), set as repo variables and pointed
at the small Solvimon export so each run reads a ~3 MB file;
SuiteConfig already caps the sync at 150 records.

tox strips the environment, so AWS_* joins pass_env to forward the
temporary credentials and region to pytest. The matrix version is
passed through env instead of being templated into run:, which drops
the zizmor ignore comment; the template's TODO header goes too.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@tobiascadee
tobiascadee force-pushed the tobias/add-standard-tests-workflow branch from 2622537 to 106219d Compare October 23, 2026 09:39
@tobiascadee

Copy link
Copy Markdown
Collaborator Author

Not adding the test workflow for now; only the dependency update (#11) goes in.

@tobiascadee
tobiascadee deleted the tobias/add-standard-tests-workflow branch October 23, 2026 09:52
tobiascadee added a commit that referenced this pull request Oct 27, 2026
The standard SDK tests listed and read real Parquet objects from S3, so
they only passed with an authenticated AWS session. CI had none, which
is why the Test workflow was disabled and #12 (OIDC role) was dropped.
The shared ruleset needs `test` to report and pass on every PR.

tests/conftest.py starts moto's S3 mock in pytest_configure, before
collection, since the SDK discovers the stream schema while collecting.
It uploads one generated Parquet file under the SAMPLE_CONFIG
bucket/prefix, covering every type branch of the Arrow-to-JSON-schema
mapping (int, float, bool, string, timestamp, list, struct, a NULL),
plus a `_SUCCESS` marker that the `.parquet` filter must skip.
Fake credentials replace any local AWS_PROFILE, so the tests never
reach real AWS.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
tobiascadee added a commit that referenced this pull request Oct 27, 2026
The standard SDK tests listed and read real Parquet objects from S3, so
they only passed with an authenticated AWS session. CI had none, which
is why the Test workflow was disabled and #12 (OIDC role) was dropped.
The shared ruleset needs `test` to report and pass on every PR.

tests/conftest.py starts moto's S3 mock in pytest_configure, before
collection, since the SDK discovers the stream schema while collecting.
It uploads one generated Parquet file under the SAMPLE_CONFIG
bucket/prefix with int, float, bool, string, timestamp, list and struct
columns and a NULL,
plus a `_SUCCESS` marker that the `.parquet` filter must skip.
Fake credentials replace any local AWS_PROFILE, so the tests never
reach real AWS.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
tobiascadee added a commit that referenced this pull request Oct 27, 2026
# What
Report stable `lint` and `test` checks on every pull request, and make
the code pass `lint`.

# Why
The shared `main` ruleset (applied 2026-10-27) can't require status
checks yet. Most test workflows filter `pull_request` by `paths:`, so a
required check never reports on a PR that touches no code
(TicketSwap/tap-exact#307 could only merge through the bypass). Job
names also differ per repo and include the Python version (`Test
(3.12)`, `Integration Tests (3.10)`). Most repos had no lint job at all.
Once this lands in all 14 tap/target repos, the ruleset requires `lint`
and `test`.

## Changes
- remove the `paths:` filter from the `pull_request` trigger (the `push`
filter stays)
- `lint` job: `uvx ruff@0.17.3 check` and `uvx ruff@0.17.3 format
--check` over the whole repo with the repo's own ruff config. Ruff is
pinned so a new release can't turn the required check red on its own;
bumping it is a one-line change in each repo
- `test` job (`needs: [pytest]`, `if: always()`) fails unless every
matrix leg passed, so the check name doesn't depend on the Python
versions; the legs run as `pytest (3.x)`

The second commit makes the code pass: ruff autofixes and `ruff format`,
plus a handful of hand fixes. Its message lists each one. `noqa` is used
only where the real fix would mean a refactor or changing a signature
the SDK defines.

The third commit makes the tests run offline. The Test workflow was
disabled because the SDK tests read real Parquet files from S3 and CI
has no AWS access (see #12). `tests/conftest.py` now starts a moto S3
mock before collection and uploads a generated Parquet file under the
`SAMPLE_CONFIG` bucket and prefix, so all 15 SDK tests pass without AWS.
`moto[s3]` is added to the `test` dependency group. The Test workflow is
re-enabled.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
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.

1 participant