Skip to content

Release 0.23.0 rc.7 #4466

Release 0.23.0 rc.7

Release 0.23.0 rc.7 #4466

Workflow file for this run

# TODO the next great simplification might be deploying multiple examples to one dfx replica instance: https://forum.dfinity.org/t/use-the-same-local-replica-for-multiple-projects/11900
# TODO this might allow us to avoid spinning up so many jobs in the matrix
# This GitHub Action flow works as follows:
# The tests are currently simple example-based integration tests.
# Each directory in the examples 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.
# Tests can either run against the current code of Azle found in the repository, or the code deployed by the GitHub Action to npm.
# Feature branch pull requests (pull requests without release-- in the base branch name) will run all tests against the code found in the repository.
# Release branch pull requests (pull requests with release-- in the base branch name) will run all tests against the code found in the repository and the code deployed by the GitHub Action to npm.
# Pushes to main will run all tests against the code in the repository if the latest commit was not a merge of a release branch, and will run tests against the code in the repository and the code deployed by the GitHub Action to npm otherwise.
# The basic-integration-tests matrix spins up one job per combination of example directory and code source (repo or npm).
# The check-basic-integration-tests-success job is designed to ensure that all jobs spun up from the matrix in the basic-integration-tests have succeeded
# TODO Restore when https://github.com/demergent-labs/azle/issues/1799 is resolved
# "examples/run_time_errors",
# TODO are these examples ever going to be added back into here?
# "examples/plugins",
# "examples/primitive_ops",
name: Azle Tests
on:
push:
branches:
- main
pull_request: # Runs on pull requests to any branch
jobs:
release-candidate-deploy:
runs-on: ubuntu-latest
env:
GPG_SIGNING_KEY: ${{ secrets.GPG_SIGNING_KEY }} # All commits must be verified
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
outputs:
# These outputs are used to pass information along to the next job
should_run_tests: ${{ steps.should_run_tests.outputs.should_run_tests }} # We only want the next job to run the tests once we have finished deploying to npm and GitHub
example_directories: ${{ steps.example_directories.outputs.example_directories }}
steps:
- uses: actions/checkout@v4
# if: contains(github.head_ref, 'release--')
with:
ref: ${{ contains(github.head_ref, 'release--') && github.event.pull_request.head.ref || github.ref }} # This is necessary for this job to be able to commit and push to the origin remote properly
token: ${{ secrets.LASTMJS_GITHUB_TOKEN || github.token }} # A personal GitHub token is setup as a secret so that committing and pushing to GitHub from the Action will trigger another workflow
- uses: actions/setup-node@v4
with:
node-version: 20
registry-url: https://registry.npmjs.org
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- if: contains(github.head_ref, 'release--')
name: Install dfx
run: |
DFXVM_INIT_YES=true DFX_VERSION=0.20.1 sh -ci "$(curl -fsSL https://sdk.dfinity.org/install.sh)"
echo "$HOME/.local/share/dfx/bin" >> $GITHUB_PATH
# TODO we should use some Action-specific bot account
- if: contains(github.head_ref, 'release--')
run: git config --global user.name 'Jordan Last'
- if: contains(github.head_ref, 'release--')
run: git config --global user.email '[email protected]'
- if: contains(github.head_ref, 'release--')
run: git config --global commit.gpgsign true
- if: contains(github.head_ref, 'release--')
run: echo -n "$GPG_SIGNING_KEY" | base64 --decode | gpg --import
- if: contains(github.head_ref, 'release--')
run: git config --global user.signingkey C8B77BCBE16CD2B94B43F9C8757397B82D4ED7B0
- id: example_directories
# TODO to improve this further we might be able to create an environment variable that grabs the example directories with a glob
# TODO we want to be able to easily include and exclude examples though
run: |
EXAMPLE_DIRECTORIES=$(cat << END
[
"examples/apollo_server",
"examples/async_await",
"examples/audio_and_video",
"examples/audio_recorder",
"examples/autoreload",
"examples/basic_bitcoin",
"examples/bitcoin",
"examples/bitcoin_psbt",
"examples/bitcoinjs_lib",
"examples/bitcore_lib",
"examples/blob_array",
"examples/bytes",
"examples/call_raw",
"examples/candid_encoding",
"examples/candid_keywords",
"examples/canister",
"examples/ckbtc",
"examples/complex_init",
"examples/complex_types",
"examples/composite_queries",
"examples/counter",
"examples/cross_canister_calls",
"examples/cycles",
"examples/date",
"examples/ethereum_json_rpc",
"examples/ethers",
"examples/ethers_base",
"examples/express",
"examples/fetch_ic",
"examples/file_protocol",
"examples/fs",
"examples/func_types",
"examples/heartbeat",
"examples/hello_world",
"examples/http_outcall_fetch",
"examples/hybrid_canister",
"examples/ic_api",
"examples/ic_evm_rpc",
"examples/icrc",
"examples/imports",
"examples/init",
"examples/inspect_message",
"examples/internet_identity",
"examples/key_value_store",
"examples/large_files",
"examples/ledger_canister",
"examples/list_of_lists",
"examples/management_canister",
"examples/manual_reply",
"examples/motoko_examples/calc",
"examples/motoko_examples/counter",
"examples/motoko_examples/echo",
"examples/motoko_examples/factorial",
"examples/motoko_examples/hello",
"examples/motoko_examples/hello-world",
"examples/motoko_examples/http_counter",
"examples/motoko_examples/minimal-counter-dapp",
"examples/motoko_examples/persistent-storage",
"examples/motoko_examples/phone-book",
"examples/motoko_examples/quicksort",
"examples/motoko_examples/simple-to-do",
"examples/motoko_examples/superheroes",
"examples/motoko_examples/threshold_ecdsa",
"examples/motoko_examples/whoami",
"examples/nest",
"examples/new",
"examples/notify_raw",
"examples/null_example",
"examples/open_value_sharing",
"examples/optional_types",
"examples/outgoing_http_requests",
"examples/pre_and_post_upgrade",
"examples/primitive_types",
"examples/principal",
"examples/query",
"examples/randomness",
"examples/recursion",
"examples/rejections",
"examples/robust_imports",
"examples/simple_erc20",
"examples/simple_user_accounts",
"examples/sqlite",
"examples/sqlite_drizzle",
"examples/sqlite_typeorm",
"examples/stable_b_tree_map_instruction_threshold",
"examples/stable_memory",
"examples/stable_structures",
"examples/tfjs",
"examples/timers",
"examples/tuple_types",
"examples/update",
"examples/vanilla_js",
"examples/web_assembly",
"property_tests/tests/blob",
"property_tests/tests/bool",
"property_tests/tests/canister_methods/http_request",
"property_tests/tests/canister_methods/http_request_update",
"property_tests/tests/canister_methods/init",
"property_tests/tests/canister_methods/inspect_message",
"property_tests/tests/canister_methods/post_upgrade",
"property_tests/tests/canister_methods/pre_upgrade",
"property_tests/tests/canister_methods/query",
"property_tests/tests/canister_methods/update",
"property_tests/tests/float32",
"property_tests/tests/float64",
"property_tests/tests/func",
"property_tests/tests/int",
"property_tests/tests/int8",
"property_tests/tests/int16",
"property_tests/tests/int32",
"property_tests/tests/int64",
"property_tests/tests/nat",
"property_tests/tests/nat8",
"property_tests/tests/nat16",
"property_tests/tests/nat32",
"property_tests/tests/nat64",
"property_tests/tests/null",
"property_tests/tests/opt",
"property_tests/tests/principal",
"property_tests/tests/record",
"property_tests/tests/recursive",
"property_tests/tests/service",
"property_tests/tests/stable_b_tree_map",
"property_tests/tests/text",
"property_tests/tests/tuple",
"property_tests/tests/variant",
"property_tests/tests/vec",
"tests/end_to_end/candid_rpc/class_syntax/async_await",
"tests/end_to_end/candid_rpc/class_syntax/audio_recorder",
"tests/end_to_end/candid_rpc/class_syntax/bitcoin",
"tests/end_to_end/candid_rpc/class_syntax/blob_array",
"tests/end_to_end/candid_rpc/class_syntax/bytes",
"tests/end_to_end/candid_rpc/class_syntax/call_raw",
"tests/end_to_end/candid_rpc/class_syntax/candid_encoding",
"tests/end_to_end/candid_rpc/class_syntax/candid_keywords",
"tests/end_to_end/candid_rpc/class_syntax/canister",
"tests/end_to_end/candid_rpc/class_syntax/ckbtc",
"tests/end_to_end/candid_rpc/class_syntax/complex_init",
"tests/end_to_end/candid_rpc/class_syntax/complex_types",
"tests/end_to_end/candid_rpc/class_syntax/composite_queries",
"tests/end_to_end/candid_rpc/class_syntax/counter",
"tests/end_to_end/candid_rpc/class_syntax/cross_canister_calls",
"tests/end_to_end/candid_rpc/class_syntax/cycles",
"tests/end_to_end/candid_rpc/class_syntax/date",
"tests/end_to_end/candid_rpc/class_syntax/ethereum_json_rpc",
"tests/end_to_end/candid_rpc/class_syntax/func_types",
"tests/end_to_end/candid_rpc/class_syntax/heartbeat",
"tests/end_to_end/candid_rpc/class_syntax/ic_api",
"tests/end_to_end/candid_rpc/class_syntax/icrc",
"tests/end_to_end/candid_rpc/class_syntax/imports",
"tests/end_to_end/candid_rpc/class_syntax/init",
"tests/end_to_end/candid_rpc/class_syntax/inspect_message",
"tests/end_to_end/candid_rpc/class_syntax/key_value_store",
"tests/end_to_end/candid_rpc/class_syntax/ledger_canister",
"tests/end_to_end/candid_rpc/class_syntax/list_of_lists",
"tests/end_to_end/candid_rpc/class_syntax/management_canister",
"tests/end_to_end/candid_rpc/class_syntax/manual_reply",
"tests/end_to_end/candid_rpc/class_syntax/motoko_examples/calc",
"tests/end_to_end/candid_rpc/class_syntax/motoko_examples/counter",
"tests/end_to_end/candid_rpc/class_syntax/motoko_examples/echo",
"tests/end_to_end/candid_rpc/class_syntax/motoko_examples/factorial",
"tests/end_to_end/candid_rpc/class_syntax/motoko_examples/hello",
"tests/end_to_end/candid_rpc/class_syntax/motoko_examples/hello-world",
"tests/end_to_end/candid_rpc/class_syntax/motoko_examples/http_counter",
"tests/end_to_end/candid_rpc/class_syntax/motoko_examples/minimal-counter-dapp",
"tests/end_to_end/candid_rpc/class_syntax/motoko_examples/persistent-storage",
"tests/end_to_end/candid_rpc/class_syntax/motoko_examples/phone-book",
"tests/end_to_end/candid_rpc/class_syntax/motoko_examples/quicksort",
"tests/end_to_end/candid_rpc/class_syntax/motoko_examples/simple-to-do",
"tests/end_to_end/candid_rpc/class_syntax/motoko_examples/superheroes",
"tests/end_to_end/candid_rpc/class_syntax/motoko_examples/threshold_ecdsa",
"tests/end_to_end/candid_rpc/class_syntax/motoko_examples/whoami",
"tests/end_to_end/candid_rpc/class_syntax/notify_raw",
"tests/end_to_end/candid_rpc/class_syntax/null_example",
"tests/end_to_end/candid_rpc/class_syntax/optional_types",
"tests/end_to_end/candid_rpc/class_syntax/outgoing_http_requests",
"tests/end_to_end/candid_rpc/class_syntax/pre_and_post_upgrade",
"tests/end_to_end/candid_rpc/class_syntax/primitive_types",
"tests/end_to_end/candid_rpc/class_syntax/principal",
"tests/end_to_end/candid_rpc/class_syntax/query",
"tests/end_to_end/candid_rpc/class_syntax/randomness",
"tests/end_to_end/candid_rpc/class_syntax/recursion",
"tests/end_to_end/candid_rpc/class_syntax/rejections",
"tests/end_to_end/candid_rpc/class_syntax/simple_erc20",
"tests/end_to_end/candid_rpc/class_syntax/simple_user_accounts",
"tests/end_to_end/candid_rpc/class_syntax/stable_b_tree_map_instruction_threshold",
"tests/end_to_end/candid_rpc/class_syntax/stable_memory",
"tests/end_to_end/candid_rpc/class_syntax/stable_structures",
"tests/end_to_end/candid_rpc/class_syntax/timers",
"tests/end_to_end/candid_rpc/class_syntax/tuple_types",
"tests/end_to_end/candid_rpc/class_syntax/update",
"tests/end_to_end/candid_rpc/class_syntax/vanilla_js"
]
END
)
EXAMPLE_DIRECTORIES="${EXAMPLE_DIRECTORIES//'%'/'%25'}"
EXAMPLE_DIRECTORIES="${EXAMPLE_DIRECTORIES//$'\n'/'%0A'}"
EXAMPLE_DIRECTORIES="${EXAMPLE_DIRECTORIES//$'\r'/'%0D'}"
echo "::set-output name=example_directories::$EXAMPLE_DIRECTORIES"
- id: should_run_tests
run: |
BRANCH_NAME="${{ github.head_ref }}"
RELEASE_VERSION="${BRANCH_NAME:9}"
COMMIT_MESSAGE=$(git log -1 --pretty=format:"%s")
if [[ "${{ contains(github.head_ref, 'release--') }}" == "true" && "$COMMIT_MESSAGE" != "azle-bot automated release $RELEASE_VERSION" ]]
then
./publish-github-action.sh $RELEASE_VERSION ${{ toJSON(steps.example_directories.outputs.example_directories) }}
else
echo "::set-output name=should_run_tests::true"
fi
basic-integration-tests:
needs: release-candidate-deploy
runs-on: ${{ matrix.os }}
env:
ETHEREUM_URL: ${{ secrets.ETHEREUM_URL }}
AZLE_IDENTITY_STORAGE_MODE: 'plaintext'
AZLE_END_TO_END_TEST_LINK_AZLE: ${{ matrix.azle_source == 'repo' }}
strategy:
fail-fast: false # We want to see which example tests succeed and which ones fail, we don't want one example test to cancel the rest
matrix:
# os: [macos-latest]
os: [ubuntu-latest]
include_npm:
# Only include npm in the matrix if you've pushed to main and the last commit was a merge of a release branch, or the base branch of the pull request is a release branch
- ${{ (github.ref == 'refs/heads/main' && contains(github.event.head_commit.message, 'Merge pull request') && contains(github.event.head_commit.message, 'demergent-labs/release--')) || contains(github.head_ref, 'release--') }}
azle_source:
- npm
- repo
exclude:
- include_npm: false
azle_source: npm
- include_npm: true
azle_source: repo
# If should_run_tests is false, we still want the steps of this job to execute so that check-basic-integration-tests-success will run. We do this by creating an array with one dummy element
example_directories: ${{ needs.release-candidate-deploy.outputs.should_run_tests == 'true' && fromJSON(needs.release-candidate-deploy.outputs.example_directories) || fromJSON('["dummy"]') }}
steps:
- if: ${{ needs.release-candidate-deploy.outputs.should_run_tests }}
uses: actions/checkout@v4
- if: ${{ needs.release-candidate-deploy.outputs.should_run_tests }}
uses: actions/setup-node@v4
with:
node-version: 20
- if: ${{ needs.release-candidate-deploy.outputs.should_run_tests }}
name: Install dfx
run: |
DFXVM_INIT_YES=true DFX_VERSION=0.20.1 sh -ci "$(curl -fsSL https://sdk.dfinity.org/install.sh)"
echo "$HOME/.local/share/dfx/bin" >> $GITHUB_PATH
- if: ${{ needs.release-candidate-deploy.outputs.should_run_tests && matrix.os == 'macos-latest' }}
shell: bash -l {0}
# The DNS server stuff is because of this: https://github.com/actions/runner-images/issues/6383
run: |
sudo networksetup -setdnsservers Ethernet 9.9.9.9
- if: ${{ needs.release-candidate-deploy.outputs.should_run_tests }}
shell: bash -l {0} # TODO figure out why this is here and comment about it
run: npm install
- if: ${{ needs.release-candidate-deploy.outputs.should_run_tests && matrix.azle_source == 'repo' }}
shell: bash -l {0}
run: npm link
- if: ${{ needs.release-candidate-deploy.outputs.should_run_tests }}
shell: bash -l {0}
run: npm run lint
- if: ${{ needs.release-candidate-deploy.outputs.should_run_tests }}
shell: bash -l {0}
working-directory: ${{ matrix.example_directories }}
run: npm install
- if: ${{ needs.release-candidate-deploy.outputs.should_run_tests && matrix.azle_source == 'repo' }}
shell: bash -l {0}
working-directory: ${{ matrix.example_directories }}
run: npm link azle
- if: ${{ needs.release-candidate-deploy.outputs.should_run_tests }}
working-directory: ${{ matrix.example_directories }}
run: npx azle install-dfx-extension
- if: ${{ needs.release-candidate-deploy.outputs.should_run_tests }}
working-directory: ${{ matrix.example_directories }}
run: dfx start --clean --background --host 127.0.0.1:8000
- if: ${{ needs.release-candidate-deploy.outputs.should_run_tests && !contains(github.head_ref, 'release--') && !(github.ref == 'refs/heads/main' && contains(github.event.head_commit.message, 'Merge pull request') && contains(github.event.head_commit.message, 'demergent-labs/release--')) }}
shell: bash -l {0}
working-directory: ${{ matrix.example_directories }}
run: AZLE_PROPTEST_NUM_RUNS=5 AZLE_PROPTEST_VERBOSE=true npm test
- if: ${{ needs.release-candidate-deploy.outputs.should_run_tests && contains(github.head_ref, 'release--') && !(github.ref == 'refs/heads/main' && contains(github.event.head_commit.message, 'Merge pull request') && contains(github.event.head_commit.message, 'demergent-labs/release--')) }}
shell: bash -l {0}
working-directory: ${{ matrix.example_directories }}
run: AZLE_PROPTEST_NUM_RUNS=10 AZLE_PROPTEST_VERBOSE=true npm test
- if: ${{ needs.release-candidate-deploy.outputs.should_run_tests && (github.ref == 'refs/heads/main' && contains(github.event.head_commit.message, 'Merge pull request') && contains(github.event.head_commit.message, 'demergent-labs/release--')) }}
shell: bash -l {0}
working-directory: ${{ matrix.example_directories }}
run: AZLE_PROPTEST_NUM_RUNS=100 AZLE_PROPTEST_VERBOSE=true npm test
check-basic-integration-tests-success:
needs: basic-integration-tests
runs-on: ubuntu-latest
if: success()
steps:
- run: exit 0
check-basic-integration-tests-failure:
needs: basic-integration-tests
runs-on: ubuntu-latest
if: failure()
steps:
- run: exit 1