Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .github/workflows/build-daily.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,9 @@ permissions:
jobs:
build-daily:
uses: ./.github/workflows/debos.yml
test-daily:
uses: ./.github/workflows/test.yml
needs: build-nightly
secrets: inherit
with:
url: ${{ needs.build-daily.outputs.artifacts_url }}
18 changes: 16 additions & 2 deletions .github/workflows/build-on-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,23 @@ on:
pull_request:

permissions:
contents: read
checks: write # required by test reporting action
pull-requests: write # required by test reporting action
contents: read # github default
packages: read # github default

jobs:
event-file:
name: "Upload event file"
runs-on: ubuntu-latest
steps:
- name: Upload
uses: actions/upload-artifact@v4
with:
name: Event File
path: ${{ github.event_path }}

build-pr:
uses: ./.github/workflows/debos.yml

schema-check:
uses: ./.github/workflows/lava-schema-check.yml
11 changes: 11 additions & 0 deletions .github/workflows/build-on-push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,19 @@ on:
branches: [main]

permissions:
checks: write
pull-requests: write
contents: read
packages: read

jobs:
build-daily:
uses: ./.github/workflows/debos.yml
schema-check:
uses: ./.github/workflows/lava-schema-check.yml
test:
uses: ./.github/workflows/test.yml
needs: [build, schema-check]
secrets: inherit
with:
url: ${{ needs.build.outputs.artifacts_url }}
15 changes: 14 additions & 1 deletion .github/workflows/debos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -166,4 +166,17 @@ jobs:
id: upload_sbom_artifacts
with:
path: sboms

- name: "Print output"
env:
build_url: ${{ steps.upload_artifacts.outputs.url }}
run: |
echo "Downloads URL: ${build_url}"
echo "url=\"${build_url}\"" >> $GITHUB_OUTPUT
echo "${build_url}" > build_url
echo "## Download URL" >> $GITHUB_STEP_SUMMARY
echo "[${build_url}](${build_url})" >> $GITHUB_STEP_SUMMARY
- name: Upload build URL
uses: actions/upload-artifact@v4
with:
name: build_url
path: build_url
28 changes: 28 additions & 0 deletions .github/workflows/lava-schema-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Chech LAVA templates

on:
workflow_call:

jobs:
schema-check:
runs-on: ubuntu-latest
container: lavasoftware/lava-server:2025.04
steps:
- name: Clone repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Schema check
run: |
DEVICE_TYPE="my-device"
BUILD_FILE_NAME="build.tar.gz"
BUILD_DOWNLOAD_URL="https://example.com/downloads/1"
GITHUB_SHA="7e6f96ccf3e911a8a1a18accdbb91991aa0db66e"

find ci/lava/ -name "*.yaml" -exec sed -i "s|{{DEVICE_TYPE}}|${DEVICE_TYPE}|g" '{}' \;
find ci/lava/ -name "*.yaml" -exec sed -i "s|{{GITHUB_SHA}}|${GITHUB_SHA}|g" '{}' \;
find ci/lava/ -name "*.yaml" -exec sed -i "s|{{BUILD_DOWNLOAD_URL}}|${BUILD_DOWNLOAD_URL}|g" '{}' \;
find ci/lava/ -name "*.yaml" -exec sed -i "s|{{BUILD_FILE_NAME}}|${BUILD_FILE_NAME}|g" '{}' \;
find ci/lava/ -name "*.yaml" -exec sed -i "s|{{GITHUB_RUN_ID}}|${GITHUB_RUN_ID}|g" '{}' \;

python3 ci/schemacheck.py ./ci/lava/
114 changes: 114 additions & 0 deletions .github/workflows/test-pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
name: Test PR build

run-name: "Tests triggered by PR: ${{ github.event.workflow_run.display_title }}"

on:
workflow_run:
workflows: ["Build on PR"]
types:
- completed

permissions:
checks: write # required by test reporting action
pull-requests: write # required by test reporting action
contents: read # github default
packages: read # github default

jobs:
retrieve-build-url:
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'success' }}
outputs:
url: ${{ steps.set-build-url.outputs.url }}
steps:
- name: 'Download build URL'
uses: actions/github-script@v6
with:
script: |
let allArtifacts = await github.rest.actions.listWorkflowRunArtifacts({
owner: context.repo.owner,
repo: context.repo.repo,
run_id: context.payload.workflow_run.id,
});
let matchArtifact = allArtifacts.data.artifacts.filter((artifact) => {
return artifact.name == "build_url"
})[0];
let download = await github.rest.actions.downloadArtifact({
owner: context.repo.owner,
repo: context.repo.repo,
artifact_id: matchArtifact.id,
archive_format: 'zip',
});
const fs = require('fs');
const path = require('path');
const temp = '${{ runner.temp }}/artifacts';
if (!fs.existsSync(temp)){
fs.mkdirSync(temp);
}
fs.writeFileSync(path.join(temp, 'build_url.zip'), Buffer.from(download.data));

- name: 'Setup build URL'
id: set-build-url
run: |
unzip "${{ runner.temp }}/artifacts/build_url.zip"
BUILD_URL=$(cat build_url)
echo "Build URL: ${BUILD_URL}"
echo "url=${BUILD_URL}" >> $GITHUB_OUTPUT

test:
uses: ./.github/workflows/test.yml
secrets: inherit
needs: retrieve-build-url
with:
url: ${{ needs.retrieve-build-url.outputs.url }}

publish-test-results:
name: "Publish Tests Results"
needs: test
runs-on: ubuntu-latest
steps:
- name: Download Artifacts
uses: actions/download-artifact@v4
with:
path: artifacts

- name: Download event file
uses: actions/download-artifact@v4
with:
run-id: ${{ github.event.workflow_run.id }}
path: artifacts
github-token: ${{ github.token }}

- name: "List files"
run: |
echo $GITHUB_WORKSPACE
ls -R $GITHUB_WORKSPACE

- name: Publish Test Results
uses: EnricoMi/publish-unit-test-result-action@v2
with:
commit: ${{ github.event.workflow_run.head_sha }}
event_file: artifacts/Event File/event.json
event_name: ${{ github.event.workflow_run.event }}
files: "${{ github.workspace }}/artifacts/**/*.xml"

- name: Prepare PR comment
id: pr_comment_prep
run: |
echo "## Test jobs for commit ${{ github.event.workflow_run.head_sha }}" > pr-comment.txt
for json_file in $(find ${{ github.workspace }} -name "test-job-*.json")
do
DEVICE_TYPE=$(cat "$json_file" | jq -r ".requested_device_type")
URL=$(cat "$json_file" | jq -r ".url")
JOB_ID=$(cat "$json_file" | jq -r ".id")
echo " * [Job $JOB_ID on $DEVICE_TYPE]($URL)"
echo " * [Job $JOB_ID on $DEVICE_TYPE]($URL)" >> pr-comment.txt
done
PR_NUMBER=$(cat "artifacts/Event File/event.json" | jq -r ".number")
echo "pr_number=$PR_NUMBER" >> $GITHUB_OUTPUT

- name: Comment on PR
uses: thollander/actions-comment-pull-request@v3
with:
file-path: pr-comment.txt
pr-number: ${{ steps.pr_comment_prep.outputs.pr_number }}
106 changes: 106 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
name: Tests

on:
workflow_call:
inputs:
url:
required: true
type: string

jobs:
prepare-job-list:
runs-on: ubuntu-latest
outputs:
jobmatrix: ${{ steps.listjobs.outputs.jobmatrix }}
steps:
- name: Clone repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Print trigger
run: |
echo "Triggered by ${{ github.event_name }}"
echo "Build URL: ${{ inputs.url }}"
- name: "List jobs"
id: listjobs
run: |
JOBFILES=$(find ci/lava/ -name *.yaml)
JOBFILES=$(echo "$JOBFILES" | sed -e "s/^/\"/" | sed -e "s/$/\",/" | tr -d "\n" | sed -e "s/.$//")
JOBFILES="[${JOBFILES}]"
J=$(jq -cn --argjson jobfiles "$JOBFILES" '{target: $jobfiles}')
echo "jobmatrix=$J" >> $GITHUB_OUTPUT
echo "Preparing testjob files"

submit-job:
needs: prepare-job-list
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix: ${{ fromJson(needs.prepare-job-list.outputs.jobmatrix) }}
steps:
- name: Clone repository
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: "Update test definition ${{ matrix.target }}"
run: |
TARGET=${{ matrix.target }}
FIND_PATH="${TARGET#*/}"
DEVICE_TYPE_PATH="${FIND_PATH%/*}"
DEVICE_TYPE="${DEVICE_TYPE_PATH#*/}"
BUILD_FILE_NAME="core-image-base-${DEVICE_TYPE}.rootfs.qcomflash.tar.gz"
BUILD_DOWNLOAD_URL="${{inputs.url}}/${DEVICE_TYPE}/${BUILD_FILE_NAME}"
sed -i "s|{{DEVICE_TYPE}}|${DEVICE_TYPE}|g" "${{ matrix.target }}"
sed -i "s|{{GITHUB_SHA}}|${GITHUB_SHA}|g" "${{ matrix.target }}"
sed -i "s|{{BUILD_DOWNLOAD_URL}}|${BUILD_DOWNLOAD_URL}|g" "${{ matrix.target }}"
sed -i "s|{{BUILD_FILE_NAME}}|${BUILD_FILE_NAME}|g" "${{ matrix.target }}"
sed -i "s|{{GITHUB_RUN_ID}}|${GITHUB_RUN_ID}|g" "${{ matrix.target }}"
cat "${{ matrix.target }}"

- name: Submit ${{ matrix.target }}
timeout-minutes: 20
uses: foundriesio/lava-action@v6
with:
lava_token: ${{ secrets.LAVATOKEN }}
lava_url: 'lava.infra.foundries.io'
job_definition: ${{ matrix.target }}
wait_for_job: true
fail_action_on_failure: false
save_result_as_artifact: true
save_job_details: true

publish-test-results:
name: "Publish Tests Results"
needs: submit-job
runs-on: ubuntu-latest
permissions:
checks: write
pull-requests: write

steps:
- name: Download Artifacts
uses: actions/download-artifact@v4
with:
path: artifacts

- name: "List files"
run: |
echo $GITHUB_WORKSPACE
ls -R $GITHUB_WORKSPACE

- name: Publish Test Results
uses: EnricoMi/publish-unit-test-result-action@v2
with:
files: "${{ github.workspace }}/artifacts/**/*.xml"

- name: Publish Test Job Details
run: |
for json_file in $(find ${{ github.workspace }} -name "test-job-*.json")
do
DEVICE_TYPE=$(cat "$json_file" | jq -r ".requested_device_type")
URL=$(cat "$json_file" | jq -r ".url")
JOB_ID=$(cat "$json_file" | jq -r ".id")
echo " * [Job $JOB_ID on $DEVICE_TYPE]($URL)"
echo " * [Job $JOB_ID on $DEVICE_TYPE]($URL)" >> $GITHUB_STEP_SUMMARY
done
66 changes: 66 additions & 0 deletions ci/lava/qcs6490-rb3gen2-core-kit/boot.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
actions:
- deploy:
images:
image:
headers:
Authentication: Q_GITHUB_TOKEN
url: "{{BUILD_DOWNLOAD_URL}}"
postprocess:
docker:
image: ghcr.io/foundriesio/lava-lmp-sign:main
steps:
- export IMAGE_PATH=$PWD
- cp overlay*.tar.gz overlay.tar.gz
- echo "OVERLAY=overlay.tar.gz" >> $IMAGE_PATH/flash.settings
- echo "OVERLAY_PATH=/home/" >> $IMAGE_PATH/flash.settings
- echo "ROOTFS_IMAGE=disk-ufs.img2" >> $IMAGE_PATH/flash.settings
- echo "DEVICE_TYPE=debian-rb3gen2-vision-kit" >> $IMAGE_PATH/flash.settings
- cat $IMAGE_PATH/flash.settings
timeout:
minutes: 5
to: downloads
- deploy:
images:
image:
url: downloads://{{BUILD_FILE_NAME}}
settings:
url: downloads://flash.settings
overlay:
url: downloads://overlay.tar.gz
timeout:
minutes: 5
to: flasher
- boot:
auto_login:
login_prompt: 'login:'
username: root
method: minimal
prompts:
- root@debian
timeout:
minutes: 3
- test:
definitions:
- from: git
name: "smoke-test"
path: automated/linux/smoke/smoke.yaml
repository: https://github.com/linaro/test-definitions.git
parameters:
SKIP_INSTALL: "True"
TESTS: "pwd, uname -a, ip a"
- command:
name: network_turn_on
context:
lava_test_results_dir: /home/lava-%s
test_character_delay: 10
device_type: qcs6490
job_name: boot test (rb3gen2) {{GITHUB_RUN_ID}}
metadata:
build-commit: '{{GITHUB_SHA}}'
priority: 50
tags:
- cambridge-lab
timeouts:
job:
minutes: 15
visibility: public
Loading
Loading