Skip to content

generate_workflows_lib: leverage github matrix in CI #3547

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
xrmx opened this issue May 28, 2025 · 1 comment
Open

generate_workflows_lib: leverage github matrix in CI #3547

xrmx opened this issue May 28, 2025 · 1 comment

Comments

@xrmx
Copy link
Contributor

xrmx commented May 28, 2025

There has been discussions in the past on leveraging github matrix instead of providing our explicit own. Benefit of this would be less and smaller workflow files.

I sketched how a first step in that direct may look in the snippet below (on top of a rendered test workflow for core); the benefit of this would be around 10 lines of llines removed from workflows files for each tox target.

Since these workflows are generated from tox targets the missing step in our workflow generation scripts would be to group them by tested library.

We also need to benchmark if any change there would affect CI run timings.

diff --git a/.github/workflows/test_0.yml b/.github/workflows/test_0.yml
index 6136b9288..0c306b750 100644
--- a/.github/workflows/test_0.yml
+++ b/.github/workflows/test_0.yml
@@ -25,27 +25,35 @@ env:
        'main'
     ) || 'main' }}
   PIP_EXISTS_ACTION: w
+  py39: "3.9"
+  py310: "3.10"
+  py311: "3.11"
+  py312: "3.12"
+  py313: "3.13"
+  pypy: "pypy-3.9"
 
 jobs:
 
-  py39-test-opentelemetry-api_ubuntu-latest:
-    name: opentelemetry-api 3.9 Ubuntu
+  test-opentelemetry-api_ubuntu-latest:
     runs-on: ubuntu-latest
     timeout-minutes: 30
+    strategy:
+      matrix:
+        version: [py39, py310, py311, py312, py313, pypy]
     steps:
       - name: Checkout repo @ SHA - ${{ github.sha }}
         uses: actions/checkout@v4
 
-      - name: Set up Python 3.9
+      - name: Set up Python ${{ env[matrix.version] }}
         uses: actions/setup-python@v5
         with:
-          python-version: "3.9"
+          python-version: ${{ env[matrix.version] }}
 
       - name: Install tox
         run: pip install tox
 
       - name: Run tests
-        run: tox -e py39-test-opentelemetry-api -- -ra
+        run: tox -e ${{ matrix.version }}-test-opentelemetry-api -- -ra
 
   py310-test-opentelemetry-api_ubuntu-latest:
     name: opentelemetry-api 3.10 Ubuntu
@emdneto
Copy link
Member

emdneto commented Jun 9, 2025

yeah I think it can works.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants