-
Notifications
You must be signed in to change notification settings - Fork 0
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
ff82fb5
commit a80ff97
Showing
9 changed files
with
295 additions
and
149 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,10 @@ | ||
name: Setup Python | ||
description: | | ||
Consistently installs python across this project. | ||
Should be used as a replacement for direct calls to actions/setup-python. | ||
runs: | ||
using: composite | ||
steps: | ||
- uses: actions/setup-python@v5 | ||
with: | ||
python-version: '3.10' |
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,140 @@ | ||
name: Behave Testing | ||
|
||
# Behave Testing will run the repository's Behave testing with each feature file | ||
# getting its own runner. All feature files found within the specific path are | ||
# included. | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
tags: | ||
type: string | ||
required: true | ||
description: | | ||
The behave tags to use. E.g "full". Multiple tags should be specified | ||
separated by a comma, e.g. "owners,redhat". | ||
pr-body: | ||
type: string | ||
required: true | ||
description: | | ||
Every pull request created by this automation will have this pr-body. | ||
behave-logging-level: | ||
type: string | ||
required: false | ||
default: WARNING | ||
description: | | ||
Value passed to behave's --logging-level flag. | ||
# actions/checkout related inputs used for testing. In some cases behave | ||
# calls will use the PR branch instead of the main branch. E.g. went doing | ||
# release testing | ||
checkout-fetch-depth: | ||
type: number | ||
required: false | ||
default: 1 # aligns with actions/checkout default. | ||
description: | | ||
fetch-depth flag to actions/checkout. | ||
If setting to a pull request, caller is responsible | ||
for verifying the user is a trusted user. | ||
checkout-repository: | ||
type: string | ||
required: false | ||
default: "" | ||
description: | | ||
repository flag to actions/checkout | ||
If setting to a pull request, caller is responsible | ||
for verifying the user is a trusted user. | ||
checkout-ref: | ||
type: string | ||
required: false | ||
default: "" | ||
description: | | ||
ref flag to actions/checkout | ||
If setting to a pull request, caller is responsible | ||
for verifying the user is a trusted user. | ||
secrets: | ||
# NOTE(komish): Not technically secret, but must be listed as a secret | ||
# because you can't pass the ${{ secrets }} context as an input in the | ||
# calling workflow, and our repos have this configured as a secret. | ||
bot-name: | ||
required: true | ||
description: | | ||
The name of the GitHub user that will send pull requests. | ||
bot-token: | ||
description: | | ||
A GitHub token for the bot user that will initiate pull | ||
requests for testing. Should NOT be set to GITHUB_TOKEN. | ||
required: true | ||
jobs: | ||
get-features: | ||
runs-on: ubuntu-latest | ||
outputs: | ||
features: ${{ steps.find-features.outputs.features }} | ||
steps: | ||
- name: Checkout Repo | ||
uses: actions/checkout@v4 | ||
with: | ||
ref: ${{ inputs.checkout-ref }} | ||
repository: ${{ inputs.checkout-repository }} | ||
fetch-depth: ${{ inputs.checkout-fetch-depth }} | ||
- name: find features | ||
id: find-features | ||
# TODO(JOSE) Sanity check - make sure this is more than one feature in length. | ||
run: | | ||
cd tests/functional/behave_features | ||
# echo features=$(find . -name '*.feature' | sed -e 's%\./%%g' | jq -R -s -c 'split("\n") | del(.[] | select(length == 0))') | tee -a $GITHUB_OUTPUT | ||
# NOTE(JOSE): temporarily restrict this to a small number of tests for debugging other things. | ||
# To Revert: remove the next line, and uncomment the line previous this comment. | ||
echo features=$(find . -name '*.feature' | sed -e 's%\./%%g' | jq -R -s -c 'split("\n") | del(.[] | select(length == 0))[:2]') | tee -a $GITHUB_OUTPUT | ||
run-tests: | ||
runs-on: ubuntu-latest | ||
needs: [get-features] | ||
strategy: | ||
fail-fast: false | ||
max-parallel: 4 | ||
matrix: | ||
feature-file: ${{ fromJson(needs.get-features.outputs.features) }} | ||
steps: | ||
- name: Checkout Repo | ||
uses: actions/checkout@v4 | ||
with: | ||
token: ${{ secrets.bot-token }} | ||
ref: ${{ inputs.checkout-ref }} | ||
repository: ${{ inputs.checkout-repository }} | ||
fetch-depth: ${{ inputs.checkout-fetch-depth }} | ||
|
||
- name: Set up Python 3 | ||
uses: ./.github/actions/setup-python | ||
|
||
- name: Set up CI scripts | ||
run: | | ||
# set up python scripts | ||
echo "set up python script in $PWD" | ||
python3 -m venv ve1 | ||
cd scripts | ||
../ve1/bin/pip3 install -r requirements.txt | ||
../ve1/bin/pip3 install . | ||
cd .. | ||
# Pull request numbers are included in generated chart names in E2E, so it's included | ||
# as an environment variable which E2E consumes. | ||
- name: Populate PR_NUMBER environment variable | ||
if: github.event_name == 'pull_request_target' || github.event_name == 'pull_request' | ||
run: | | ||
echo "PR_NUMBER=${{ github.event.pull_request.number }}" | tee $GITHUB_ENV | ||
- name: Run Tests | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.github-token }} | ||
BOT_NAME: ${{ secrets.bot-name }} | ||
BOT_TOKEN: ${{ secrets.bot-token }} | ||
PR_BODY: ${{ inputs.pr-body }} | ||
run: | | ||
ve1/bin/behave tests/functional/behave_features/ \ | ||
--include ${{ matrix.feature-file }} \ | ||
--tags=${{ inputs.tags }} \ | ||
--logging-level=${{ inputs.behave-logging-level }} \ | ||
--no-capture \ | ||
--no-color |
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
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
Oops, something went wrong.