Before start of using Testing Farm as GitHub Action in your projects, there are several steps which you have to do it.
Before any implementation as Testing Farm team for API_KEY here onboarding.
Public ranch is used for testing your upstream repository on Fedora, CentOS 7, and CentOS Stream guests.
Private ranch is used for testing your upstream repository on RHEL and Oracle-linux guests.
In your GitHub or GitLab repos create:
- .fmf directory with file version which contains 1.
- plans directory which will contain TMT plans for Testing Farm.
- create a TMT plan like it is already done here c9s.
- The TMT plan contains instructions how to setup, install and execute tests on guest provided by Testing Farm. For more information see documentation or take an inspiration from our plans directory.
To create a TMT plan by tmt
tool, run a command:
$ tmt init --template mini
How to validate your TMT plans locally? Run a command:
$ tmt plans lint
How to test your TMT plans locally? Run a command:
$ tmt run plan --name <your TMT plan name>
How can TMT plan can look like?
summary: TMT/TFT plan for tests on your host
description: |
Run tests on host
discover:
how: shell
tests:
- name: Run your tests on specific host
framework: shell
test: <run your test suite in a specific directory>
duration: 3h
prepare:
- name: Install important packages for your tests
how: shell
script: |
# install packages on guest system
- name: Clone repo and switch to the PR
how: shell
script: |
# Testing Farm does not know where the repo is, so first clone it
git clone $REPO_URL /tmp/$REPO_NAME
cd /tmp/$REPO_NAME
git fetch origin +refs/pull/*:refs/remotes/origin/pr/*
git checkout origin/pr/$PR_NUMBER/head
git submodule update --init
execute:
how: tmt
As soon as you have your TMT plan ready then let's create an GitHub Actions for your use case
Create a directory .github/workflows
in your GitHub repository.
Create a file like testing-farm-pr.yml
The file can look like as is mentioned in README.md
Create a file like testing-farm-merge.yml
The file can look like as is mentioned in README.md