Skip to content

Commit

Permalink
feat: make it possible to skip tests to just upload the web UI (#8)
Browse files Browse the repository at this point in the history
  • Loading branch information
skylenet authored Feb 14, 2025
1 parent 2587ce4 commit 3b96e9a
Show file tree
Hide file tree
Showing 3 changed files with 65 additions and 6 deletions.
23 changes: 23 additions & 0 deletions .github/workflows/test-skip-tests.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Test - Skip tests
on:
pull_request:
branches:
- master
push:
branches:
- master

jobs:
run:
runs-on: ubuntu-latest
concurrency:
group: "test-skip-tests-${{ github.head_ref || github.ref }}"
cancel-in-progress: true
steps:
- uses: actions/checkout@v4
- uses: ./
with:
client: go-ethereum
simulator: ethereum/sync
workflow_artifact_upload: true
skip_tests: true
15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ Here are some examples of how this action is used in other repositories:
| `client` | Client to test | Yes | `go-ethereum` |
| `client_config` | Client configuration in YAML format | No | - |
| `extra_flags` | Additional flags to pass to hive | No | - |
| `skip_tests` | Skip tests. Useful when used together with input.website_upload = "true" to upload the website without running tests. | No | `false` |

### Hive Configuration

Expand Down Expand Up @@ -120,6 +121,19 @@ Afterwards you just need to reference the secret for the `rclone_config` input.
rclone_config: ${{ secrets.RCLONE_CONFIG }}
```

### Just upload the website using hiveview without running tests

```yaml
- uses: ethpandaops/[email protected]
with:
website_upload: true # This is required to upload the website
skip_tests: true # This is required to skip the tests
s3_upload: true
s3_bucket: my-bucket
s3_path: my-path
rclone_config: ${{ secrets.RCLONE_CONFIG }}
```

### Uploading the results directory as an GitHub workflow artifact

This will upload the test results as a workflow artifact. By default the artifact prefix will be the simulator and client name. You can override this by providing a `workflow_artifact_prefix` input.
Expand All @@ -131,6 +145,7 @@ This will upload the test results as a workflow artifact. By default the artifac
workflow_artifact_upload: true
# workflow_artifact_prefix: my-custom-prefix
```

## Local testing and development

To test the action locally, you can run [act](https://github.com/nektos/act) with the following command:
Expand Down
33 changes: 27 additions & 6 deletions action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@ inputs:
description: 'Additional flags for hive'
required: false
type: string
skip_tests:
description: 'Skip tests. Useful when used together with input.website_upload = "true" to upload the website without running tests.'
required: false
type: string
default: 'false'
# Hive configuration
hive_repository:
description: 'Hive repository to use'
Expand Down Expand Up @@ -121,6 +126,7 @@ runs:
echo "CLIENT_CONFIG_FLAG=--client-file=client-config.yaml" >> $GITHUB_ENV
- name: Run hive tests
if: inputs.skip_tests != 'true'
working-directory: ./src
shell: bash
run: |
Expand All @@ -142,8 +148,15 @@ runs:
exit 1
fi
- name: Inform of skipped tests
if: inputs.skip_tests == 'true'
shell: bash
run: |
echo "RUN_SUCCESS=true" >> $GITHUB_ENV
echo "Tests were skipped"
- name: Set artifact name
if: ${{ inputs.workflow_artifact_upload == 'true'}}
if: ${{ inputs.workflow_artifact_upload == 'true' && inputs.skip_tests != 'true' }}
shell: bash
run: |
if [ -n "${{ inputs.workflow_artifact_prefix }}" ]; then
Expand All @@ -157,14 +170,14 @@ runs:
fi
- name: Upload test results as workflow artifact
if: ${{ inputs.workflow_artifact_upload == 'true'}}
if: ${{ inputs.workflow_artifact_upload == 'true' && inputs.skip_tests != 'true' }}
uses: actions/upload-artifact@v4
with:
name: ${{ env.WORKFLOW_ARTIFACT_PREFIX }}-results.zip
path: src/results

- name: Upload client config as workflow artifact
if: ${{ inputs.workflow_artifact_upload == 'true' && inputs.client_config != '' }}
if: ${{ inputs.workflow_artifact_upload == 'true' && inputs.client_config != '' && inputs.skip_tests != 'true' }}
uses: actions/upload-artifact@v4
with:
name: ${{ env.WORKFLOW_ARTIFACT_PREFIX }}-client-config.yaml
Expand All @@ -178,7 +191,7 @@ runs:
version: ${{ inputs.rclone_version }}

- name: Upload results to S3
if: ${{ inputs.s3_upload == 'true' && env.RUN_SUCCESS == 'true' }}
if: ${{ inputs.s3_upload == 'true' && env.RUN_SUCCESS == 'true' && inputs.skip_tests != 'true' }}
shell: bash
run: |
rclone copy --no-traverse --exclude "hive.json" src/results s3:${{ inputs.s3_bucket }}/${{ inputs.s3_path }}/results
Expand All @@ -205,7 +218,15 @@ runs:
./hiveview --listing --logdir tmp_results > listing.jsonl
rclone copy listing.jsonl s3:${{ inputs.s3_bucket }}/${{ inputs.s3_path }}/
- name: Inform that only the website was uploaded
if: inputs.skip_tests == 'true' && inputs.website_upload == 'true'
shell: bash
run: |
echo "" >> $GITHUB_STEP_SUMMARY
echo "No tests were run. Just the website was uploaded and the index was updated." >> $GITHUB_STEP_SUMMARY
- name: Generate summary
if: inputs.skip_tests != 'true'
shell: bash
run: |
# Add the command executed
Expand All @@ -216,7 +237,7 @@ runs:
echo "\`\`\`" >> $GITHUB_STEP_SUMMARY
- name: Generate summary for client config
if: ${{ inputs.client_config != '' }}
if: ${{ inputs.client_config != '' && inputs.skip_tests != 'true' }}
shell: bash
run: |
echo "" >> $GITHUB_STEP_SUMMARY
Expand All @@ -230,7 +251,7 @@ runs:
echo "</details>" >> $GITHUB_STEP_SUMMARY
- name: Convert JSON results to markdown summaries
if: env.RUN_SUCCESS == 'true'
if: env.RUN_SUCCESS == 'true' && inputs.skip_tests != 'true'
shell: bash
run: |
set -x
Expand Down

0 comments on commit 3b96e9a

Please sign in to comment.