diff --git a/.github/actions/README.md b/.github/actions/README.md new file mode 100644 index 0000000000..26e3fec4df --- /dev/null +++ b/.github/actions/README.md @@ -0,0 +1,10 @@ +## Prerequisite + +These actions assume that the repository has already been checked out before +calling the action, typically using `actions/checkout@v4`. If you have not +checked out the code in a previous step, make sure to do so to avoid errors. + +Unless otherwise specified, these actions do **not** perform a checkout action +themselves because it would be redundant. These actions are part of the +repository's codebase, so if the code hasn't already been checked out, the +actions themselves wouldn't even be available to call. diff --git a/.github/actions/commit_and_push/README.md b/.github/actions/commit_and_push/README.md new file mode 100644 index 0000000000..36391926e8 --- /dev/null +++ b/.github/actions/commit_and_push/README.md @@ -0,0 +1,12 @@ +## Example Usage + +```yaml +steps: + - uses: actions/checkout@v4 + + - uses: ./.github/actions/commit_and_push + with: + gpg_signing_key: ${{ secrets.GPG_SIGNING_KEY }} + branch-name: 'branch-name' + commit-message: 'commit message' +``` diff --git a/.github/actions/commit_and_push/action.yml b/.github/actions/commit_and_push/action.yml new file mode 100644 index 0000000000..3225a29d68 --- /dev/null +++ b/.github/actions/commit_and_push/action.yml @@ -0,0 +1,33 @@ +name: Commit and Push Changes +description: 'Configures git, commits changes, and pushes to a new branch' +inputs: + branch-name: + description: 'Name of the branch to create' + required: true + commit-message: + description: 'Commit message' + required: true + gpg_signing_key: + description: 'The GPG signing key to use for signing commits' + required: true +runs: + using: composite + steps: + - uses: ./.github/actions/configure_git + with: + gpg_signing_key: ${{ inputs.gpg_signing_key }} + + - name: Commit and push changes + shell: bash + run: | + # Create and switch to new branch + git switch -c "${{ inputs.branch-name }}" + + # Show status of working directory + echo "Current git status:" + git status + + # Add and commit changes if there are any + git add --all + git commit -m "${{ inputs.commit-message }}" + git push origin "${{ inputs.branch-name }}" diff --git a/.github/actions/configure_git/README.md b/.github/actions/configure_git/README.md index 19d3e8aea9..856aa89d7a 100644 --- a/.github/actions/configure_git/README.md +++ b/.github/actions/configure_git/README.md @@ -1,14 +1,3 @@ -## Prerequisite - -This action assumes that the repository has already been checked out before -calling the action, typically using `actions/checkout@v4`. If you have not -checked out the code in a previous step, make sure to do so to avoid errors. - -This action does **not** perform a checkout action itself because it would be -redundant. This action is part of the repository's codebase, so if the code -hasn't already been checked out, the action itself wouldn't even be available to -call. - ## Example Usage ```yaml diff --git a/.github/actions/create_branch_name/README.md b/.github/actions/create_branch_name/README.md new file mode 100644 index 0000000000..a8779f1445 --- /dev/null +++ b/.github/actions/create_branch_name/README.md @@ -0,0 +1,13 @@ +## Example Usage + +```yaml +steps: + - id: create-branch-name + uses: ./.github/actions/create_branch_name + with: + prefix: 'update--0.24.2-rc.89-' + path: 'examples/hello_world' +``` + +The action will convert the path to use hyphens instead of slashes and combine it with the prefix. +For example, with the inputs above, it would output: `update--examples-hello_world` diff --git a/.github/actions/create_branch_name/action.yml b/.github/actions/create_branch_name/action.yml new file mode 100644 index 0000000000..39322117f3 --- /dev/null +++ b/.github/actions/create_branch_name/action.yml @@ -0,0 +1,21 @@ +name: Create Branch Name +description: 'Creates a branch name by combining a prefix with a path, converting slashes to hyphens' +inputs: + prefix: + description: 'Prefix for the branch name' + required: true + path: + description: 'Path to convert into branch name' + required: true +outputs: + branch-name: + description: 'The generated branch name' + value: ${{ steps.create-branch-name.outputs.branch-name }} +runs: + using: composite + steps: + - id: create-branch-name + shell: bash + run: | + SAFE_PATH=$(echo '${{ inputs.path }}' | sed 's/\//-/g') + echo "branch-name=${{ inputs.prefix }}${SAFE_PATH}" >> $GITHUB_OUTPUT diff --git a/.github/actions/get_exclude_dirs/README.md b/.github/actions/get_exclude_dirs/README.md new file mode 100644 index 0000000000..3104e1623b --- /dev/null +++ b/.github/actions/get_exclude_dirs/README.md @@ -0,0 +1,15 @@ +## Example Usage + +```yaml +steps: + - uses: actions/checkout@v4 + + - id: get-exclude-dirs + uses: ./.github/actions/get_exclude_dirs + with: + exclude-slow: true + exclude-unstable: true + exclude-release: true + + - run: echo "${{ steps.get-exclude-dirs.outputs.exclude-dirs }}" +``` diff --git a/.github/actions/get_exclude_dirs/action.yml b/.github/actions/get_exclude_dirs/action.yml new file mode 100644 index 0000000000..abc5234560 --- /dev/null +++ b/.github/actions/get_exclude_dirs/action.yml @@ -0,0 +1,71 @@ +name: Get Exclude Directories +description: 'Gets a list of directories to exclude based on input parameters' +inputs: + exclude-slow: + description: 'Whether to exclude slow benchmarks' + required: true + exclude-unstable: + description: 'Whether to exclude unstable benchmarks' + required: true + exclude-release-only: + description: 'Whether to exclude release only benchmarks' + required: true +outputs: + exclude-dirs: + description: 'Space-separated list of directories to exclude' + value: ${{ steps.set-exclude-dirs.outputs.exclude-dirs }} +runs: + using: composite + steps: + - id: set-exclude-dirs + shell: bash + run: | + RELEASE_ONLY_EXCLUSIONS="${{ format(' + tests/end_to_end/candid_rpc/class_syntax/new + tests/end_to_end/http_server/new + ') }}" + + UNSTABLE_EXCLUSIONS="${{ 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_EXCLUSIONS="${{ 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 + ') }}" + + EXCLUDE_DIRS="" + + if [[ "${{ inputs.exclude-release-only }}" == "true" ]]; then + EXCLUDE_DIRS="$EXCLUDE_DIRS $RELEASE_ONLY_EXCLUSIONS" + fi + + if [[ "${{ inputs.exclude-unstable }}" == "true" ]]; then + EXCLUDE_DIRS="$EXCLUDE_DIRS $UNSTABLE_EXCLUSIONS" + fi + + if [[ "${{ inputs.exclude-slow }}" == "true" ]]; then + EXCLUDE_DIRS="$EXCLUDE_DIRS $SLOW_EXCLUSIONS" + 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 diff --git a/.github/actions/get_test_infos/README.md b/.github/actions/get_test_infos/README.md index 7b753ec736..0413d9be94 100644 --- a/.github/actions/get_test_infos/README.md +++ b/.github/actions/get_test_infos/README.md @@ -1,16 +1,3 @@ -## Prerequisite - -This action assumes that the repository has already been checked out before -calling the action, typically using `actions/checkout@v4`. If you have not -checked out the code in a previous step, make sure to do so to avoid errors. - -This action does **not** perform a checkout action itself because it would be -redundant. This action is part of the repository’s codebase, so if the code -hasn’t already been checked out, the action itself wouldn't even be available to -call. Additionally, rerunning a checkout at this stage could potentially -overwrite any earlier `actions/checkout` step with different parameters, such as -checking out a specific branch. - ## Example Usage ```yaml diff --git a/.github/actions/set_run_conditions/README.md b/.github/actions/set_run_conditions/README.md index e33311a3ea..b75f8160f7 100644 --- a/.github/actions/set_run_conditions/README.md +++ b/.github/actions/set_run_conditions/README.md @@ -1,16 +1,3 @@ -## Prerequisite - -This action assumes that the repository has already been checked out before -calling the action, typically using `actions/checkout@v4`. If you have not -checked out the code in a previous step, make sure to do so to avoid errors. - -This action does **not** perform a checkout action itself because it would be -redundant. This action is part of the repository's codebase, so if the code -hasn't already been checked out, the action itself wouldn't even be available to -call. Additionally, rerunning a checkout at this stage could potentially -overwrite any earlier `actions/checkout` step with different parameters, such as -checking out a specific branch. - ## Example Usage ```yaml diff --git a/.github/actions/setup_dfx/README.md b/.github/actions/setup_dfx/README.md index 293d76f9e3..efd52b9fda 100644 --- a/.github/actions/setup_dfx/README.md +++ b/.github/actions/setup_dfx/README.md @@ -1,16 +1,3 @@ -## Prerequisite - -This action assumes that the repository has already been checked out before -calling the action, typically using `actions/checkout@v4`. If you have not -checked out the code in a previous step, make sure to do so to avoid errors. - -This action does **not** perform a checkout action itself because it would be -redundant. This action is part of the repository’s codebase, so if the code -hasn’t already been checked out, the action itself wouldn't even be available to -call. Additionally, rerunning a checkout at this stage could potentially -overwrite any earlier `actions/checkout` step with different parameters, such as -checking out a specific branch. - ## Example Usage ```yaml diff --git a/.github/actions/setup_node/README.md b/.github/actions/setup_node/README.md index 0de04bd24e..637f96e405 100644 --- a/.github/actions/setup_node/README.md +++ b/.github/actions/setup_node/README.md @@ -1,16 +1,3 @@ -## Prerequisite - -This action assumes that the repository has already been checked out before -calling the action, typically using `actions/checkout@v4`. If you have not -checked out the code in a previous step, make sure to do so to avoid errors. - -This action does **not** perform a checkout action itself because it would be -redundant. This action is part of the repository’s codebase, so if the code -hasn’t already been checked out, the action itself wouldn't even be available to -call. Additionally, rerunning a checkout at this stage could potentially -overwrite any earlier `actions/checkout` step with different parameters, such as -checking out a specific branch. - ## Example Usage ```yaml diff --git a/.github/actions/should_release/README.md b/.github/actions/should_release/README.md deleted file mode 100644 index 5c62d4bfd2..0000000000 --- a/.github/actions/should_release/README.md +++ /dev/null @@ -1,19 +0,0 @@ -> [!IMPORTANT] -> This action performs a checkout using `actions/checkout@v4`, specifically -> checking out the `github.event.pull_request.head.ref`. If your workflow -> includes other checkout steps, be mindful that this checkout will override -> previous checkouts, as it checks out a specific branch for the action to -> function correctly. You should consider this when planning future steps in -> your workflow, especially if those steps rely on a different commit or branch. - -## Example Usage - -```yaml -steps: - - uses: actions/checkout@v4 - - - id: should-release - uses: ./.github/actions/should_release - - - run: echo "${{ steps.should-release.outputs.should-release }}" -``` diff --git a/.github/actions/should_release/action.yml b/.github/actions/should_release/action.yml deleted file mode 100644 index 38f1f06ae4..0000000000 --- a/.github/actions/should_release/action.yml +++ /dev/null @@ -1,27 +0,0 @@ -name: Should release -description: Determines if the current pull request is for testing or for starting a release -outputs: - should-release: - description: Returns true if this branch should start a release, otherwise false - value: ${{ steps.determine-should-release.outputs.should-release }} -runs: - using: composite - steps: - - uses: actions/checkout@v4 - with: - ref: ${{ github.event.pull_request.head.ref }} # This is necessary for this job to be able to get the correct commit message from `git log` - - - id: determine-should-release - run: | - BRANCH_NAME="${{ github.head_ref }}" - RELEASE_VERSION="${BRANCH_NAME:9}" - COMMIT_MESSAGE=$(git log -1 --pretty=format:"%s") - IS_RELEASE_BRANCH_PR="${{ startsWith(github.head_ref, 'release--') }}" - - SHOULD_RELEASE="false" - if [[ $IS_RELEASE_BRANCH_PR == "true" && "$COMMIT_MESSAGE" == "release--$RELEASE_VERSION" ]]; then - SHOULD_RELEASE="true" - fi - - echo "should-release=${SHOULD_RELEASE}" >> "$GITHUB_OUTPUT" - shell: bash diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml new file mode 100644 index 0000000000..256ced2b83 --- /dev/null +++ b/.github/workflows/benchmark.yml @@ -0,0 +1,134 @@ +name: Benchmark +on: + workflow_dispatch: + inputs: + exclude-slow-benchmarks: + description: 'Exclude slow benchmarks' + required: true + type: boolean + default: false + exclude-unstable-benchmarks: + description: 'Exclude unstable benchmarks' + required: true + type: boolean + default: false + exclude-release-only-benchmarks: + description: 'Exclude release benchmarks' + required: true + type: boolean + default: false + +jobs: + get-exclude-dirs: + name: Get exclude directories + runs-on: ubuntu-latest + outputs: + exclude-dirs: ${{ steps.get-exclude-dirs.outputs.exclude-dirs }} + steps: + - uses: actions/checkout@v4 + + - id: get-exclude-dirs + uses: ./.github/actions/get_exclude_dirs + with: + exclude-slow: ${{ github.event.inputs.exclude-slow-benchmarks }} + exclude-unstable: ${{ github.event.inputs.exclude-unstable-benchmarks }} + exclude-release-only: ${{ github.event.inputs.exclude-release-only-benchmarks }} + + create-branch-prefix: + name: Create Branch and Branch Prefix + runs-on: ubuntu-latest + outputs: + branch-prefix: ${{ steps.create-prefix.outputs.branch-prefix }} + base-branch: ${{ steps.create-prefix.outputs.base-branch }} + steps: + - uses: actions/checkout@v4 + with: + ref: ${{ github.ref }} + + - id: create-prefix + run: | + VERSION=$(jq -r '.version' package.json) + echo "branch-prefix=benchmark--$VERSION-" >> $GITHUB_OUTPUT + echo "base-branch=benchmark--$VERSION" >> $GITHUB_OUTPUT + + - uses: ./.github/actions/configure_git + with: + gpg_signing_key: ${{ secrets.GPG_SIGNING_KEY }} + + - name: Create base branch + run: | + git checkout -b ${{ steps.create-prefix.outputs.base-branch }} + git push origin ${{ steps.create-prefix.outputs.base-branch }} + + run-benchmarks: + name: ${{ matrix.benchmark_group.name }} + needs: + - get-exclude-dirs + - create-branch-prefix + strategy: + fail-fast: false + matrix: + benchmark_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/benchmark_parallel.yml + secrets: + GPG_SIGNING_KEY: ${{ secrets.GPG_SIGNING_KEY }} + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + LASTMJS_GITHUB_TOKEN: ${{ secrets.LASTMJS_GITHUB_TOKEN }} + with: + directories: ${{ matrix.benchmark_group.directories }} + exclude-dirs: ${{ needs.get-exclude-dirs.outputs.exclude-dirs }} + branch-prefix: ${{ needs.create-branch-prefix.outputs.branch-prefix }} + + squash-branches: + needs: [run-benchmarks, create-branch-prefix] + uses: ./.github/workflows/squash_branches.yml + with: + branch-prefix: ${{ needs.create-branch-prefix.outputs.branch-prefix }} + commit-message: 'run benchmarks' + secrets: + GPG_SIGNING_KEY: ${{ secrets.GPG_SIGNING_KEY }} + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + LASTMJS_GITHUB_TOKEN: ${{ secrets.LASTMJS_GITHUB_TOKEN }} + + create-pr: + needs: [squash-branches, create-branch-prefix] + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + ref: ${{ github.ref }} + + - name: Create Pull Request + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + gh pr create \ + --base ${{ github.ref_name }} \ + --head ${{ needs.create-branch-prefix.outputs.base-branch }} \ + --title "Benchmark Results for ${{ needs.create-branch-prefix.outputs.base-branch }}" \ + --body "Automated PR for benchmark results" diff --git a/.github/workflows/benchmark_parallel.yml b/.github/workflows/benchmark_parallel.yml new file mode 100644 index 0000000000..0b68edfec0 --- /dev/null +++ b/.github/workflows/benchmark_parallel.yml @@ -0,0 +1,88 @@ +name: Parallel Benchmark +on: + workflow_call: + inputs: + directories: + required: true + type: string + exclude-dirs: + required: false + type: string + default: '' + branch-prefix: + required: true + type: string + + secrets: + GPG_SIGNING_KEY: + required: true + GH_TOKEN: + required: true + LASTMJS_GITHUB_TOKEN: + required: true + +jobs: + prepare-benchmark: + name: Prepare Benchmark + runs-on: ubuntu-latest + outputs: + test-infos: ${{ steps.get-test-infos.outputs.test-infos }} + steps: + - uses: actions/checkout@v4 + + - id: get-test-infos + uses: ./.github/actions/get_test_infos + with: + directories: ${{ inputs.directories }} + exclude-dirs: ${{ inputs.exclude-dirs }} + + run-benchmarks: + needs: prepare-benchmark + name: Run benchmarks for ${{ matrix.test.name }} + runs-on: ubuntu-latest + env: + GPG_SIGNING_KEY: ${{ secrets.GPG_SIGNING_KEY }} + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + strategy: + fail-fast: false + matrix: + test: ${{ fromJson(needs.prepare-benchmark.outputs.test-infos) }} + steps: + - uses: actions/checkout@v4 + with: + ref: ${{ github.ref }} + token: ${{ secrets.LASTMJS_GITHUB_TOKEN || github.token }} + + - uses: ./.github/actions/setup_node + + - uses: ./.github/actions/setup_dfx + + - name: Install dependencies + run: | + npm install + npm link + cd ${{ matrix.test.path }} + npm install + npm link azle + + - name: Start dfx with artificial delay 0 + working-directory: ${{ matrix.test.path }} + run: dfx start --clean --background --host 127.0.0.1:8000 --artificial-delay 0 + + - name: Run npm test (continue on error) + working-directory: ${{ matrix.test.path }} + continue-on-error: true + run: AZLE_RECORD_BENCHMARKS=true npm test + + - name: Create branch name + id: create-branch-name + uses: ./.github/actions/create_branch_name + with: + prefix: ${{ inputs.branch-prefix }} + path: ${{ matrix.test.displayPath }} + + - uses: ./.github/actions/commit_and_push + with: + branch-name: ${{ steps.create-branch-name.outputs.branch-name }} + commit-message: 'Run benchmarks for ${{ matrix.test.displayPath }}' + gpg_signing_key: ${{ secrets.GPG_SIGNING_KEY }} diff --git a/.github/workflows/delete_branches.yml b/.github/workflows/delete_branches.yml index 8a8c593405..477cbaa320 100644 --- a/.github/workflows/delete_branches.yml +++ b/.github/workflows/delete_branches.yml @@ -14,7 +14,7 @@ on: jobs: delete-branches: - name: Delete Branches + name: 'Delete branches with prefix ${{ inputs.branch-prefix }} | Dry run: ${{ inputs.dry-run }}' runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml deleted file mode 100644 index 897a33b66c..0000000000 --- a/.github/workflows/release.yml +++ /dev/null @@ -1,34 +0,0 @@ -name: Release -on: - push: - branches: - - main - pull_request: - -jobs: - determine-should-release: - if: ${{ startsWith(github.head_ref, 'release--') }} - name: Determine if this branch should release - runs-on: ubuntu-latest - outputs: - should-release: ${{ steps.determine-should-release.outputs.should-release }} - steps: - - uses: actions/checkout@v4 - - - id: determine-should-release - uses: ./.github/actions/should_release - - release: - name: Deploy release - # Only run this job if it's a release branch. This job will run instead of run-tests and will automatically publish another commit which will be tested - if: ${{ needs.determine-should-release.outputs.should-release == 'true' }} - - needs: - - determine-should-release - - uses: ./.github/workflows/release_parallel.yml - secrets: - GPG_SIGNING_KEY: ${{ secrets.GPG_SIGNING_KEY }} - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - NPM_TOKEN: ${{ secrets.NPM_TOKEN }} - LASTMJS_GITHUB_TOKEN: ${{ secrets.LASTMJS_GITHUB_TOKEN }} diff --git a/.github/workflows/release_parallel.yml b/.github/workflows/release_parallel.yml index 7ed4c13120..ac6307d528 100644 --- a/.github/workflows/release_parallel.yml +++ b/.github/workflows/release_parallel.yml @@ -1,14 +1,8 @@ name: Parallel Release on: - workflow_call: - secrets: - GPG_SIGNING_KEY: - required: true - GH_TOKEN: - required: true - NPM_TOKEN: - required: true - LASTMJS_GITHUB_TOKEN: + workflow_dispatch: + inputs: + release-version: required: true jobs: @@ -19,20 +13,17 @@ jobs: GPG_SIGNING_KEY: ${{ secrets.GPG_SIGNING_KEY }} # All commits must be verified GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} outputs: - release-version: ${{ steps.get-version.outputs.release-version }} + release-version: ${{ inputs.release-version }} test-infos: ${{ steps.get-test-infos.outputs.test-infos }} steps: + - name: Print branch name + run: echo "${{ github.ref }}" + - uses: actions/checkout@v4 with: - ref: ${{ github.event.pull_request.head.ref || github.ref }} + ref: ${{ github.ref }} token: ${{ secrets.LASTMJS_GITHUB_TOKEN || github.token }} - - id: get-version - run: | - BRANCH_NAME="${{ github.event.pull_request.head.ref || github.ref_name }}" - RELEASE_VERSION="${BRANCH_NAME:9}" - echo "release-version=$RELEASE_VERSION" >> $GITHUB_OUTPUT - - uses: ./.github/actions/setup_node with: registry-url: https://registry.npmjs.org @@ -46,13 +37,9 @@ jobs: run: | AZLE_VERBOSE=true npx azle install-global-dependencies --rust --wasi2ic - - uses: ./.github/actions/configure_git - with: - gpg_signing_key: ${{ secrets.GPG_SIGNING_KEY }} - - name: Update version and build templates run: | - VERSION=${{ steps.get-version.outputs.release-version }} + VERSION=${{ inputs.release-version }} sed -E -i "s/(\"version\": \")(.*)(\")/\1$VERSION\3/" package.json sed -E -i "s/(\"version\": \")(.*)(\")/\1$VERSION\3/" dfx_extension/extension.json npm install @@ -61,7 +48,7 @@ jobs: - name: Publish to npm run: | - if [[ "${{ steps.get-version.outputs.release-version }}" == *"-rc."* ]]; then + if [[ "${{ inputs.release-version }}" == *"-rc."* ]]; then npm publish --tag next else npm publish @@ -88,7 +75,7 @@ jobs: steps: - uses: actions/checkout@v4 with: - ref: ${{ github.event.pull_request.head.ref || github.ref }} + ref: ${{ github.ref }} token: ${{ secrets.LASTMJS_GITHUB_TOKEN || github.token }} - uses: ./.github/actions/setup_node @@ -111,85 +98,43 @@ jobs: continue-on-error: true run: npm test - - uses: ./.github/actions/configure_git + - name: Create branch name + id: create-branch-name + uses: ./.github/actions/create_branch_name with: - gpg_signing_key: ${{ secrets.GPG_SIGNING_KEY }} + prefix: 'update--${{ needs.prepare-release.outputs.release-version }}-' + path: ${{ matrix.test.displayPath }} - - name: Commit and push changes - run: | - BRANCH_NAME="update--${{ needs.prepare-release.outputs.release-version }}-$(echo '${{ matrix.test.displayPath }}' | sed 's/\//-/g')" - git switch -c "$BRANCH_NAME" - git add --all - if ! git diff --cached --quiet; then - git commit -m "Update dependencies for ${{ matrix.test.displayPath }}" - else - echo "No changes to commit. Skipping commit and push." - fi - git push origin "$BRANCH_NAME" + - uses: ./.github/actions/commit_and_push + with: + branch-name: ${{ steps.create-branch-name.outputs.branch-name }} + commit-message: 'Update test files for ${{ matrix.test.displayPath }}' + gpg_signing_key: ${{ secrets.GPG_SIGNING_KEY }} - finalize-release: + squash-branches: needs: [prepare-release, update-test-files-for-release-commit] - name: Finalize Release - runs-on: ubuntu-latest - env: + uses: ./.github/workflows/squash_branches.yml + with: + branch-prefix: 'update--${{ needs.prepare-release.outputs.release-version }}-' + commit-message: 'Update test files for all tests and examples ${{ needs.prepare-release.outputs.release-version }}' + secrets: GPG_SIGNING_KEY: ${{ secrets.GPG_SIGNING_KEY }} GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + LASTMJS_GITHUB_TOKEN: ${{ secrets.LASTMJS_GITHUB_TOKEN }} + + create-release: + needs: [prepare-release, squash-branches] + name: Create Release + runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 with: - ref: ${{ github.event.pull_request.head.ref || github.ref }} + ref: ${{ github.ref }} token: ${{ secrets.LASTMJS_GITHUB_TOKEN }} - fetch-depth: 0 - - - uses: ./.github/actions/configure_git - with: - gpg_signing_key: ${{ secrets.GPG_SIGNING_KEY }} - - - name: Collect branches - id: collect-branches - run: | - # Get branches and convert to space-separated list - BRANCHES=$(git branch -r | grep "origin/update--${{ needs.prepare-release.outputs.release-version }}-" | sed 's/origin\///' | xargs) - echo "branches=$BRANCHES" >> $GITHUB_OUTPUT - - - name: Display collected branches - run: | - echo "Collected branches:" - for branch in ${{ steps.collect-branches.outputs.branches }}; do - echo " - $branch" - done - echo "End of branch list" - - - name: Fetch branches - run: | - echo "Fetching all branches..." - BRANCHES_TO_FETCH="" - for branch in ${{ steps.collect-branches.outputs.branches }}; do - BRANCHES_TO_FETCH+=" $branch:$branch" - done - git fetch origin $BRANCHES_TO_FETCH - - - name: Squash changes - env: - PAT: ${{ secrets.LASTMJS_GITHUB_TOKEN }} - run: | - CURRENT_BRANCH=$(git branch --show-current) - - for branch in ${{ steps.collect-branches.outputs.branches }}; do - git merge --squash $branch - done - - # Create a merge commit with a descriptive message - git commit -am "Update test files for all tests and examples ${{ needs.prepare-release.outputs.release-version }}" - - git push origin HEAD:$CURRENT_BRANCH - - - name: Delete branches - run: | - echo "Starting branch deletion process..." - git push origin --delete ${{ steps.collect-branches.outputs.branches }} - name: Create release + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | VERSION=${{ needs.prepare-release.outputs.release-version }} git tag $VERSION @@ -200,3 +145,21 @@ jobs: else gh release create "$VERSION" -t "$VERSION" fi + + create-pr: + needs: [prepare-release, squash-branches] + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + ref: ${{ github.ref }} + + - name: Create Pull Request + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + gh pr create \ + --base ${{ github.ref_name }} \ + --head release--${{ needs.prepare-release.outputs.release-version }} \ + --title "Release ${{ needs.prepare-release.outputs.release-version }}" \ + --body "Automated PR for release ${{ needs.prepare-release.outputs.release-version }}" diff --git a/.github/workflows/squash_branches.yml b/.github/workflows/squash_branches.yml new file mode 100644 index 0000000000..8264f87fb8 --- /dev/null +++ b/.github/workflows/squash_branches.yml @@ -0,0 +1,79 @@ +name: Squash Branches +on: + workflow_call: + inputs: + branch-prefix: + required: true + type: string + commit-message: + required: true + type: string + secrets: + GPG_SIGNING_KEY: + required: true + GH_TOKEN: + required: true + LASTMJS_GITHUB_TOKEN: + required: true + +jobs: + squash: + name: Squash Branches + runs-on: ubuntu-latest + env: + GPG_SIGNING_KEY: ${{ secrets.GPG_SIGNING_KEY }} + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + steps: + - uses: actions/checkout@v4 + with: + ref: ${{ github.ref }} + token: ${{ secrets.LASTMJS_GITHUB_TOKEN }} + fetch-depth: 0 + + - uses: ./.github/actions/configure_git + with: + gpg_signing_key: ${{ secrets.GPG_SIGNING_KEY }} + + - name: Collect branches + id: collect-branches + run: | + # Get branches and convert to space-separated list + BRANCHES=$(git branch -r | grep "origin/${{ inputs.branch-prefix }}" | sed 's/origin\///' | xargs) + echo "branches=$BRANCHES" >> $GITHUB_OUTPUT + + - name: Display collected branches + run: | + echo "Collected branches:" + for branch in ${{ steps.collect-branches.outputs.branches }}; do + echo " - $branch" + done + echo "End of branch list" + + - name: Fetch branches + run: | + echo "Fetching all branches..." + BRANCHES_TO_FETCH="" + for branch in ${{ steps.collect-branches.outputs.branches }}; do + BRANCHES_TO_FETCH+=" $branch:$branch" + done + git fetch origin $BRANCHES_TO_FETCH + + - name: Squash changes + env: + PAT: ${{ secrets.LASTMJS_GITHUB_TOKEN }} + run: | + CURRENT_BRANCH=$(git branch --show-current) + + for branch in ${{ steps.collect-branches.outputs.branches }}; do + git merge --squash $branch + done + + # Create a merge commit with a descriptive message + git commit -am "${{ inputs.commit-message }}" + + git push origin HEAD:$CURRENT_BRANCH + + - name: Delete branches + run: | + echo "Starting branch deletion process..." + git push origin --delete ${{ steps.collect-branches.outputs.branches }} diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 9f8c43d106..4c524aed0d 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -12,101 +12,28 @@ on: pull_request: jobs: - determine-should-run-tests: - name: Determine if tests should run + get-exclude-dirs: + name: Get exclude directories 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 }} + exclude-dirs: ${{ steps.get-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 + - id: get-exclude-dirs + uses: ./.github/actions/get_exclude_dirs + with: + exclude-slow: ${{ steps.set-conditions.outputs.is_feature_branch_draft_pr == 'true' }} + exclude-unstable: ${{ steps.set-conditions.outputs.is_feature_branch_pr == 'true' || steps.set-conditions.outputs.is_feature_branch_draft_pr == 'true' }} + exclude-release-only: ${{ steps.set-conditions.outputs.is_feature_branch_pr == 'true' || steps.set-conditions.outputs.is_feature_branch_draft_pr == 'true' }} 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' }} + - get-exclude-dirs strategy: fail-fast: false matrix: @@ -139,7 +66,7 @@ jobs: uses: ./.github/workflows/get_and_run_tests.yml with: directories: ${{ matrix.test_group.directories }} - exclude-dirs: ${{ needs.set-exclude-dirs.outputs.exclude-dirs }} + exclude-dirs: ${{ needs.get-exclude-dirs.outputs.exclude-dirs }} check-test-success: name: Check Azle tests succeeded diff --git a/tests/end_to_end/http_server/apollo_server/test/test.ts b/tests/end_to_end/http_server/apollo_server/test/test.ts index c39221986e..a75088c499 100644 --- a/tests/end_to_end/http_server/apollo_server/test/test.ts +++ b/tests/end_to_end/http_server/apollo_server/test/test.ts @@ -3,6 +3,7 @@ import { runTests } from 'azle/test'; import { getTests } from './tests'; -const canisterId = getCanisterId('apollo_server'); +const canisterName = 'apollo_server'; +const canisterId = getCanisterId(canisterName); -runTests(getTests(canisterId)); +runTests(getTests(canisterId), canisterName); diff --git a/tests/end_to_end/http_server/audio_and_video/test/test.ts b/tests/end_to_end/http_server/audio_and_video/test/test.ts index bd945d95c7..3862bbc932 100644 --- a/tests/end_to_end/http_server/audio_and_video/test/test.ts +++ b/tests/end_to_end/http_server/audio_and_video/test/test.ts @@ -3,6 +3,7 @@ import { runTests } from 'azle/test'; import { getTests } from './tests'; -const canisterId = getCanisterId('backend'); +const canisterName = 'backend'; +const canisterId = getCanisterId(canisterName); -runTests(getTests(canisterId)); +runTests(getTests(canisterId), canisterName); diff --git a/tests/end_to_end/http_server/autoreload/test/test.ts b/tests/end_to_end/http_server/autoreload/test/test.ts index 3c54d7f29e..21aa4594e7 100644 --- a/tests/end_to_end/http_server/autoreload/test/test.ts +++ b/tests/end_to_end/http_server/autoreload/test/test.ts @@ -3,6 +3,7 @@ import { runTests } from 'azle/test'; import { getTests } from './tests'; -const canisterId = getCanisterId('autoreload'); +const canisterName = 'autoreload'; +const canisterId = getCanisterId(canisterName); -runTests(getTests(canisterId)); +runTests(getTests(canisterId), canisterName); diff --git a/tests/end_to_end/http_server/bitcoinjs_lib/test/test.ts b/tests/end_to_end/http_server/bitcoinjs_lib/test/test.ts index 6df2b5432c..c33432b203 100644 --- a/tests/end_to_end/http_server/bitcoinjs_lib/test/test.ts +++ b/tests/end_to_end/http_server/bitcoinjs_lib/test/test.ts @@ -3,6 +3,7 @@ import { runTests } from 'azle/test'; import { getTests } from './tests'; -const canisterId = getCanisterId('bitcoinjs_lib'); +const canisterName = 'bitcoinjs_lib'; +const canisterId = getCanisterId(canisterName); -runTests(getTests(canisterId)); +runTests(getTests(canisterId), canisterName); diff --git a/tests/end_to_end/http_server/bitcore_lib/test/test.ts b/tests/end_to_end/http_server/bitcore_lib/test/test.ts index 2eca2497a9..624de176fa 100644 --- a/tests/end_to_end/http_server/bitcore_lib/test/test.ts +++ b/tests/end_to_end/http_server/bitcore_lib/test/test.ts @@ -3,6 +3,7 @@ import { runTests } from 'azle/test'; import { getTests } from './tests'; -const canisterId = getCanisterId('bitcore_lib'); +const canisterName = 'bitcore_lib'; +const canisterId = getCanisterId(canisterName); -runTests(getTests(canisterId)); +runTests(getTests(canisterId), canisterName); diff --git a/tests/end_to_end/http_server/ethers/test/test.ts b/tests/end_to_end/http_server/ethers/test/test.ts index eeb3cf7726..d79925532d 100644 --- a/tests/end_to_end/http_server/ethers/test/test.ts +++ b/tests/end_to_end/http_server/ethers/test/test.ts @@ -3,6 +3,7 @@ import { runTests } from 'azle/test'; import { getTests } from './tests'; -const canisterId = getCanisterId('ethers'); +const canisterName = 'ethers'; +const canisterId = getCanisterId(canisterName); -runTests(getTests(canisterId)); +runTests(getTests(canisterId), canisterName); diff --git a/tests/end_to_end/http_server/ethers_base/test/test.ts b/tests/end_to_end/http_server/ethers_base/test/test.ts index 0a8b49527f..3a732d551e 100644 --- a/tests/end_to_end/http_server/ethers_base/test/test.ts +++ b/tests/end_to_end/http_server/ethers_base/test/test.ts @@ -3,6 +3,7 @@ import { runTests } from 'azle/test'; import { getTests } from './tests'; -const canisterId = getCanisterId('server'); +const canisterName = 'server'; +const canisterId = getCanisterId(canisterName); -runTests(getTests(canisterId)); +runTests(getTests(canisterId), canisterName); diff --git a/tests/end_to_end/http_server/express/test/test.ts b/tests/end_to_end/http_server/express/test/test.ts index f0f03fa3ed..158c722cbe 100644 --- a/tests/end_to_end/http_server/express/test/test.ts +++ b/tests/end_to_end/http_server/express/test/test.ts @@ -3,6 +3,7 @@ import { runTests } from 'azle/test'; import { getTests } from './tests'; -const canisterId = getCanisterId('express'); +const canisterName = 'express'; +const canisterId = getCanisterId(canisterName); -runTests(getTests(canisterId)); +runTests(getTests(canisterId), canisterName); diff --git a/tests/end_to_end/http_server/fetch_ic/test/test.ts b/tests/end_to_end/http_server/fetch_ic/test/test.ts index c26dcfa29a..52a8f7566d 100644 --- a/tests/end_to_end/http_server/fetch_ic/test/test.ts +++ b/tests/end_to_end/http_server/fetch_ic/test/test.ts @@ -2,4 +2,6 @@ import { runTests } from 'azle/test'; import { getTests } from './tests'; -runTests(getTests('backend')); +const canisterName = 'backend'; + +runTests(getTests(canisterName), canisterName); diff --git a/tests/end_to_end/http_server/file_protocol/test/test.ts b/tests/end_to_end/http_server/file_protocol/test/test.ts index bd945d95c7..3862bbc932 100644 --- a/tests/end_to_end/http_server/file_protocol/test/test.ts +++ b/tests/end_to_end/http_server/file_protocol/test/test.ts @@ -3,6 +3,7 @@ import { runTests } from 'azle/test'; import { getTests } from './tests'; -const canisterId = getCanisterId('backend'); +const canisterName = 'backend'; +const canisterId = getCanisterId(canisterName); -runTests(getTests(canisterId)); +runTests(getTests(canisterId), canisterName); diff --git a/tests/end_to_end/http_server/fs/test/test.ts b/tests/end_to_end/http_server/fs/test/test.ts index c91d144342..d487891b80 100644 --- a/tests/end_to_end/http_server/fs/test/test.ts +++ b/tests/end_to_end/http_server/fs/test/test.ts @@ -3,6 +3,7 @@ import { runTests } from 'azle/test'; import { getTests } from './tests'; -const canisterId = getCanisterId('fs'); +const canisterName = 'fs'; +const canisterId = getCanisterId(canisterName); -runTests(getTests(canisterId)); +runTests(getTests(canisterId), canisterName); diff --git a/tests/end_to_end/http_server/http_outcall_fetch/test/test.ts b/tests/end_to_end/http_server/http_outcall_fetch/test/test.ts index 0a8b49527f..3a732d551e 100644 --- a/tests/end_to_end/http_server/http_outcall_fetch/test/test.ts +++ b/tests/end_to_end/http_server/http_outcall_fetch/test/test.ts @@ -3,6 +3,7 @@ import { runTests } from 'azle/test'; import { getTests } from './tests'; -const canisterId = getCanisterId('server'); +const canisterName = 'server'; +const canisterId = getCanisterId(canisterName); -runTests(getTests(canisterId)); +runTests(getTests(canisterId), canisterName); diff --git a/tests/end_to_end/http_server/ic_evm_rpc/test/test.ts b/tests/end_to_end/http_server/ic_evm_rpc/test/test.ts index 0a8b49527f..3a732d551e 100644 --- a/tests/end_to_end/http_server/ic_evm_rpc/test/test.ts +++ b/tests/end_to_end/http_server/ic_evm_rpc/test/test.ts @@ -3,6 +3,7 @@ import { runTests } from 'azle/test'; import { getTests } from './tests'; -const canisterId = getCanisterId('server'); +const canisterName = 'server'; +const canisterId = getCanisterId(canisterName); -runTests(getTests(canisterId)); +runTests(getTests(canisterId), canisterName); diff --git a/tests/end_to_end/http_server/internet_identity/test/test.ts b/tests/end_to_end/http_server/internet_identity/test/test.ts index c26dcfa29a..52a8f7566d 100644 --- a/tests/end_to_end/http_server/internet_identity/test/test.ts +++ b/tests/end_to_end/http_server/internet_identity/test/test.ts @@ -2,4 +2,6 @@ import { runTests } from 'azle/test'; import { getTests } from './tests'; -runTests(getTests('backend')); +const canisterName = 'backend'; + +runTests(getTests(canisterName), canisterName); diff --git a/tests/end_to_end/http_server/large_files/test/test.ts b/tests/end_to_end/http_server/large_files/test/test.ts index bd945d95c7..3862bbc932 100644 --- a/tests/end_to_end/http_server/large_files/test/test.ts +++ b/tests/end_to_end/http_server/large_files/test/test.ts @@ -3,6 +3,7 @@ import { runTests } from 'azle/test'; import { getTests } from './tests'; -const canisterId = getCanisterId('backend'); +const canisterName = 'backend'; +const canisterId = getCanisterId(canisterName); -runTests(getTests(canisterId)); +runTests(getTests(canisterId), canisterName); diff --git a/tests/end_to_end/http_server/nest/test/test.ts b/tests/end_to_end/http_server/nest/test/test.ts index 519e141ad2..0cdf9444d9 100644 --- a/tests/end_to_end/http_server/nest/test/test.ts +++ b/tests/end_to_end/http_server/nest/test/test.ts @@ -3,6 +3,7 @@ import { runTests } from 'azle/test'; import { getTests } from './tests'; -const canisterId = getCanisterId('api'); +const canisterName = 'api'; +const canisterId = getCanisterId(canisterName); -runTests(getTests(canisterId)); +runTests(getTests(canisterId), canisterName); diff --git a/tests/end_to_end/http_server/open_value_sharing/test/test.ts b/tests/end_to_end/http_server/open_value_sharing/test/test.ts index 43b3a29f62..6901929991 100644 --- a/tests/end_to_end/http_server/open_value_sharing/test/test.ts +++ b/tests/end_to_end/http_server/open_value_sharing/test/test.ts @@ -5,10 +5,12 @@ import { agent, consumerActor } from './consumer_actor'; import { createActor as createWalletActor } from './dfx_generated/wallet'; import { getTests } from './tests'; -const walletActor = createWalletActor(getCanisterId('wallet'), { +const canisterName = 'wallet'; +const canisterId = getCanisterId(canisterName); +const walletActor = createWalletActor(canisterId, { agentOptions: { host: 'http://127.0.0.1:8000' } }); -runTests(getTests(consumerActor, walletActor, agent)); +runTests(getTests(consumerActor, walletActor, agent), canisterName); diff --git a/tests/end_to_end/http_server/sqlite/test/test.ts b/tests/end_to_end/http_server/sqlite/test/test.ts index 89fc73328b..7431d1d64e 100644 --- a/tests/end_to_end/http_server/sqlite/test/test.ts +++ b/tests/end_to_end/http_server/sqlite/test/test.ts @@ -3,6 +3,7 @@ import { runTests } from 'azle/test'; import { getTests } from './tests'; -const canisterId = getCanisterId('sqlite'); +const canisterName = 'sqlite'; +const canisterId = getCanisterId(canisterName); -runTests(getTests(canisterId)); +runTests(getTests(canisterId), canisterName); diff --git a/tests/end_to_end/http_server/sqlite_drizzle/test/test.ts b/tests/end_to_end/http_server/sqlite_drizzle/test/test.ts index 6e764d1823..44877d0fe6 100644 --- a/tests/end_to_end/http_server/sqlite_drizzle/test/test.ts +++ b/tests/end_to_end/http_server/sqlite_drizzle/test/test.ts @@ -2,6 +2,7 @@ import { getCanisterId } from 'azle/dfx'; import { runTests } from 'azle/test'; import { getTests } from 'sqlite_example/test/tests'; -const canisterId = getCanisterId('sqlite_drizzle'); +const canisterName = 'sqlite_drizzle'; +const canisterId = getCanisterId(canisterName); -runTests(getTests(canisterId)); +runTests(getTests(canisterId), canisterName); diff --git a/tests/end_to_end/http_server/sqlite_typeorm/test/test.ts b/tests/end_to_end/http_server/sqlite_typeorm/test/test.ts index c6ddad17f5..04d8e37556 100644 --- a/tests/end_to_end/http_server/sqlite_typeorm/test/test.ts +++ b/tests/end_to_end/http_server/sqlite_typeorm/test/test.ts @@ -2,6 +2,7 @@ import { getCanisterId } from 'azle/dfx'; import { runTests } from 'azle/test'; import { getTests } from 'sqlite_example/test/tests'; -const canisterId = getCanisterId('sqlite_typeorm'); +const canisterName = 'sqlite_typeorm'; +const canisterId = getCanisterId(canisterName); -runTests(getTests(canisterId)); +runTests(getTests(canisterId), canisterName); diff --git a/tests/end_to_end/http_server/tfjs/test/test.ts b/tests/end_to_end/http_server/tfjs/test/test.ts index 519e141ad2..0cdf9444d9 100644 --- a/tests/end_to_end/http_server/tfjs/test/test.ts +++ b/tests/end_to_end/http_server/tfjs/test/test.ts @@ -3,6 +3,7 @@ import { runTests } from 'azle/test'; import { getTests } from './tests'; -const canisterId = getCanisterId('api'); +const canisterName = 'api'; +const canisterId = getCanisterId(canisterName); -runTests(getTests(canisterId)); +runTests(getTests(canisterId), canisterName); diff --git a/tests/end_to_end/http_server/web_assembly/test/test.ts b/tests/end_to_end/http_server/web_assembly/test/test.ts index 23b8952a1e..5c0bd8020c 100644 --- a/tests/end_to_end/http_server/web_assembly/test/test.ts +++ b/tests/end_to_end/http_server/web_assembly/test/test.ts @@ -3,6 +3,7 @@ import { runTests } from 'azle/test'; import { getTests } from './tests'; -const canisterId = getCanisterId('web_assembly'); +const canisterName = 'web_assembly'; +const canisterId = getCanisterId(canisterName); -runTests(getTests(canisterId)); +runTests(getTests(canisterId), canisterName);