Skip to content

Conversation

@kuklyy
Copy link
Contributor

@kuklyy kuklyy commented Nov 25, 2025

Fixes #879

Summary

Add reusable GitHub Action for installing Weaver CLI in CI/CD workflows.

Motivation

Projects using Weaver need a simple, reliable way to install it in GitHub Actions across different platforms.

What's included

  • Action: .github/actions/setup-weaver/ - Cross-platform Weaver installation
  • Testing: .github/workflows/test-setup-weaver-action.yml - Automated testing on Linux/macOS/Windows
  • Documentation: Complete README with usage examples and troubleshooting

Features

  • Cross-platform support (Linux, macOS, Windows)
  • Automatic version resolution (latest or pinned)
  • Binary caching for faster CI runs
  • Simple API with minimal configuration

Usage

steps:
  - uses: actions/checkout@v4
  - uses: open-telemetry/weaver/.github/actions/setup-weaver@main
  - run: weaver registry check -r ./model

Testing

See opentelemetry-weaver-examples for real-world usage examples.

Add a composite GitHub Action that installs Weaver CLI in GitHub Actions workflows.

Changes:
- Add setup-weaver action with version pinning and caching support
- Support all platforms (Linux, macOS, Windows)
- Auto-detect architecture and download appropriate binary
- Cache binary for faster subsequent runs (30-60s → 2-5s)
- Add comprehensive README with Quick Start and examples

Usage:
- uses: open-telemetry/weaver/.github/actions/setup-weaver@v1

Update main README to reference setup-weaver action and link to
opentelemetry-weaver-examples for complete CI workflow examples.
Simplify the setup-weaver GitHub Action by removing unused outputs and improving step organization:

- Remove unused `cache-hit` and `weaver-path` outputs (no consumers use them)
- Reorganize steps for clearer flow: install → add to PATH → verify
- Separate verification into dedicated step that always runs after PATH is set
- Reduce action from 117 to 98 lines (16% reduction)
- Improve maintainability by giving each step a single clear responsibility
Add automated testing workflow for the setup-weaver action that:
- Tests on all platforms (Linux, Windows, macOS) using matrix
- Runs automatically on PRs that modify the action
- Verifies the action installs and works correctly
- Provides regression protection for action changes
@codecov
Copy link

codecov bot commented Nov 25, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 79.4%. Comparing base (1511626) to head (426f73d).
⚠️ Report is 12 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##            main   #1036     +/-   ##
=======================================
+ Coverage   78.7%   79.4%   +0.7%     
=======================================
  Files         82      82             
  Lines       6612    7033    +421     
=======================================
+ Hits        5204    5586    +382     
- Misses      1408    1447     +39     

☔ 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.

@kuklyy kuklyy marked this pull request as ready for review November 25, 2025 13:25
@kuklyy kuklyy requested a review from a team as a code owner November 25, 2025 13:25
@thompson-tomo
Copy link
Contributor

I like being able to offer a github action I however after reading https://docs.github.com/en/actions/how-tos/create-and-publish-actions/publish-in-github-marketplace I see 1 issue when we go to publish it to the marketplace which is that it is not in a seperate repo.

This could cause us problems due to the reliance on git tags, what would happen if we did a release for the action, what that break the ability to fetch the latest weaver? Also what would happen when weaver reaches v1.0.0.

Hence might be beneficial to request a seperate repo for this functionality ie weaver-setup.

@kuklyy
Copy link
Contributor Author

kuklyy commented Nov 25, 2025

I like being able to offer a github action I however after reading https://docs.github.com/en/actions/how-tos/create-and-publish-actions/publish-in-github-marketplace I see 1 issue when we go to publish it to the marketplace which is that it is not in a seperate repo.

We don't need to publish to Marketplace for this to work. Users can reference it directly:

- uses: open-telemetry/weaver/.github/actions/setup-weaver@main

Marketplace publishing (and potentially moving to a separate repo) could be considered post-v1.0.0 for increased discoverability. For now, the direct repo path keeps things simple while still enabling easier usage for Weaver users.

Copy link
Contributor

@lquerel lquerel left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

@jerbly jerbly left a comment

Choose a reason for hiding this comment

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

This is nice! Once this is merged I'll review the weaver-examples PR - but that looks good too. Thanks!

@thompson-tomo
Copy link
Contributor

@kuklyy sure it can be used without marketplace however using your example this would likely lead to issues with this rule https://github.com/ossf/scorecard/blob/c22063e786c11f9dd714d777a687ff7c4599b600/docs/checks.md#pinned-dependencies

Is it possible to use a tag rather than simply pointing it to main which would hopefully mitigate that rule?

@kuklyy
Copy link
Contributor Author

kuklyy commented Nov 26, 2025

Is it possible to use a tag rather than simply pointing it to main which would hopefully mitigate that rule?

Yes, users can reference the action using any git ref (e.g. tag, branch, or commit SHA). The choice of pinning strategy is up to the user - it's not something setup-weaver itself controls.

Note that pinning the action version (e.g., @main) is separate from pinning the Weaver version, which is controlled via the action's version input parameter.

Could you please elaborate on what specific change you'd like to see in the Action? Are you suggesting we add documentation about pinning best practices, or something else?

- Add inline comment showing users can reference action with any git ref (@main, @v0.20.0, @commit-sha)
- Simplify version input comment to focus on Weaver CLI version pinning
- Clarify distinction between action versioning and CLI tool versioning
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.

Re-usable github action

4 participants