Skip to content

Commit

Permalink
Trying to use dirname in array
Browse files Browse the repository at this point in the history
  • Loading branch information
Shihab Suliman committed May 10, 2024
1 parent 4b91bb4 commit ba41872
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 33 deletions.
16 changes: 2 additions & 14 deletions .github/scripts/tests_group.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,7 @@ search_dir=$1
work_dir=$2

# Find files matching timing name pattern
# This executes a bash script on the found files, wherein they are only included if the timing test file matches the parent directory name (i.e., module name)
# This includes files like seq.timing.ini but excludes seq_double_table.timing.ini
# This is important to allow for module names to be passed to make hdl_test argument
# When splitting off functionality and documentation timing.ini tests, this needs to be checked again
found_files=$(find "$search_dir" -type f -name "*.timing.ini" -exec bash -c '
for file; do
module_name=$(basename "$(dirname "$file")")
module_timing_name=$(basename "$file")
if [[ "$module_timing_name" =~ ^"$module_name".timing.ini$ ]]; then
echo "$file"
fi
done
' bash {} +)
found_files=$(find "$search_dir" -type f -name "*.timing.ini")

# Array of modules and their test count
module_grps=()
Expand All @@ -31,7 +19,7 @@ else
# Count occurrences of [*] in the file
# Min 5 char to filter descriptions and index
count=$(grep -o '\[[^][]\{5,\}\]' "$file" | wc -l)
module_name=$(basename "$file" .timing.ini)
module_name=$(basename "$(dirname "$file")")
module_grps+=("$module_name" "$count")
done
# Run python script to define job matrix based on found tests
Expand Down
16 changes: 2 additions & 14 deletions .github/workflows/_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,7 @@ jobs:
strategy:
fail-fast: false
# Using generated matrix from previous job
#matrix: ${{fromJSON(inputs.matrix)}}
matrix:
modules: [fail]
outputs:
run_id: ${{steps.run_id_step.outputs.run_id}}
token: ${{steps.run_id_step.outputs.token}}
matrix: ${{fromJSON(inputs.matrix)}}
runs-on:
group: iris_runners
container:
Expand All @@ -36,11 +31,4 @@ jobs:
# Run tests
- name: Make python and hdl tests
id: python_hdl_tests
run: cd repos/PandABlocks-fpga && ln -s CONFIG.example CONFIG && make WORK_DIR=/__w/PandABlocks-FPGA/PandABlocks-FPGA hdl_test MODULES="${{matrix.modules}}"

- name: Print Logs
if: ${{ always() }}
env:
GH_TOKEN: ${{ github.token }}
run: curl -sS https://webi.sh/gh | sh && source ~/.config/envman/PATH.env && gh auth login && gh run view ${{ github.run_id }} --log-failed

run: cd repos/PandABlocks-fpga && ln -s CONFIG.example CONFIG && make WORK_DIR=/__w/PandABlocks-FPGA/PandABlocks-FPGA hdl_test MODULES="${{matrix.modules}}"
10 changes: 5 additions & 5 deletions .github/workflows/code.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@ jobs:
uses: ./.github/workflows/_test_matrix.yml

# Python and hdl tests
test:
needs: test_matrix
uses: ./.github/workflows/_test.yml
with:
matrix: ${{needs.test_matrix.outputs.matrix}}
# test:
# needs: test_matrix
# uses: ./.github/workflows/_test.yml
# with:
# matrix: ${{needs.test_matrix.outputs.matrix}}

# Optional revert on failed push workflow
# undo:
Expand Down

0 comments on commit ba41872

Please sign in to comment.