-
Notifications
You must be signed in to change notification settings - Fork 99
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'refactor-workflows' into ref-dry-workflows
- Loading branch information
Showing
44 changed files
with
1,130 additions
and
453 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
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 |
---|---|---|
|
@@ -209,127 +209,38 @@ jobs: | |
|
||
# Test that Zebra works using the default config with the latest Zebra version. | ||
test-configuration-file: | ||
name: Test Zebra default Docker config file | ||
timeout-minutes: 15 | ||
runs-on: ubuntu-latest | ||
name: Test default config file | ||
needs: build | ||
steps: | ||
- uses: r7kamura/[email protected] | ||
|
||
- name: Inject slug/short variables | ||
uses: rlespinasse/github-slug-action@v4 | ||
with: | ||
short-length: 7 | ||
|
||
- name: Run tests using the default config | ||
run: | | ||
docker pull ${{ vars.GAR_BASE }}/${{ vars.CI_IMAGE_NAME }}:sha-${{ env.GITHUB_SHA_SHORT }} | ||
docker run -e NETWORK --detach --name default-conf-tests -t ${{ vars.GAR_BASE }}/${{ vars.CI_IMAGE_NAME }}:sha-${{ env.GITHUB_SHA_SHORT }} zebrad start | ||
# Use a subshell to handle the broken pipe error gracefully | ||
( | ||
trap "" PIPE; | ||
docker logs \ | ||
--tail all \ | ||
--follow \ | ||
default-conf-tests | \ | ||
tee --output-error=exit /dev/stderr | \ | ||
grep --max-count=1 --extended-regexp --color=always \ | ||
-e "net.*=.*Main.*estimated progress to chain tip.*BeforeOverwinter" | ||
) || true | ||
LOGS_EXIT_STATUS=$? | ||
docker stop default-conf-tests | ||
EXIT_STATUS=$(docker wait default-conf-tests || echo "Error retrieving exit status"); | ||
echo "docker exit status: $EXIT_STATUS"; | ||
# If grep found the pattern, exit with the Docker container exit status | ||
if [ $LOGS_EXIT_STATUS -eq 0 ]; then | ||
exit $EXIT_STATUS; | ||
fi | ||
# Handle other potential errors here | ||
echo "An error occurred while processing the logs."; | ||
exit 1; | ||
env: | ||
NETWORK: Mainnet | ||
uses: ./.github/workflows/sub-test-zebra-config.yml | ||
with: | ||
test_id: 'default-conf' | ||
grep_patterns: '-e "net.*=.*Main.*estimated progress to chain tip.*BeforeOverwinter"' | ||
test_variables: '-e NETWORK' | ||
network: 'Mainnet' | ||
|
||
# Test reconfiguring the docker image for testnet. | ||
# Test reconfiguring the the docker image for tesnet. | ||
test-configuration-file-testnet: | ||
name: Test Zebra testnet Docker config file | ||
timeout-minutes: 15 | ||
runs-on: ubuntu-latest | ||
name: Test testnet config file | ||
needs: build | ||
steps: | ||
- uses: r7kamura/[email protected] | ||
|
||
- name: Inject slug/short variables | ||
uses: rlespinasse/github-slug-action@v4 | ||
with: | ||
short-length: 7 | ||
|
||
# Make sure Zebra can sync the genesis block on testnet | ||
- name: Run tests using a testnet config | ||
run: | | ||
docker pull ${{ vars.GAR_BASE }}/${{ vars.CI_IMAGE_NAME }}:sha-${{ env.GITHUB_SHA_SHORT }} | ||
docker run -e NETWORK -e ZEBRA_CONF_PATH -e ENTRYPOINT_FEATURES='' --detach --name testnet-conf-tests -t ${{ vars.GAR_BASE }}/${{ vars.CI_IMAGE_NAME }}:sha-${{ env.GITHUB_SHA_SHORT }} zebrad start | ||
# Use a subshell to handle the broken pipe error gracefully | ||
( | ||
trap "" PIPE; | ||
docker logs \ | ||
--tail all \ | ||
--follow \ | ||
testnet-conf-tests | \ | ||
tee --output-error=exit /dev/stderr | \ | ||
grep --max-count=1 --extended-regexp --color=always \ | ||
-e "net.*=.*Test.*estimated progress to chain tip.*Genesis" \ | ||
-e "net.*=.*Test.*estimated progress to chain tip.*BeforeOverwinter"; | ||
) || true | ||
LOGS_EXIT_STATUS=$? | ||
docker stop testnet-conf-tests | ||
EXIT_STATUS=$(docker wait testnet-conf-tests || echo "Error retrieving exit status"); | ||
echo "docker exit status: $EXIT_STATUS"; | ||
# If grep found the pattern, exit with the Docker container exit status | ||
if [ $LOGS_EXIT_STATUS -eq 0 ]; then | ||
exit $EXIT_STATUS; | ||
fi | ||
# Handle other potential errors here | ||
echo "An error occurred while processing the logs."; | ||
exit 1; | ||
env: | ||
ZEBRA_CONF_PATH: '/etc/zebrad/zebrad.toml' | ||
NETWORK: Testnet | ||
# Make sure Zebra can sync the genesis block on testnet | ||
uses: ./.github/workflows/sub-test-zebra-config.yml | ||
with: | ||
test_id: 'testnet-conf' | ||
grep_patterns: '-e "net.*=.*Test.*estimated progress to chain tip.*Genesis" -e "net.*=.*Test.*estimated progress to chain tip.*BeforeOverwinter"' | ||
# TODO: improve the entrypoint to avoid using `ENTRYPOINT_FEATURES=""` | ||
test_variables: '-e NETWORK -e ZEBRA_CONF_PATH="/etc/zebrad/zebrad.toml" -e ENTRYPOINT_FEATURES=""' | ||
network: 'Testnet' | ||
|
||
# Test that Zebra works using the $ZEBRA_CONF_PATH config | ||
# Test that Zebra works using $ZEBRA_CONF_PATH config | ||
test-zebra-conf-path: | ||
name: Test Zebra custom Docker config file | ||
timeout-minutes: 15 | ||
runs-on: ubuntu-latest | ||
name: Test custom config file | ||
needs: build | ||
steps: | ||
- uses: r7kamura/[email protected] | ||
|
||
- name: Inject slug/short variables | ||
uses: rlespinasse/github-slug-action@v4 | ||
with: | ||
short-length: 7 | ||
|
||
- name: Run tests using the $ZEBRA_CONF_PATH | ||
run: | | ||
set -ex | ||
docker pull ${{ vars.GAR_BASE }}/${{ vars.CI_IMAGE_NAME }}:sha-${{ env.GITHUB_SHA_SHORT }} | ||
docker run -e NETWORK --detach -e ZEBRA_CONF_PATH --name variable-conf-tests -t ${{ vars.GAR_BASE }}/${{ vars.CI_IMAGE_NAME }}:sha-${{ env.GITHUB_SHA_SHORT }} zebrad start | ||
EXIT_STATUS=$(docker logs --tail all --follow variable-conf-tests 2>&1 | grep -q --extended-regexp --max-count=1 -e 'v1.0.0-rc.2.toml'; echo $?; ) | ||
docker stop variable-conf-tests | ||
docker logs variable-conf-tests | ||
exit "$EXIT_STATUS" | ||
env: | ||
ZEBRA_CONF_PATH: 'zebrad/tests/common/configs/v1.0.0-rc.2.toml' | ||
NETWORK: ${{ inputs.network || vars.ZCASH_NETWORK }} | ||
uses: ./.github/workflows/sub-test-zebra-config.yml | ||
with: | ||
test_id: 'custom-conf' | ||
grep_patterns: '-e "v1.0.0-rc.2.toml"' | ||
test_variables: '-e NETWORK -e ZEBRA_CONF_PATH="zebrad/tests/common/configs/v1.0.0-rc.2.toml"' | ||
network: ${{ inputs.network || vars.ZCASH_NETWORK }} | ||
|
||
failure-issue: | ||
name: Open or update issues for main branch failures | ||
|
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,75 @@ | ||
name: Test Zebra Config Files | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
# Status and logging | ||
test_id: | ||
required: true | ||
type: string | ||
description: 'Unique identifier for the test' | ||
grep_patterns: | ||
required: true | ||
type: string | ||
description: 'Patterns to grep for in the logs' | ||
|
||
# Test selection and parameters | ||
test_variables: | ||
required: true | ||
type: string | ||
description: 'Environmental variables used to select and configure the test' | ||
network: | ||
required: false | ||
type: string | ||
default: Mainnet | ||
description: 'Zcash network to test against' | ||
|
||
jobs: | ||
test-docker-config: | ||
name: Test ${{ inputs.test_id }} in Docker | ||
timeout-minutes: 15 | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/[email protected] | ||
with: | ||
persist-credentials: false | ||
|
||
- name: Inject slug/short variables | ||
uses: rlespinasse/github-slug-action@v4 | ||
with: | ||
short-length: 7 | ||
|
||
- uses: r7kamura/[email protected] | ||
|
||
- name: Run ${{ inputs.test_id }} test | ||
run: | | ||
docker pull ${{ vars.GAR_BASE }}/${{ vars.CI_IMAGE_NAME }}:sha-${{ env.GITHUB_SHA_SHORT }} | ||
docker run ${{ inputs.test_variables }} --detach --name ${{ inputs.test_id }} -t ${{ vars.GAR_BASE }}/${{ vars.CI_IMAGE_NAME }}:sha-${{ env.GITHUB_SHA_SHORT }} zebrad start | ||
# Use a subshell to handle the broken pipe error gracefully | ||
( | ||
trap "" PIPE; | ||
docker logs \ | ||
--tail all \ | ||
--follow \ | ||
${{ inputs.test_id }} | \ | ||
tee --output-error=exit /dev/stderr | \ | ||
grep --max-count=1 --extended-regexp --color=always \ | ||
${{ inputs.grep_patterns }} | ||
) || true | ||
LOGS_EXIT_STATUS=$? | ||
docker stop ${{ inputs.test_id }} | ||
EXIT_STATUS=$(docker wait ${{ inputs.test_id }} || echo "Error retrieving exit status"); | ||
echo "docker exit status: $EXIT_STATUS"; | ||
# If grep found the pattern, exit with the Docker container exit status | ||
if [ $LOGS_EXIT_STATUS -eq 0 ]; then | ||
exit $EXIT_STATUS; | ||
fi | ||
# Handle other potential errors here | ||
echo "An error occurred while processing the logs."; | ||
exit 1; | ||
env: | ||
NETWORK: '${{ inputs.network }}' |
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.