Skip to content

Commit

Permalink
feat: test alternative workflow with inline job definition
Browse files Browse the repository at this point in the history
  • Loading branch information
boukeas committed May 7, 2024
1 parent e423f94 commit 9be2ccc
Showing 1 changed file with 108 additions and 0 deletions.
108 changes: 108 additions & 0 deletions .github/workflows/checkbox-canary-test-inline.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
name: Fling a checkbox job with Testflinger

on:
push:
branches: [test-action-fling-test]
workflow_dispatch:

jobs:
checkbox-canary-test:
runs-on: [ubuntu-22.04]
strategy:
fail-fast: false
matrix:
include:
- checkbox_runtime: checkbox16
data_source: "distro: xenial"
checkbox_track: uc16
arch: amd64
queue: hp-elitebook-850-g7-notebook-pc

steps:
- name: Checkout checkbox monorepo
uses: actions/checkout@v4

- name: Create job
id: create-job
shell: bash
run: |
OUTPUT_PATH=${{ github.workspace }}/job.yaml
cat << JOB_EOF > $OUTPUT_PATH
job_queue : ${{ matrix.queue }}
global_timeout: 3600
output_timeout: 1800
provision_data:
${{ matrix.data_source }}
test_data:
test_cmds: |
#!/bin/bash
# the machine running this script is the test controller
# it runs on any device that consumes the jobs on given queue name, for instance "202111-29636"
# the controller has a 1:1 relationship with the DUT (device under test)
# to run anything on the DUT, the controller ssh's into the DUT and runs the commands there
# and then in the end runs checkbox to run the actual testing session
# the checkbox run is a typical remote session where the machine running this script is the
# Checkbox Controller and the DUT is the Checkbox Agent
set -x
set -e
# prepare Controller Machine
sudo add-apt-repository -y ppa:checkbox-dev/edge
sudo apt-get -qq update
sudo DEBIAN_FRONTEND=noninteractive apt-get -qq install -y python-cheetah git checkbox-ng
# get the tools necessary to prepare the target device for testing
git -C hwcert-jenkins-tools pull -q || (rm -rf hwcert-jenkins-tools && git clone https://github.com/canonical/hwcert-jenkins-tools.git)
export PATH=\$PATH:hwcert-jenkins-tools/scriptlets
# install checkbox runtime
_run_retry sudo snap install ${{ matrix.checkbox_runtime }} --no-wait --channel=latest/edge
wait_for_snap_complete
# Let's list all the installed snaps for future debugging ease
_run snap list
_run_retry sudo snap install --devmode --channel=${{ matrix.checkbox_track }}/edge checkbox
echo "Installing checkbox in agent container"
CHECKBOX_VERSION=\$(_run checkbox.checkbox-cli --version)
git clone --filter=tree:0 https://github.com/canonical/checkbox.git > /dev/null
hwcert-jenkins-tools/version-published/checkout_to_version.py ~/checkbox "\$CHECKBOX_VERSION"
(cd checkbox/checkbox-ng; sudo python3 setup.py install > /dev/null)
sudo rm -rf checkbox
cat << LAUNCHER_EOF > canary.launcher
[launcher]
launcher_version = 1
stock_reports = certification
[test plan]
unit = com.canonical.certification::canary
forced = yes
[test selection]
forced = true
[ui]
type = silent
LAUNCHER_EOF
# run the canary test plan
PYTHONUNBUFFERED=1 checkbox-cli control \$DEVICE_IP canary.launcher
EXITCODE=\$?
JOB_EOF
echo "job=$OUTPUT_PATH" >> $GITHUB_OUTPUT
- name: Verify job
shell: bash
run:
cat ${{ steps.create-job.outputs.job }}

- name: Submit job
uses: canonical/testflinger/.github/actions/submit@CERTTF-327-github-action-submit
with:
dry-run: true
poll: true
job: ${{ steps.create-job.outputs.job }}

0 comments on commit 9be2ccc

Please sign in to comment.