Skip to content

Commit

Permalink
ci: Add tft plan and workflow
Browse files Browse the repository at this point in the history
This change is for running tests in Testing Farm CI. This is a replacement for
BaseOS CI that we are currently using. Running it Testing Farm gives us more
control.

It adds a workflow for running tests, and a plans directory containing a test
plan and a README-plans.md with some info.

Note that this workflow runs from the main branch. This means that changes to
the workflow must be merged to main, then pull requests will be able to run it.
This is because the workflow uses on: issue_comment context, this is a security
measure recommended by GitHub. It saves us from leaking organization secrets.

The functionality is WIP, so await future fixes and updates.

Signed-off-by: Sergei Petrosian <[email protected]>
  • Loading branch information
spetrosi committed Jul 24, 2024
1 parent 4061094 commit 3aa23b3
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions .github/workflows/tft.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ jobs:
if: |
github.event.issue.pull_request
&& (contains(github.event.comment.body, '[citest]') || contains(github.event.comment.body, '[citest-all]'))
&& (contains(fromJson('["OWNER", "MEMBER", "COLLABORATOR"]'), github.event.comment.author_association) || contains('systemroller', github.event.comment.user.login))
&& (contains(fromJson('["OWNER", "MEMBER", "COLLABORATOR", "CONTRIBUTOR"]'), github.event.comment.author_association)
|| contains('systemroller', github.event.comment.user.login))
runs-on: ubuntu-latest
outputs:
supported_platforms: ${{ steps.supported_platforms.outputs.supported_platforms }}
Expand Down Expand Up @@ -51,7 +52,9 @@ jobs:
- name: Get memory
id: memory
run: |
memory=$(grep -rPo ' m: \K(.*)' tests/provision.fmf)
if [ -d tests/provision.fmf ]; then
memory=$(grep -rPo ' m: \K(.*)' tests/provision.fmf)
fi
if [ -n "$memory" ]; then
echo "memory=$memory" >> $GITHUB_OUTPUT
else
Expand Down Expand Up @@ -119,16 +122,17 @@ jobs:
with:
sha: ${{ needs.prepare_vars.outputs.head_sha }}
status: pending
context: ${{ matrix.platform }}/ansible-${{ matrix.ansible_version }}
context: ${{ matrix.platform }}|ansible-${{ matrix.ansible_version }}
description: Test started
targetUrl: ""

- name: Set commit status as success with a description that platform is skipped
if: "!contains(needs.prepare_vars.outputs.supported_platforms, matrix.platform)"
uses: myrotvorets/set-commit-status-action@master
with:
sha: ${{ needs.prepare_vars.outputs.head_sha }}
status: success
context: ${{ matrix.platform }}/ansible-${{ matrix.ansible_version }}
context: ${{ matrix.platform }}|ansible-${{ matrix.ansible_version }}
description: The role does not support this platform. Skipping.
targetUrl: ""

Expand Down Expand Up @@ -168,5 +172,6 @@ jobs:
with:
sha: ${{ needs.prepare_vars.outputs.head_sha }}
status: ${{ job.status }}
context: ${{ matrix.platform }}|ansible-${{ matrix.ansible_version }}
description: Test finished
targetUrl: ${{ env.ARTIFACTS_URL }}
context: ${{ matrix.platform }}/ansible-${{ matrix.ansible_version }}

0 comments on commit 3aa23b3

Please sign in to comment.