-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Changing event triggers to push to main and PRs * Created Composite Action for Repetitive Jobs Current CI jobs run similar blocks of code to checkout repos, install rclone and go, and mount the S3 bucket. This composite action YAML file will be called for instead. * Created reusable workflows External call to code.yml make_boot job * Checking for composite action error * Added secrets and inputs passing to external job * Passing AWS outputs along job chain * Added --net=host to zpkg build jobs * Added composite action * Final check with composite actions and aws jobs * Checking Workflow * Running all jobs on IRIS with NFS mount Make Boot and Test jobs require more attention. Make Boot currently hangs on completion, requiring a timeout and zip file check to successfully end job. Running tests on IRIS takes 3.5X as long. Running all jobs on IRIS with NFS mount, and removing jobs/scripts related to S3 or rclone Make Boot and Test jobs require more attention. Make Boot currently hangs on completion, requiring a timeout and zip file check to successfully end job. Running tests on IRIS seem to take 3.5X as long. * Dynamically splitting test job into matrix * Adding matrix to original test job * Created var for work_dir, using rootfs tag container, and ran black on py script * Fixing job titles, tidying up run commands * Adding latest tag to image * Splitting off timing tests * Updated upload/download artifact to v4 * Fix counter_documentation merge * Kill process causing make boot to hang * Add PandABrick to CI * Make jobs running on Iris runners use CI container * Added comment and removed 'undo' job --------- Co-authored-by: Shihab Suliman <[email protected]> Co-authored-by: Shihab Suliman <[email protected]> Co-authored-by: Shihab Suliman <[email protected]> Co-authored-by: Tom Trafford <[email protected]>
- Loading branch information
1 parent
5b15630
commit d4e8f30
Showing
33 changed files
with
1,424 additions
and
1,404 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
name: "Perform Repetitive Tasks" | ||
description: "Composite action that checks out repos, and adjusts directory permissions for runner" | ||
|
||
runs: | ||
using: "composite" | ||
steps: | ||
- name: Checkout PandABlocks-rootfs | ||
uses: actions/checkout@v4 | ||
with: | ||
repository: PandABlocks/PandABlocks-rootfs | ||
path: repos/PandABlocks-rootfs | ||
fetch-depth: 0 | ||
|
||
- name: Give runner build perms, and adjust repos config path | ||
shell: bash | ||
run: | | ||
sudo mkdir /build | ||
sudo chmod -R 777 /build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#!/bin/bash | ||
|
||
# Modules path | ||
search_dir=$1 | ||
work_dir=$2 | ||
|
||
# Find files matching timing name pattern | ||
found_files=$(find "$search_dir" -type f -name "*.timing.ini") | ||
echo $found_files | ||
# Array of modules and their test count | ||
module_grps=() | ||
|
||
# Check if any files were found | ||
if [ -z "$found_files" ]; then | ||
echo "No timing tests found" | ||
else | ||
# Loop through each found file | ||
for file in $found_files; do | ||
# Count occurrences of [*] in the file | ||
# Min 5 char to filter descriptions and index | ||
count=$(grep -o '\[[^][]\{5,\}\]' "$file" | wc -l) | ||
# Duplicate names allowed for multiple test files in same module subdirectory | ||
module_name=$(basename "$(dirname "$file")") | ||
module_grps+=("$module_name" "$count") | ||
done | ||
# Run python script to define job matrix based on found tests | ||
python3 $work_dir/Group_Tests.py "${module_grps[@]}" | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import sys | ||
import json | ||
|
||
modules_grps = (sys.argv)[1:] | ||
print(modules_grps) | ||
modules = [] | ||
num_jobs = 5 | ||
|
||
|
||
# Allocate modules to jobs with lowest load | ||
def split_modules(modules, num_jobs): | ||
modules.sort(key=lambda x: x[1], reverse=True) | ||
jobs = [[] for _ in range(num_jobs)] | ||
for module, count in modules: | ||
min_sum_job_idx = min( | ||
range(num_jobs), key=lambda i: sum(subset[1] for subset in jobs[i]) | ||
) | ||
jobs[min_sum_job_idx].append([module, count]) | ||
return jobs | ||
|
||
|
||
# Produce matrix in format expected by 'make hdl_test' job step | ||
def generate_matrix(jobs): | ||
matrix = {"modules": []} | ||
for job in jobs: | ||
job_include = " ".join(module[0] for module in job) | ||
matrix["modules"].append(job_include) | ||
return matrix | ||
|
||
|
||
# Convert bash array to sensible py array | ||
for i in range(0, len(modules_grps) - 1, 2): | ||
# If duplicate module names are found, add their counts | ||
if modules and modules_grps[i] == modules_grps[i - 2]: | ||
modules[-1][1] += int(modules_grps[i + 1]) | ||
# If no duplicate present, append new element | ||
else: | ||
modules.append([modules_grps[i], int(modules_grps[i + 1])]) | ||
print(modules) | ||
|
||
# Produce JSON file to pass to GH job | ||
with open("github_tests.json", "w") as matrix_file: | ||
json.dump(generate_matrix(split_modules(modules, num_jobs)), matrix_file) |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
on: | ||
workflow_call: | ||
|
||
jobs: | ||
make_boot: | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
include: | ||
- platform: zynq | ||
app: PandABox-no-fmc | ||
- platform: zynqmp | ||
app: xu5_st1-no-fmc | ||
- platform: zynqmp | ||
app: PandABrick | ||
runs-on: | ||
group: iris_runners | ||
container: | ||
image: ghcr.io/pandablocks/pandablocks-ci-container:latest | ||
options: --privileged | ||
|
||
steps: | ||
# Necessary to find action.yml | ||
- name: Checkout Source | ||
uses: actions/checkout@v4 | ||
with: | ||
path: repos/PandABlocks-fpga | ||
fetch-depth: 0 | ||
|
||
- name: Checkout rootfs and Give Directory Perms | ||
uses: ./repos/PandABlocks-fpga/.github/actions/setupenv | ||
|
||
# Generate bootable image | ||
# The Xvfb process causes the job to hang, so is killed after the image is generated | ||
- name: Make boot | ||
id: make_boot | ||
run: | | ||
echo "boot_files=false" >> $GITHUB_OUTPUT | ||
cd repos/PandABlocks-fpga | ||
ln -s CONFIG.example CONFIG | ||
make boot APP_NAME=${{ matrix.app }} | ||
ps -Ao pid= -o comm= | awk '$2 ~ /Xvfb/ { print $1}' | xargs kill | ||
# Upload artifacts if boot files present | ||
- name: Upload boot | ||
if: ${{ steps.make_boot.outputs.boot_files == 'true'}} | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: boot-${{ matrix.app }} | ||
path: /build/boot*.zip |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
on: | ||
workflow_call: | ||
|
||
env: | ||
WORK_DIR: /__w/PandABlocks-FPGA/PandABlocks-FPGA | ||
|
||
jobs: | ||
make_zpkg: | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
app: [ | ||
"PandABox-no-fmc", | ||
"PandABox-fmc_24vio", | ||
"PandABox-fmc_acq427", | ||
"PandABox-fmc_acq430", | ||
"PandABox-fmc_lback-sfp_lback", | ||
"PandABrick", | ||
"xu5_st1-no-fmc", | ||
"xu5_st1-fmc_acq430" | ||
] | ||
runs-on: | ||
group: iris_runners | ||
container: | ||
image: ghcr.io/pandablocks/pandablocks-ci-container:latest | ||
options: --privileged | ||
|
||
steps: | ||
# Necessary to find action.yml | ||
- name: Checkout Source | ||
uses: actions/checkout@v4 | ||
with: | ||
path: repos/PandABlocks-fpga | ||
fetch-depth: 0 | ||
|
||
- name: Checkout rootfs and Give Directory Perms | ||
uses: ./repos/PandABlocks-fpga/.github/actions/setupenv | ||
|
||
# Make zpkgs | ||
- name: build carrier_ip and zpkg | ||
id: make_zpkg | ||
run: | | ||
cd repos/PandABlocks-fpga | ||
ln -s CONFIG.example CONFIG | ||
make WORK_DIR=$WORK_DIR carrier_ip APP_NAME=${{ matrix.app }} | ||
make WORK_DIR=$WORK_DIR zpkg APP_NAME=${{ matrix.app }} | ||
# Artifacts | ||
- name: Upload zpkg | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: zpkgs-${{ matrix.app }} | ||
path: /build/panda-fpga@*.zpg |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
on: | ||
workflow_call: | ||
|
||
jobs: | ||
release: | ||
runs-on: ubuntu-latest | ||
# make a release on every tag | ||
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags') | ||
steps: | ||
- uses: actions/download-artifact@v4 | ||
with: | ||
path: zpkgs | ||
merge-multiple: true | ||
|
||
|
||
- name: Github Release | ||
# We pin to the SHA, not the tag, for security reasons. | ||
# https://docs.github.com/en/actions/learn-github-actions/security-hardening-for-github-actions#using-third-party-actions | ||
uses: softprops/action-gh-release@2d72d869af3bf23602f9593a1e3fd739b80ac1eb # v0.1.12 | ||
with: | ||
prerelease: ${{ contains(github.ref_name, 'a') || contains(github.ref_name, 'b') || contains(github.ref_name, 'rc') }} | ||
files: zpkgs/* | ||
body: See [Changelog](CHANGELOG.rst) for more details | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
on: | ||
workflow_call: | ||
inputs: | ||
matrix: | ||
required: true | ||
type: string | ||
|
||
jobs: | ||
test: | ||
strategy: | ||
fail-fast: false | ||
# Using generated matrix from previous job | ||
matrix: ${{fromJSON(inputs.matrix)}} | ||
runs-on: | ||
group: iris_runners | ||
container: | ||
image: ghcr.io/pandablocks/pandablocks-ci-container:latest | ||
options: --privileged | ||
|
||
steps: | ||
# Necessary to find action.yml | ||
- name: Checkout Source | ||
uses: actions/checkout@v4 | ||
with: | ||
path: repos/PandABlocks-fpga | ||
fetch-depth: 0 | ||
|
||
- name: Checkout rootfs and Give Directory Perms | ||
uses: ./repos/PandABlocks-fpga/.github/actions/setupenv | ||
|
||
# Run tests | ||
- name: Make hdl Tests | ||
run: | | ||
cd repos/PandABlocks-fpga | ||
ln -s CONFIG.example CONFIG | ||
make hdl_test MODULES="${{matrix.modules}}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
on: | ||
workflow_call: | ||
outputs: | ||
matrix: | ||
value: ${{ jobs.test_matrix.outputs.matrix }} | ||
|
||
env: | ||
WORK_DIR: /__w/PandABlocks-FPGA/PandABlocks-FPGA | ||
|
||
jobs: | ||
test_matrix: | ||
runs-on: | ||
group: iris_runners | ||
container: | ||
image: docker.io/shihabdls/pandablocks-container-extension:v2.5 | ||
options: --privileged | ||
outputs: | ||
matrix: ${{steps.make_matrix.outputs.matrix}} | ||
steps: | ||
- name: Checkout Source | ||
uses: actions/checkout@v4 | ||
with: | ||
path: repos/PandABlocks-fpga | ||
fetch-depth: 0 | ||
|
||
- name: Evaluate number of modules/tests & generate job matrix | ||
id: make_matrix | ||
run: | | ||
bash $WORK_DIR/repos/PandABlocks-fpga/.github/scripts/Find_Tests.sh "$WORK_DIR/repos/PandABlocks-fpga/modules" "$WORK_DIR/repos/PandABlocks-fpga/.github/scripts" | ||
json_content=$(cat github_tests.json) | ||
echo "::set-output name=matrix::$json_content" | ||
echo "$json_content" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
on: | ||
workflow_call: | ||
|
||
jobs: | ||
test_python_autogen: | ||
runs-on: | ||
group: iris_runners | ||
container: | ||
image: ghcr.io/pandablocks/pandablocks-ci-container:latest | ||
options: --privileged | ||
|
||
steps: | ||
# Necessary to find action.yml | ||
- name: Checkout Source | ||
uses: actions/checkout@v4 | ||
with: | ||
path: repos/PandABlocks-fpga | ||
fetch-depth: 0 | ||
|
||
- name: Checkout rootfs and Give Directory Perms | ||
uses: ./repos/PandABlocks-fpga/.github/actions/setupenv | ||
|
||
# Run tests | ||
- name: Make Python Tests | ||
run: | | ||
cd repos/PandABlocks-fpga | ||
ln -s CONFIG.example CONFIG | ||
make python_tests | ||
make python_timing | ||
make autogen |
Oops, something went wrong.