-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2297 from demergent-labs/test_workflow_dispatch
Test workflow dispatch
- Loading branch information
Showing
10 changed files
with
198 additions
and
191 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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,24 @@ | ||
## Example Usage | ||
|
||
```yaml | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- id: determine-workflow-config | ||
uses: ./.github/actions/determine_workflow_config | ||
with: | ||
is-workflow-dispatch: ${{ github.event_name == 'workflow_dispatch' }} | ||
exclude-slow-dispatch-input-value: ${{ inputs.exclude-slow-tests }} | ||
exclude-unstable-dispatch-input-value: ${{ inputs.exclude-unstable-tests }} | ||
exclude-release-only-dispatch-input-value: ${{ inputs.exclude-release-only-tests }} | ||
link-azle-dispatch-input-value: ${{ inputs.link-azle }} | ||
fuzz-dispatch-input-value: ${{ inputs.fuzz-tests }} | ||
|
||
- name: Use determine-workflow-config outputs | ||
run: | | ||
echo "Exclude slow tests: ${{ steps.determine-workflow-config.outputs.exclude-slow }}" | ||
echo "Exclude unstable tests: ${{ steps.determine-workflow-config.outputs.exclude-unstable }}" | ||
echo "Exclude release only tests: ${{ steps.determine-workflow-config.outputs.exclude-release-only }}" | ||
echo "Link to azle: ${{ steps.determine-workflow-config.outputs.link-azle }}" | ||
echo "Fuzz tests: ${{ steps.determine-workflow-config.outputs.fuzz }}" | ||
``` |
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,82 @@ | ||
name: 'Determine workflow config' | ||
description: 'Determines the workflow configuration based on the current GitHub context' | ||
|
||
inputs: | ||
is-workflow-dispatch: | ||
description: 'Whether this is a workflow dispatch event' | ||
required: true | ||
exclude-slow-dispatch-input-value: | ||
description: 'Workflow dispatch input for excluding slow tests' | ||
required: true | ||
exclude-unstable-dispatch-input-value: | ||
description: 'Workflow dispatch input for excluding unstable tests' | ||
required: true | ||
exclude-release-only-dispatch-input-value: | ||
description: 'Workflow dispatch input for excluding release-only tests' | ||
required: true | ||
fuzz-dispatch-input-value: | ||
description: 'Workflow dispatch input for running fuzz tests' | ||
required: false | ||
default: 'false' | ||
link-azle-dispatch-input-value: | ||
description: 'Workflow dispatch input for linking to the development version of azle' | ||
required: true | ||
|
||
outputs: | ||
exclude-slow: | ||
description: 'Whether to exclude slow tests' | ||
value: ${{ steps.determine_workflow_config.outputs.exclude-slow }} | ||
exclude-unstable: | ||
description: 'Whether to exclude unstable tests' | ||
value: ${{ steps.determine_workflow_config.outputs.exclude-unstable }} | ||
exclude-release-only: | ||
description: 'Whether to exclude release-only tests' | ||
value: ${{ steps.determine_workflow_config.outputs.exclude-release-only }} | ||
link-azle: | ||
description: 'Whether to link to the development version of azle' | ||
value: ${{ steps.determine_workflow_config.outputs.link-azle }} | ||
fuzz: | ||
description: 'Whether to run fuzz tests' | ||
value: ${{ steps.determine_workflow_config.outputs.fuzz }} | ||
|
||
runs: | ||
using: 'composite' | ||
steps: | ||
- id: workflow-context | ||
uses: ./.github/actions/determine_workflow_context | ||
|
||
- id: determine_workflow_config | ||
shell: bash | ||
run: | | ||
if [[ "${{ inputs.is-workflow-dispatch }}" == "true" ]]; then | ||
echo "exclude-slow=${{ inputs.exclude-slow-dispatch-input-value }}" >> $GITHUB_OUTPUT | ||
echo "exclude-unstable=${{ inputs.exclude-unstable-dispatch-input-value }}" >> $GITHUB_OUTPUT | ||
echo "exclude-release-only=${{ inputs.exclude-release-only-dispatch-input-value }}" >> $GITHUB_OUTPUT | ||
echo "link-azle=${{ inputs.link-azle-dispatch-input-value }}" >> $GITHUB_OUTPUT | ||
echo "fuzz=${{ inputs.fuzz-dispatch-input-value }}" >> $GITHUB_OUTPUT | ||
else | ||
EXCLUDE_SLOW=${{ steps.workflow-context.outputs.is_feature_branch_draft_pr == 'true' }} | ||
EXCLUDE_UNSTABLE=${{ steps.workflow-context.outputs.is_feature_branch_draft_pr == 'true' || steps.workflow-context.outputs.is_feature_branch_pr == 'true' }} | ||
EXCLUDE_RELEASE_ONLY=${{ steps.workflow-context.outputs.is_feature_branch_draft_pr == 'true' || steps.workflow-context.outputs.is_feature_branch_pr == 'true' || steps.workflow-context.outputs.is_main_branch_push == 'true' }} | ||
echo "exclude-slow=$EXCLUDE_SLOW" >> $GITHUB_OUTPUT | ||
echo "exclude-unstable=$EXCLUDE_UNSTABLE" >> $GITHUB_OUTPUT | ||
echo "exclude-release-only=$EXCLUDE_RELEASE_ONLY" >> $GITHUB_OUTPUT | ||
if [[ "${{ steps.workflow-context.outputs.is_main_branch_push_from_release_merge }}" == "true" || \ | ||
"${{ steps.workflow-context.outputs.is_release_branch_pr }}" == "true" ]]; then | ||
echo "link-azle=false" >> $GITHUB_OUTPUT | ||
else | ||
echo "link-azle=true" >> $GITHUB_OUTPUT | ||
fi | ||
echo "fuzz=false" >> $GITHUB_OUTPUT | ||
fi | ||
- id: echo-outputs | ||
shell: bash | ||
run: | | ||
echo "Test Conditions Outputs:" | ||
echo "exclude-slow: ${{ steps.determine_workflow_config.outputs.exclude-slow }}" | ||
echo "exclude-unstable: ${{ steps.determine_workflow_config.outputs.exclude-unstable }}" | ||
echo "exclude-release-only: ${{ steps.determine_workflow_config.outputs.exclude-release-only }}" | ||
echo "link-azle: ${{ steps.determine_workflow_config.outputs.link-azle }}" | ||
echo "fuzz: ${{ steps.determine_workflow_config.outputs.fuzz }}" |
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,17 @@ | ||
## Example Usage | ||
|
||
```yaml | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- id: workflow-context | ||
uses: ./.github/actions/determine_workflow_context | ||
|
||
- name: Use run conditions | ||
run: | | ||
echo "Is main branch push: ${{ steps.workflow-context.outputs.is_main_branch_push }}" | ||
echo "Is main branch merge from release push: ${{ steps.workflow-context.outputs.is_main_branch_merge_from_release_push }}" | ||
echo "Is release branch PR: ${{ steps.workflow-context.outputs.is_release_branch_pr }}" | ||
echo "Is feature branch PR: ${{ steps.workflow-context.outputs.is_feature_branch_pr }}" | ||
echo "Is feature branch draft PR: ${{ steps.workflow-context.outputs.is_feature_branch_draft_pr }}" | ||
``` |
16 changes: 8 additions & 8 deletions
16
...hub/actions/set_run_conditions/action.yml → ...ons/determine_workflow_context/action.yml
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 was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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.