-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3a4dc32
commit d343bfb
Showing
3 changed files
with
105 additions
and
82 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,99 @@ | ||
name: "Produce CICD Data" | ||
description: "Composite action to produce CICD data" | ||
inputs: | ||
test_workflow_run_id: | ||
description: "Unique GitHub workflow run ID to use for data" | ||
required: true | ||
test_workflow_run_attempt: | ||
description: "Run attempt of the workflow run" | ||
required: true | ||
|
||
runs: | ||
using: "composite" | ||
steps: | ||
|
||
- uses: actions/checkout@v4 | ||
with: | ||
repository: tenstorrent/tt-forge-fe | ||
path: infra | ||
|
||
- name: Output (safe) pipeline values | ||
shell: bash | ||
run: | | ||
echo "pipeline_id (id / run #): ${{ github.run_id }}/${{ github.run_attempt }}" | ||
echo "submissions_ts: " | ||
echo "start_ts: " | ||
echo "end_ts: " | ||
echo "name: ${{ github.workflow }}, but rk recommended name w/out @: ${{ github.workflow_ref }}" | ||
echo "trigger: ${{ github.event_name }}" | ||
echo "sha: ${{ github.sha }}" | ||
echo "(triggering) author/actor: ${{ github.actor }}" | ||
echo "author/actor: ${{ github.triggering_actor }}" | ||
echo "orchestrator: github (Static)" | ||
echo "docker_image: ${{ job.container.image }}" | ||
echo "build duration is post-process" | ||
- name: Get workflow run_id attempt number to analyze | ||
id: get-run-id-and-attempt | ||
shell: bash | ||
run: | | ||
event_name="${{ github.event_name }}" | ||
if [[ "$event_name" == "workflow_dispatch" ]]; then | ||
run_id="${{ inputs.test_workflow_run_id }}" | ||
attempt_number="${{ inputs.test_workflow_run_attempt }}" | ||
elif [[ "$event_name" == "workflow_run" ]]; then | ||
run_id="${{ github.event.workflow_run.id }}" | ||
attempt_number="${{ github.event.workflow_run.run_attempt }}" | ||
[[ -z "$run_id" ]] && { echo "run_id is empty" ; exit 1; } | ||
[[ -z "$attempt_number" ]] && { echo "attempt_number is empty" ; exit 1; } | ||
else | ||
echo "Unknown event name" && exit 1 | ||
fi | ||
echo $run_id | ||
echo $attempt_number | ||
echo "run-id=$run_id" >> "$GITHUB_OUTPUT" | ||
echo "attempt-number=$attempt_number" >> "$GITHUB_OUTPUT" | ||
- name: Collect workflow artifact and job logs | ||
shell: bash | ||
run: | | ||
infra/download_workflow_data.sh ${{ github.repository }} ${{ steps.get-run-id-and-attempt.outputs.run-id }} ${{ steps.get-run-id-and-attempt.outputs.attempt-number }} | ||
- uses: actions/setup-python@v5 | ||
with: | ||
python-version: '3.8' | ||
cache: 'pip' | ||
cache-dependency-path: 'infra/requirements.txt' | ||
|
||
- name: Install infra dependencies | ||
shell: bash | ||
run: pip install -r infra/requirements.txt | ||
|
||
- name: Create JSON | ||
shell: bash | ||
env: | ||
PYTHONPATH: ${{ github.workspace }} | ||
run: | | ||
python3 infra/src/generate_data.py --run_id ${{ steps.get-run-id-and-attempt.outputs.run-id }} | ||
# Workaround: Copy file to avoid GH upload filename limitations | ||
cp pipeline_${{ steps.get-run-id-and-attempt.outputs.run-id }}*.json pipelinecopy_${{ steps.get-run-id-and-attempt.outputs.run-id }}.json | ||
- name: Upload cicd data | ||
if: ${{ github.event_name == 'workflow_run' }} | ||
uses: ./.github/actions/upload-data-via-sftp | ||
with: | ||
ssh-private-key: ${{ secrets.SFTP_CICD_WRITER_KEY }} | ||
sftp-batchfile: .github/actions/upload-data-via-sftp/cicd_data_batchfile.txt | ||
username: ${{ secrets.SFTP_CICD_WRITER_USERNAME }} | ||
hostname: ${{ secrets.SFTP_CICD_WRITER_HOSTNAME }} | ||
|
||
- name: Upload workflow run data, even on failure | ||
if: ${{ !cancelled() }} | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: workflow-run-data | ||
path: | | ||
pipelinecopy_${{ steps.get-run-id-and-attempt.outputs.run-id }}.json | ||
generated/cicd/${{ steps.get-run-id-and-attempt.outputs.run-id }}/workflow.json | ||
generated/cicd/${{ steps.get-run-id-and-attempt.outputs.run-id }}/workflow_jobs.json |
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 |
---|---|---|
|
@@ -3,6 +3,7 @@ name: Build and Test | |
on: | ||
workflow_dispatch: | ||
workflow_call: | ||
push: | ||
|
||
jobs: | ||
|
||
|
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