Skip to content

add delete branches workflow #5648

add delete branches workflow

add delete branches workflow #5648

Workflow file for this run

# This GitHub Action flow works as follows:
# Each directory in the examples and tests directory represents an example project and is intended to have tests that ensure the canisters contained in that example function properly.
# These tests are currently written in TypeScript and are intended to be run in a Node.js environment.
# This GitHub Action takes care of deploying to npm and GitHub.
name: Test
on:
push:
branches:
- main
pull_request:
jobs:
determine-should-run-tests:
name: Determine if tests should run
runs-on: ubuntu-latest
outputs:
# If the branch should release then it shouldn't run tests.
should-run-tests: ${{ steps.determine-should-run-tests.outputs.should-release == 'false' }}
steps:
- uses: actions/checkout@v4
- id: determine-should-run-tests
uses: ./.github/actions/should_release
set-exclude-dirs:
name: Set exclude directories
runs-on: ubuntu-latest
outputs:
exclude-dirs: ${{ steps.set-exclude-dirs.outputs.exclude-dirs }}
steps:
- uses: actions/checkout@v4
- id: set-conditions
uses: ./.github/actions/set_run_conditions
- id: set-exclude-dirs
run: |
RELEASE_TESTS="${{ format('
tests/end_to_end/candid_rpc/class_syntax/new
tests/end_to_end/http_server/new
') }}"
UNSTABLE_TESTS="${{ format('
examples/basic_bitcoin
examples/bitcoin_psbt
examples/ckbtc
tests/end_to_end/http_server/ethers_base
tests/end_to_end/http_server/http_outcall_fetch
tests/end_to_end/http_server/ic_evm_rpc
tests/property/candid_rpc/class_api/stable_b_tree_map
tests/property/candid_rpc/functional_api/stable_b_tree_map
tests/property/ic_api/performance_counter
tests/property/ic_api/instruction_counter
') }}"
SLOW_TESTS="${{ format('
tests/end_to_end/candid_rpc/functional_syntax/ckbtc
tests/end_to_end/candid_rpc/class_syntax/bitcoin
tests/end_to_end/http_server/large_files
tests/end_to_end/http_server/open_value_sharing
tests/end_to_end/candid_rpc/class_syntax/stable_structures
tests/end_to_end/candid_rpc/functional_syntax/bitcoin
tests/end_to_end/candid_rpc/functional_syntax/composite_queries
tests/end_to_end/candid_rpc/functional_syntax/cross_canister_calls
tests/end_to_end/candid_rpc/functional_syntax/management_canister
tests/end_to_end/candid_rpc/functional_syntax/stable_structures
tests/end_to_end/http_server/autoreload
') }}"
AZLE_IS_MAIN_BRANCH_PUSH="${{ steps.set-conditions.outputs.is_main_branch_push }}"
AZLE_IS_MAIN_BRANCH_PUSH_FROM_RELEASE_MERGE="${{ steps.set-conditions.outputs.is_main_branch_push_from_release_merge }}"
AZLE_IS_RELEASE_BRANCH_PR="${{ steps.set-conditions.outputs.is_release_branch_pr }}"
AZLE_IS_FEATURE_BRANCH_PR="${{ steps.set-conditions.outputs.is_feature_branch_pr }}"
AZLE_IS_FEATURE_BRANCH_DRAFT_PR="${{ steps.set-conditions.outputs.is_feature_branch_draft_pr }}"
EXCLUDE_DIRS=""
if [[ "$AZLE_IS_MAIN_BRANCH_PUSH" == "true" ]]; then
EXCLUDE_DIRS=""
fi
if [[ "$AZLE_IS_MAIN_BRANCH_PUSH_FROM_RELEASE_MERGE" == "true" ]]; then
EXCLUDE_DIRS=""
fi
if [[ "$AZLE_IS_RELEASE_BRANCH_PR" == "true" ]]; then
EXCLUDE_DIRS=""
fi
if [[ "$AZLE_IS_FEATURE_BRANCH_PR" == "true" ]]; then
EXCLUDE_DIRS="$RELEASE_TESTS $UNSTABLE_TESTS"
fi
if [[ "$AZLE_IS_FEATURE_BRANCH_DRAFT_PR" == "true" ]]; then
EXCLUDE_DIRS="$RELEASE_TESTS $UNSTABLE_TESTS $SLOW_TESTS"
fi
# Trim leading or trailing spaces and save the exclude-dirs in the environment
EXCLUDE_DIRS=$(echo $EXCLUDE_DIRS | xargs)
echo "exclude-dirs=$EXCLUDE_DIRS" >> $GITHUB_OUTPUT
run-tests:
name: ${{ matrix.test_group.name }}
needs:
- determine-should-run-tests
- set-exclude-dirs
if: ${{ needs.determine-should-run-tests.outputs.should-run-tests == 'true' }}
strategy:
fail-fast: false
matrix:
test_group:
- { name: 'Examples', directories: './examples' }
- {
name: 'E2E Class',
directories: './tests/end_to_end/candid_rpc/class_syntax'
}
- {
name: 'E2E Functional',
directories: './tests/end_to_end/candid_rpc/functional_syntax'
}
- {
name: 'E2E HTTP Server',
directories: './tests/end_to_end/http_server'
}
- {
name: 'Property Class',
directories: './tests/property/candid_rpc/class_api'
}
- {
name: 'Property Functional',
directories: './tests/property/candid_rpc/functional_api'
}
- {
name: 'Property IC API',
directories: './tests/property/ic_api'
}
uses: ./.github/workflows/get_and_run_tests.yml
with:
directories: ${{ matrix.test_group.directories }}
exclude-dirs: ${{ needs.set-exclude-dirs.outputs.exclude-dirs }}
check-test-success:
name: Check Azle tests succeeded
needs: run-tests
runs-on: ubuntu-latest
if: success()
steps:
- run: exit 0
check-test-failure:
name: Check Azle tests didn't fail
needs: run-tests
runs-on: ubuntu-latest
if: failure()
steps:
- run: exit 1