Skip to content

Commit

Permalink
automatically collect tests
Browse files Browse the repository at this point in the history
  • Loading branch information
gadfort committed Feb 16, 2024
1 parent ff59745 commit 99ba573
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 4 deletions.
16 changes: 16 additions & 0 deletions .github/workflows/bin/collect_tests.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import json
import os


if __name__ == "__main__":
script_dir = os.path.dirname(os.path.abspath(__file__))
repo_dir = os.path.abspath(os.path.join(script_dir, '..', '..', '..'))
tests = []
for dirpath, dirnames, filenames in os.walk(repo_dir):
for f in filenames:
if f.startswith("test_"):
tests.append(os.path.join(dirpath, f))

tests_rel = [os.path.relpath(p, repo_dir) for p in tests]

print(json.dumps({"testbench": tests_rel}))
25 changes: 21 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,29 @@ on:
workflow_dispatch:

jobs:
get_testbenches:
name: 'Get testbenches'

runs-on: ubuntu-latest

outputs:
testbenches: ${{ steps.tests.outputs.tests }}

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Collect testbenches
id: tests
run: |
echo "tests=$(python3 .github/workflows/bin/collect_tests.py)" >> $GITHUB_OUTPUT
testbench:
needs: get_testbenches
strategy:
fail-fast: false
matrix:
testbench: [lumi/testbench/test_lumi.py, lumi/testbench/test_lumi_rnd.py, umi/testbench/test_crossbar.py, umi/testbench/test_fifo_flex.py, umi/testbench/test_fifo.py, umi/testbench/test_mem_agent.py, umi/testbench/test_regif.py, utils/testbench/test_umi_address_remap.py, utils/testbench/test_umi_packet_merge_greedy.py, utils/testbench/test_umi2tl_np.py]

matrix: ${{ fromJson(needs.get_testbenches.outputs.testbenches) }}

timeout-minutes: 10
runs-on: ubuntu-latest
container:
Expand All @@ -23,7 +40,7 @@ jobs:
uses: actions/checkout@v4
with:
submodules: recursive

- name: Install requirements
run: |
python3 -m venv .venv
Expand Down

0 comments on commit 99ba573

Please sign in to comment.