From 3b6b84cd81797f99ed9b8cc04676ebeed0d29035 Mon Sep 17 00:00:00 2001 From: Benjamin DeMann Date: Mon, 14 Oct 2024 13:09:39 -0600 Subject: [PATCH 01/59] try parallel release --- .github/workflows/release.yml | 53 +------- .github/workflows/release_parallel.yml | 169 +++++++++++++++++++++++++ 2 files changed, 172 insertions(+), 50 deletions(-) create mode 100644 .github/workflows/release_parallel.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index fc7bbe141b..9a1ddadcb3 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -46,55 +46,8 @@ jobs: needs: - determine-should-release - get-test-infos - runs-on: ubuntu-latest - env: + + uses: ./.github/workflows/release_parallel.yml + secrets: GPG_SIGNING_KEY: ${{ secrets.GPG_SIGNING_KEY }} # All commits must be verified GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - steps: - - uses: actions/checkout@v4 - with: - ref: ${{ github.event.pull_request.head.ref || github.ref }} - token: ${{ secrets.LASTMJS_GITHUB_TOKEN || github.token }} - - - id: get-node-version - uses: ./.github/actions/get_node_version - - - uses: actions/setup-node@v4 - with: - node-version: ${{ steps.get-node-version.outputs.node-version }} - registry-url: https://registry.npmjs.org - env: - NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} - - - name: Install curl - run: sudo apt-get install curl -y - - - id: get-dfx-version - uses: ./.github/actions/get_dfx_version - - - name: Install dfx - run: | - # Install dfx (Note: dfx must be installed before `npx azle` because the azle installation process requires dfx) - src/build/stable/commands/install_global_dependencies/install_dfx.sh ${{ steps.get-dfx-version.outputs.dfx-version }} - echo "$HOME/.local/share/dfx/bin" >> $GITHUB_PATH - - - run: npm install - - - name: Install global dependencies - run: | - AZLE_VERBOSE=true npx azle install-global-dependencies --rust --wasi2ic - - # TODO we should use some Action-specific bot account - - name: Configure git for publishing release - run: | - git config --global user.name 'Jordan Last' - git config --global user.email 'jordan.michael.last@gmail.com' - git config --global commit.gpgsign true - echo -n "$GPG_SIGNING_KEY" | base64 --decode | gpg --import - git config --global user.signingkey C8B77BCBE16CD2B94B43F9C8757397B82D4ED7B0 - - - name: Publish release - run: | - BRANCH_NAME="${{ github.head_ref }}" - RELEASE_VERSION="${BRANCH_NAME:9}" - ./.github/scripts/publish_github_action.sh $RELEASE_VERSION ${{ toJSON(needs.get-test-infos.outputs.test-infos) }} diff --git a/.github/workflows/release_parallel.yml b/.github/workflows/release_parallel.yml new file mode 100644 index 0000000000..e6a3099d48 --- /dev/null +++ b/.github/workflows/release_parallel.yml @@ -0,0 +1,169 @@ +name: Parallel Release +on: + workflow_call: + secrets: + GPG_SIGNING_KEY: + required: true + GH_TOKEN: + required: true + +jobs: + prepare-release: + name: Prepare Release + runs-on: ubuntu-latest + env: + 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 }} + test-infos: ${{ steps.get-test-infos.outputs.test-infos }} + steps: + - uses: actions/checkout@v4 + with: + ref: ${{ github.event.pull_request.head.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 + + - id: get-node-version + uses: ./.github/actions/get_node_version + + - uses: actions/setup-node@v4 + with: + node-version: ${{ steps.get-node-version.outputs.node-version }} + registry-url: https://registry.npmjs.org + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + + - name: Install curl + run: sudo apt-get install curl -y + + - id: get-dfx-version + uses: ./.github/actions/get_dfx_version + + - name: Install dfx + run: | + # Install dfx (Note: dfx must be installed before `npx azle` because the azle installation process requires dfx) + src/build/stable/commands/install_global_dependencies/install_dfx.sh ${{ steps.get-dfx-version.outputs.dfx-version }} + echo "$HOME/.local/share/dfx/bin" >> $GITHUB_PATH + + - run: npm install + + - name: Install global dependencies + run: | + AZLE_VERBOSE=true npx azle install-global-dependencies --rust --wasi2ic + + # TODO we should use some Action-specific bot account + - name: Configure git for publishing release + run: | + git config --global user.name 'Jordan Last' + git config --global user.email 'jordan.michael.last@gmail.com' + git config --global commit.gpgsign true + echo -n "$GPG_SIGNING_KEY" | base64 --decode | gpg --import + git config --global user.signingkey C8B77BCBE16CD2B94B43F9C8757397B82D4ED7B0 + git -k + + - name: Update version and build templates + run: | + VERSION=${{ steps.get-version.outputs.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 + npx azle template + npx azle template --experimental + + - name: Publish to npm + run: | + if [[ "${{ steps.get-version.outputs.release-version }}" == *"-rc."* ]]; then + npm publish --tag next + else + npm publish + fi + + - id: get-test-infos + uses: ./.github/actions/get_test_infos + with: + directories: | + ./examples + ./tests + + update-dependencies: + needs: prepare-release + name: Update ${{ matrix.test.name }} + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + test: ${{ fromJson(needs.prepare-release.outputs.test-infos) }} + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + token: ${{ secrets.LASTMJS_GITHUB_TOKEN || github.token }} + + - id: get-node-version + uses: ./.github/actions/get_node_version + + - uses: actions/setup-node@v4 + with: + node-version: ${{ steps.get-node-version.outputs.node-version }} + + - name: Update dependencies + run: | + cd ${{ matrix.test.path }} + sed -E -i "s/(\"azle\": \")(.*)(\")/\1${{ needs.prepare-release.outputs.release-version }}\3/" package.json + npm install + rm -rf node_modules + + - name: Commit and push changes + run: | + git config --global user.name 'Jordan Last' + git config --global user.email 'jordan.michael.last@gmail.com' + git checkout -b "update-${{ matrix.test.name }}" + git add --all + git commit -m "Update dependencies for ${{ matrix.test.name }}" + git push origin "update-${{ matrix.test.name }}" + + finalize-release: + needs: [prepare-release, update-dependencies] + name: Finalize Release + runs-on: ubuntu-latest + env: + GPG_SIGNING_KEY: ${{ secrets.GPG_SIGNING_KEY }} + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + token: ${{ secrets.LASTMJS_GITHUB_TOKEN || github.token }} + ref: ${{ github.ref_name }} + + - name: Merge update branches + run: | + git config --global user.name 'Jordan Last' + git config --global user.email 'jordan.michael.last@gmail.com' + git config --global commit.gpgsign true + echo -n "$GPG_SIGNING_KEY" | base64 --decode | gpg --import + git config --global user.signingkey C8B77BCBE16CD2B94B43F9C8757397B82D4ED7B0 + + for branch in $(git branch -r | grep 'origin/update-' | sed 's/origin\///'); do + git merge --no-ff "$branch" -m "Merge $branch" + done + + git push origin ${{ github.ref_name }} + + - name: Create release + run: | + VERSION=${{ needs.prepare-release.outputs.release-version }} + git tag $VERSION + git push origin $VERSION + + if [[ "$VERSION" == *"-rc."* ]]; then + gh release create "$VERSION" -t "$VERSION" --prerelease + else + gh release create "$VERSION" -t "$VERSION" + fi From b6aef3588251b8b6ec17542188fe45dc169b3b3c Mon Sep 17 00:00:00 2001 From: Benjamin DeMann Date: Mon, 14 Oct 2024 16:38:27 -0600 Subject: [PATCH 02/59] WIP --- .github/scripts/publish_github_action.sh | 46 +++++++++--------- .github/workflows/release.yml | 62 +++++++++++++++++++++++- 2 files changed, 84 insertions(+), 24 deletions(-) diff --git a/.github/scripts/publish_github_action.sh b/.github/scripts/publish_github_action.sh index df959b3edf..7d326a5bc4 100755 --- a/.github/scripts/publish_github_action.sh +++ b/.github/scripts/publish_github_action.sh @@ -26,34 +26,34 @@ else npm publish fi -# TODO loop through checking for the status instead of sleeping -echo -e "sleeping for 30 seconds to ensure azle@$VERSION is fully registered on npm" +# # TODO loop through checking for the status instead of sleeping +# echo -e "sleeping for 30 seconds to ensure azle@$VERSION is fully registered on npm" -sleep 30 +# sleep 30 -for directory in ${directories[@]} -do - cd "$directory" - echo "updating $directory" +# for directory in ${directories[@]} +# do +# cd "$directory" +# echo "updating $directory" - sed -E -i "s/(\"azle\": \")(.*)(\")/\1$VERSION\3/" package.json - npm install +# sed -E -i "s/(\"azle\": \")(.*)(\")/\1$VERSION\3/" package.json +# npm install - rm -rf node_modules +# rm -rf node_modules - cd $root_dir -done +# cd $root_dir +# done -git add --all -git commit -am "azle-bot automated release $VERSION" -git push origin $GITHUB_HEAD_REF +# git add --all +# git commit -am "azle-bot automated release $VERSION" +# git push origin $GITHUB_HEAD_REF -git tag $VERSION -git push origin $VERSION +# git tag $VERSION +# git push origin $VERSION -if [[ "$VERSION" == *"-rc."* ]]; -then - gh release create "$VERSION" -t "$VERSION" --prerelease -else - gh release create "$VERSION" -t "$VERSION" -fi +# if [[ "$VERSION" == *"-rc."* ]]; +# then +# gh release create "$VERSION" -t "$VERSION" --prerelease +# else +# gh release create "$VERSION" -t "$VERSION" +# fi diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 9a1ddadcb3..540e5234ea 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -39,10 +39,70 @@ jobs: ./examples ./tests - release: + release2: 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 + - get-test-infos + runs-on: ubuntu-latest + env: + GPG_SIGNING_KEY: ${{ secrets.GPG_SIGNING_KEY }} # All commits must be verified + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + steps: + - uses: actions/checkout@v4 + with: + ref: ${{ github.event.pull_request.head.ref || github.ref }} + token: ${{ secrets.LASTMJS_GITHUB_TOKEN || github.token }} + + - id: get-node-version + uses: ./.github/actions/get_node_version + + - uses: actions/setup-node@v4 + with: + node-version: ${{ steps.get-node-version.outputs.node-version }} + registry-url: https://registry.npmjs.org + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + + - name: Install curl + run: sudo apt-get install curl -y + + - id: get-dfx-version + uses: ./.github/actions/get_dfx_version + + - name: Install dfx + run: | + # Install dfx (Note: dfx must be installed before `npx azle` because the azle installation process requires dfx) + src/build/stable/commands/install_global_dependencies/install_dfx.sh ${{ steps.get-dfx-version.outputs.dfx-version }} + echo "$HOME/.local/share/dfx/bin" >> $GITHUB_PATH + + - run: npm install + + - name: Install global dependencies + run: | + AZLE_VERBOSE=true npx azle install-global-dependencies --rust --wasi2ic + + # TODO we should use some Action-specific bot account + - name: Configure git for publishing release + run: | + git config --global user.name 'Jordan Last' + git config --global user.email 'jordan.michael.last@gmail.com' + git config --global commit.gpgsign true + echo -n "$GPG_SIGNING_KEY" | base64 --decode | gpg --import + git config --global user.signingkey C8B77BCBE16CD2B94B43F9C8757397B82D4ED7B0 + + - name: Publish release + run: | + BRANCH_NAME="${{ github.head_ref }}" + RELEASE_VERSION="${BRANCH_NAME:9}" + ./.github/scripts/publish_github_action.sh $RELEASE_VERSION ${{ toJSON(needs.get-test-infos.outputs.test-infos) }} + + release: + if: ${{ false }} + 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 needs: - determine-should-release - get-test-infos From 2024b931de36d0303f1c3bb9168ac5da26b95c66 Mon Sep 17 00:00:00 2001 From: Benjamin DeMann Date: Mon, 14 Oct 2024 16:59:17 -0600 Subject: [PATCH 03/59] move into workflow --- .github/workflows/release.yml | 59 ++++---------------------- .github/workflows/sub-release.yml | 69 +++++++++++++++++++++++++++++++ 2 files changed, 76 insertions(+), 52 deletions(-) create mode 100644 .github/workflows/sub-release.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 540e5234ea..c3d04b27b8 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -39,65 +39,20 @@ jobs: ./examples ./tests - release2: + release3: + if: ${{ false }} 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 - get-test-infos - runs-on: ubuntu-latest - env: + + uses: ./.github/workflows/sub-release.yml + secrets: GPG_SIGNING_KEY: ${{ secrets.GPG_SIGNING_KEY }} # All commits must be verified GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - steps: - - uses: actions/checkout@v4 - with: - ref: ${{ github.event.pull_request.head.ref || github.ref }} - token: ${{ secrets.LASTMJS_GITHUB_TOKEN || github.token }} - - - id: get-node-version - uses: ./.github/actions/get_node_version - - - uses: actions/setup-node@v4 - with: - node-version: ${{ steps.get-node-version.outputs.node-version }} - registry-url: https://registry.npmjs.org - env: - NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} - - - name: Install curl - run: sudo apt-get install curl -y - - - id: get-dfx-version - uses: ./.github/actions/get_dfx_version - - - name: Install dfx - run: | - # Install dfx (Note: dfx must be installed before `npx azle` because the azle installation process requires dfx) - src/build/stable/commands/install_global_dependencies/install_dfx.sh ${{ steps.get-dfx-version.outputs.dfx-version }} - echo "$HOME/.local/share/dfx/bin" >> $GITHUB_PATH - - - run: npm install - - - name: Install global dependencies - run: | - AZLE_VERBOSE=true npx azle install-global-dependencies --rust --wasi2ic - - # TODO we should use some Action-specific bot account - - name: Configure git for publishing release - run: | - git config --global user.name 'Jordan Last' - git config --global user.email 'jordan.michael.last@gmail.com' - git config --global commit.gpgsign true - echo -n "$GPG_SIGNING_KEY" | base64 --decode | gpg --import - git config --global user.signingkey C8B77BCBE16CD2B94B43F9C8757397B82D4ED7B0 - - - name: Publish release - run: | - BRANCH_NAME="${{ github.head_ref }}" - RELEASE_VERSION="${BRANCH_NAME:9}" - ./.github/scripts/publish_github_action.sh $RELEASE_VERSION ${{ toJSON(needs.get-test-infos.outputs.test-infos) }} + with: + test_infos: ${{ needs.get-test-infos.outputs.test-infos }} release: if: ${{ false }} diff --git a/.github/workflows/sub-release.yml b/.github/workflows/sub-release.yml new file mode 100644 index 0000000000..9483ab7215 --- /dev/null +++ b/.github/workflows/sub-release.yml @@ -0,0 +1,69 @@ +name: Sub Release +on: + workflow_call: + secrets: + GPG_SIGNING_KEY: + required: true + GH_TOKEN: + required: true + inputs: + test_infos: + required: true + type: string + +jobs: + 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 + runs-on: ubuntu-latest + env: + GPG_SIGNING_KEY: ${{ secrets.GPG_SIGNING_KEY }} # All commits must be verified + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + steps: + - uses: actions/checkout@v4 + with: + ref: ${{ github.event.pull_request.head.ref || github.ref }} + token: ${{ secrets.LASTMJS_GITHUB_TOKEN || github.token }} + + - id: get-node-version + uses: ./.github/actions/get_node_version + + - uses: actions/setup-node@v4 + with: + node-version: ${{ steps.get-node-version.outputs.node-version }} + registry-url: https://registry.npmjs.org + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + + - name: Install curl + run: sudo apt-get install curl -y + + - id: get-dfx-version + uses: ./.github/actions/get_dfx_version + + - name: Install dfx + run: | + # Install dfx (Note: dfx must be installed before `npx azle` because the azle installation process requires dfx) + src/build/stable/commands/install_global_dependencies/install_dfx.sh ${{ steps.get-dfx-version.outputs.dfx-version }} + echo "$HOME/.local/share/dfx/bin" >> $GITHUB_PATH + + - run: npm install + + - name: Install global dependencies + run: | + AZLE_VERBOSE=true npx azle install-global-dependencies --rust --wasi2ic + + # TODO we should use some Action-specific bot account + - name: Configure git for publishing release + run: | + git config --global user.name 'Jordan Last' + git config --global user.email 'jordan.michael.last@gmail.com' + git config --global commit.gpgsign true + echo -n "$GPG_SIGNING_KEY" | base64 --decode | gpg --import + git config --global user.signingkey C8B77BCBE16CD2B94B43F9C8757397B82D4ED7B0 + + - name: Publish release + run: | + BRANCH_NAME="${{ github.head_ref }}" + RELEASE_VERSION="${BRANCH_NAME:9}" + ./.github/scripts/publish_github_action.sh $RELEASE_VERSION ${{ toJSON(inputs.test_infos) }} From f78d28800a960a0ec6fde9e0b75264379e25818d Mon Sep 17 00:00:00 2001 From: Benjamin DeMann Date: Mon, 14 Oct 2024 17:04:00 -0600 Subject: [PATCH 04/59] fixup --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index c3d04b27b8..134e586d04 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -40,7 +40,7 @@ jobs: ./tests release3: - if: ${{ false }} + if: ${{ needs.determine-should-release.outputs.should-release == 'true' }} 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 needs: From 52d68408b496fb4407f093cda5acb7c9231003c8 Mon Sep 17 00:00:00 2001 From: Benjamin DeMann Date: Tue, 15 Oct 2024 10:12:27 -0600 Subject: [PATCH 05/59] pass npm token secret --- .github/workflows/release.yml | 16 +--------------- .github/workflows/release_parallel.yml | 2 ++ 2 files changed, 3 insertions(+), 15 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 134e586d04..f2a8c1270e 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -39,21 +39,6 @@ jobs: ./examples ./tests - release3: - if: ${{ needs.determine-should-release.outputs.should-release == 'true' }} - 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 - needs: - - determine-should-release - - get-test-infos - - uses: ./.github/workflows/sub-release.yml - secrets: - GPG_SIGNING_KEY: ${{ secrets.GPG_SIGNING_KEY }} # All commits must be verified - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - test_infos: ${{ needs.get-test-infos.outputs.test-infos }} - release: if: ${{ false }} name: Deploy release @@ -66,3 +51,4 @@ jobs: secrets: GPG_SIGNING_KEY: ${{ secrets.GPG_SIGNING_KEY }} # All commits must be verified GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/.github/workflows/release_parallel.yml b/.github/workflows/release_parallel.yml index e6a3099d48..b292876202 100644 --- a/.github/workflows/release_parallel.yml +++ b/.github/workflows/release_parallel.yml @@ -6,6 +6,8 @@ on: required: true GH_TOKEN: required: true + NPM_TOKEN: + required: true jobs: prepare-release: From bff3610a00dd79b9a8ec21fbad592592943648c4 Mon Sep 17 00:00:00 2001 From: Benjamin DeMann Date: Tue, 15 Oct 2024 10:18:24 -0600 Subject: [PATCH 06/59] fixup --- .github/workflows/release.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index f2a8c1270e..c762f5c3e7 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -40,9 +40,10 @@ jobs: ./tests release: - if: ${{ false }} 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 - get-test-infos From a391563388c35aba804b2645543e63b6efade595 Mon Sep 17 00:00:00 2001 From: Benjamin DeMann Date: Tue, 15 Oct 2024 10:24:31 -0600 Subject: [PATCH 07/59] fixup --- .github/workflows/release_parallel.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/release_parallel.yml b/.github/workflows/release_parallel.yml index b292876202..f62f3bf901 100644 --- a/.github/workflows/release_parallel.yml +++ b/.github/workflows/release_parallel.yml @@ -67,7 +67,6 @@ jobs: git config --global commit.gpgsign true echo -n "$GPG_SIGNING_KEY" | base64 --decode | gpg --import git config --global user.signingkey C8B77BCBE16CD2B94B43F9C8757397B82D4ED7B0 - git -k - name: Update version and build templates run: | From 1d4468d012174e56b60c4a7bb00189518fa7801f Mon Sep 17 00:00:00 2001 From: Benjamin DeMann Date: Tue, 15 Oct 2024 10:38:23 -0600 Subject: [PATCH 08/59] install dfx before npm install --- .github/workflows/release_parallel.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.github/workflows/release_parallel.yml b/.github/workflows/release_parallel.yml index f62f3bf901..90e6e0ea1a 100644 --- a/.github/workflows/release_parallel.yml +++ b/.github/workflows/release_parallel.yml @@ -113,6 +113,15 @@ jobs: with: node-version: ${{ steps.get-node-version.outputs.node-version }} + - id: get-dfx-version + uses: ./.github/actions/get_dfx_version + + - name: Install dfx + run: | + # Install dfx (Note: dfx must be installed before `npx azle` because the azle installation process requires dfx) + src/build/stable/commands/install_global_dependencies/install_dfx.sh ${{ steps.get-dfx-version.outputs.dfx-version }} + echo "$HOME/.local/share/dfx/bin" >> $GITHUB_PATH + - name: Update dependencies run: | cd ${{ matrix.test.path }} From 042cb709f91a6a9ee5f3dd8e7fade369b063f7f3 Mon Sep 17 00:00:00 2001 From: Benjamin DeMann Date: Tue, 15 Oct 2024 11:40:58 -0600 Subject: [PATCH 09/59] make sure all commits are verified --- .github/workflows/release_parallel.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release_parallel.yml b/.github/workflows/release_parallel.yml index 90e6e0ea1a..a13ce45d00 100644 --- a/.github/workflows/release_parallel.yml +++ b/.github/workflows/release_parallel.yml @@ -129,11 +129,14 @@ jobs: npm install rm -rf node_modules + # TODO we should use some Action-specific bot account - name: Commit and push changes run: | git config --global user.name 'Jordan Last' git config --global user.email 'jordan.michael.last@gmail.com' - git checkout -b "update-${{ matrix.test.name }}" + git config --global commit.gpgsign true + echo -n "$GPG_SIGNING_KEY" | base64 --decode | gpg --import + git config --global user.signingkey C8B77BCBE16CD2B94B43F9C8757397B82D4ED7B0 git add --all git commit -m "Update dependencies for ${{ matrix.test.name }}" git push origin "update-${{ matrix.test.name }}" From 1d94df3555c5410e3d6b4d89008c0f1ad3461298 Mon Sep 17 00:00:00 2001 From: Benjamin DeMann Date: Tue, 15 Oct 2024 11:46:47 -0600 Subject: [PATCH 10/59] add release version to the branch names --- .github/workflows/release_parallel.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release_parallel.yml b/.github/workflows/release_parallel.yml index a13ce45d00..d5d860fba9 100644 --- a/.github/workflows/release_parallel.yml +++ b/.github/workflows/release_parallel.yml @@ -139,7 +139,7 @@ jobs: git config --global user.signingkey C8B77BCBE16CD2B94B43F9C8757397B82D4ED7B0 git add --all git commit -m "Update dependencies for ${{ matrix.test.name }}" - git push origin "update-${{ matrix.test.name }}" + git push origin "update-${{ needs.prepare-release.outputs.release-version }}-${{ matrix.test.name }}" finalize-release: needs: [prepare-release, update-dependencies] @@ -163,7 +163,7 @@ jobs: echo -n "$GPG_SIGNING_KEY" | base64 --decode | gpg --import git config --global user.signingkey C8B77BCBE16CD2B94B43F9C8757397B82D4ED7B0 - for branch in $(git branch -r | grep 'origin/update-' | sed 's/origin\///'); do + for branch in $(git branch -r | grep 'origin/update-${{ needs.prepare-release.outputs.release-version }}-' | sed 's/origin\///'); do git merge --no-ff "$branch" -m "Merge $branch" done From 6a915286a538b6cb4b3ea21d2d71d8f7ccba02e8 Mon Sep 17 00:00:00 2001 From: Benjamin DeMann Date: Tue, 15 Oct 2024 12:27:35 -0600 Subject: [PATCH 11/59] add env variable --- .github/workflows/release_parallel.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/release_parallel.yml b/.github/workflows/release_parallel.yml index d5d860fba9..347c70b001 100644 --- a/.github/workflows/release_parallel.yml +++ b/.github/workflows/release_parallel.yml @@ -96,6 +96,9 @@ jobs: needs: prepare-release name: Update ${{ 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: From 6bab4a47115acbb68b3ca64f9d62fcbe7f89cd3b Mon Sep 17 00:00:00 2001 From: Benjamin DeMann Date: Tue, 15 Oct 2024 12:47:37 -0600 Subject: [PATCH 12/59] update checkout --- .github/workflows/release_parallel.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/release_parallel.yml b/.github/workflows/release_parallel.yml index 347c70b001..104faff0e9 100644 --- a/.github/workflows/release_parallel.yml +++ b/.github/workflows/release_parallel.yml @@ -106,7 +106,7 @@ jobs: steps: - uses: actions/checkout@v4 with: - fetch-depth: 0 + ref: ${{ github.event.pull_request.head.ref || github.ref }} token: ${{ secrets.LASTMJS_GITHUB_TOKEN || github.token }} - id: get-node-version @@ -154,9 +154,8 @@ jobs: steps: - uses: actions/checkout@v4 with: - fetch-depth: 0 + ref: ${{ github.event.pull_request.head.ref || github.ref }} token: ${{ secrets.LASTMJS_GITHUB_TOKEN || github.token }} - ref: ${{ github.ref_name }} - name: Merge update branches run: | From 9b2f48215d98dfcf19ac370559034b31b9d4735b Mon Sep 17 00:00:00 2001 From: Benjamin DeMann Date: Tue, 15 Oct 2024 12:57:51 -0600 Subject: [PATCH 13/59] create branch --- .github/workflows/release_parallel.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/release_parallel.yml b/.github/workflows/release_parallel.yml index 104faff0e9..92a23c9bf8 100644 --- a/.github/workflows/release_parallel.yml +++ b/.github/workflows/release_parallel.yml @@ -140,6 +140,7 @@ jobs: git config --global commit.gpgsign true echo -n "$GPG_SIGNING_KEY" | base64 --decode | gpg --import git config --global user.signingkey C8B77BCBE16CD2B94B43F9C8757397B82D4ED7B0 + git switch -c "update-${{ needs.prepare-release.outputs.release-version }}-${{ matrix.test.name }}" git add --all git commit -m "Update dependencies for ${{ matrix.test.name }}" git push origin "update-${{ needs.prepare-release.outputs.release-version }}-${{ matrix.test.name }}" From 2da525f6d3e917fa710dd29e2c4c10aa57627aa4 Mon Sep 17 00:00:00 2001 From: Benjamin DeMann Date: Tue, 15 Oct 2024 13:13:32 -0600 Subject: [PATCH 14/59] remove sub release trouble shooter --- .github/workflows/sub-release.yml | 69 ------------------------------- 1 file changed, 69 deletions(-) delete mode 100644 .github/workflows/sub-release.yml diff --git a/.github/workflows/sub-release.yml b/.github/workflows/sub-release.yml deleted file mode 100644 index 9483ab7215..0000000000 --- a/.github/workflows/sub-release.yml +++ /dev/null @@ -1,69 +0,0 @@ -name: Sub Release -on: - workflow_call: - secrets: - GPG_SIGNING_KEY: - required: true - GH_TOKEN: - required: true - inputs: - test_infos: - required: true - type: string - -jobs: - 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 - runs-on: ubuntu-latest - env: - GPG_SIGNING_KEY: ${{ secrets.GPG_SIGNING_KEY }} # All commits must be verified - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - steps: - - uses: actions/checkout@v4 - with: - ref: ${{ github.event.pull_request.head.ref || github.ref }} - token: ${{ secrets.LASTMJS_GITHUB_TOKEN || github.token }} - - - id: get-node-version - uses: ./.github/actions/get_node_version - - - uses: actions/setup-node@v4 - with: - node-version: ${{ steps.get-node-version.outputs.node-version }} - registry-url: https://registry.npmjs.org - env: - NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} - - - name: Install curl - run: sudo apt-get install curl -y - - - id: get-dfx-version - uses: ./.github/actions/get_dfx_version - - - name: Install dfx - run: | - # Install dfx (Note: dfx must be installed before `npx azle` because the azle installation process requires dfx) - src/build/stable/commands/install_global_dependencies/install_dfx.sh ${{ steps.get-dfx-version.outputs.dfx-version }} - echo "$HOME/.local/share/dfx/bin" >> $GITHUB_PATH - - - run: npm install - - - name: Install global dependencies - run: | - AZLE_VERBOSE=true npx azle install-global-dependencies --rust --wasi2ic - - # TODO we should use some Action-specific bot account - - name: Configure git for publishing release - run: | - git config --global user.name 'Jordan Last' - git config --global user.email 'jordan.michael.last@gmail.com' - git config --global commit.gpgsign true - echo -n "$GPG_SIGNING_KEY" | base64 --decode | gpg --import - git config --global user.signingkey C8B77BCBE16CD2B94B43F9C8757397B82D4ED7B0 - - - name: Publish release - run: | - BRANCH_NAME="${{ github.head_ref }}" - RELEASE_VERSION="${BRANCH_NAME:9}" - ./.github/scripts/publish_github_action.sh $RELEASE_VERSION ${{ toJSON(inputs.test_infos) }} From 41cffb98fc8a7c49dc6c5c3618b8e286ff6ff0dc Mon Sep 17 00:00:00 2001 From: Benjamin DeMann Date: Tue, 15 Oct 2024 13:30:39 -0600 Subject: [PATCH 15/59] make sure branches are unique --- .github/workflows/release_parallel.yml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/workflows/release_parallel.yml b/.github/workflows/release_parallel.yml index 92a23c9bf8..4db313801b 100644 --- a/.github/workflows/release_parallel.yml +++ b/.github/workflows/release_parallel.yml @@ -140,10 +140,11 @@ jobs: git config --global commit.gpgsign true echo -n "$GPG_SIGNING_KEY" | base64 --decode | gpg --import git config --global user.signingkey C8B77BCBE16CD2B94B43F9C8757397B82D4ED7B0 - git switch -c "update-${{ needs.prepare-release.outputs.release-version }}-${{ matrix.test.name }}" + BRANCH_NAME="update-${{ needs.prepare-release.outputs.release-version }}-$(echo '${{ matrix.test.displayPath }}' | sed 's/\//-/g')" + git switch -c "$BRANCH_NAME" git add --all - git commit -m "Update dependencies for ${{ matrix.test.name }}" - git push origin "update-${{ needs.prepare-release.outputs.release-version }}-${{ matrix.test.name }}" + git commit -m "Update dependencies for ${{ matrix.test.displayPath }}" + git push origin "$BRANCH_NAME" finalize-release: needs: [prepare-release, update-dependencies] @@ -166,7 +167,7 @@ jobs: echo -n "$GPG_SIGNING_KEY" | base64 --decode | gpg --import git config --global user.signingkey C8B77BCBE16CD2B94B43F9C8757397B82D4ED7B0 - for branch in $(git branch -r | grep 'origin/update-${{ needs.prepare-release.outputs.release-version }}-' | sed 's/origin\///'); do + for branch in $(git branch -r | grep "origin/update-${{ needs.prepare-release.outputs.release-version }}-" | sed 's/origin\///'); do git merge --no-ff "$branch" -m "Merge $branch" done From 76f1f52df7570ce3fc116a065594886e6158389d Mon Sep 17 00:00:00 2001 From: Benjamin DeMann Date: Tue, 15 Oct 2024 15:48:02 -0600 Subject: [PATCH 16/59] try these things --- .github/workflows/release_parallel.yml | 6 +++++- package.json | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release_parallel.yml b/.github/workflows/release_parallel.yml index 4db313801b..c5024abbb8 100644 --- a/.github/workflows/release_parallel.yml +++ b/.github/workflows/release_parallel.yml @@ -143,7 +143,11 @@ jobs: BRANCH_NAME="update-${{ needs.prepare-release.outputs.release-version }}-$(echo '${{ matrix.test.displayPath }}' | sed 's/\//-/g')" git switch -c "$BRANCH_NAME" git add --all - git commit -m "Update dependencies for ${{ matrix.test.displayPath }}" + 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" finalize-release: diff --git a/package.json b/package.json index 7632b3fe75..1fea4c64cf 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "scripts": { "typecheck": "tsc --noEmit", "lint": "if [ \"$npm_config_fix\" ]; then eslint . --ext .js,.ts --cache --fix; else eslint . --ext .js,.ts --cache; fi", - "prepare": "husky install", + "prepare": "[ -f .git/hooks ] && husky install || true", "install": "cd dfx_extension && ./install.sh", "test": "test/test.sh" }, From c539b671e246e63168a94eca8ec5045f67fce5a3 Mon Sep 17 00:00:00 2001 From: Benjamin DeMann Date: Tue, 15 Oct 2024 16:12:16 -0600 Subject: [PATCH 17/59] update finalize release step --- .github/workflows/release_parallel.yml | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release_parallel.yml b/.github/workflows/release_parallel.yml index c5024abbb8..2b877390cb 100644 --- a/.github/workflows/release_parallel.yml +++ b/.github/workflows/release_parallel.yml @@ -162,6 +162,7 @@ jobs: with: ref: ${{ github.event.pull_request.head.ref || github.ref }} token: ${{ secrets.LASTMJS_GITHUB_TOKEN || github.token }} + fetch-depth: 0 # Fetch all history for all branches and tags - name: Merge update branches run: | @@ -171,11 +172,28 @@ jobs: echo -n "$GPG_SIGNING_KEY" | base64 --decode | gpg --import git config --global user.signingkey C8B77BCBE16CD2B94B43F9C8757397B82D4ED7B0 + # Determine the current branch name + CURRENT_BRANCH=$(git rev-parse --abbrev-ref HEAD) + echo "Current branch: $CURRENT_BRANCH" + + # Fetch all branches + git fetch --all + + # List and merge update branches for branch in $(git branch -r | grep "origin/update-${{ needs.prepare-release.outputs.release-version }}-" | sed 's/origin\///'); do - git merge --no-ff "$branch" -m "Merge $branch" + echo "Merging branch: $branch" + git merge --no-ff "$branch" -m "Merge $branch" || { + echo "Failed to merge $branch" + exit 1 + } done - git push origin ${{ github.ref_name }} + # Push changes + echo "Pushing changes to $CURRENT_BRANCH" + git push origin $CURRENT_BRANCH || { + echo "Failed to push changes" + exit 1 + } - name: Create release run: | From 14fcc9741b85196627f5708ad0f64e11a15a5dcc Mon Sep 17 00:00:00 2001 From: Benjamin DeMann Date: Tue, 15 Oct 2024 16:23:41 -0600 Subject: [PATCH 18/59] fetch the branch --- .github/workflows/release_parallel.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release_parallel.yml b/.github/workflows/release_parallel.yml index 2b877390cb..e82f98281e 100644 --- a/.github/workflows/release_parallel.yml +++ b/.github/workflows/release_parallel.yml @@ -182,9 +182,11 @@ jobs: # List and merge update branches for branch in $(git branch -r | grep "origin/update-${{ needs.prepare-release.outputs.release-version }}-" | sed 's/origin\///'); do echo "Merging branch: $branch" + git fetch origin $branch:$branch git merge --no-ff "$branch" -m "Merge $branch" || { echo "Failed to merge $branch" - exit 1 + git merge --abort + continue } done From d85a32d86f5b9d754662ece7ced0fc6852438254 Mon Sep 17 00:00:00 2001 From: Benjamin DeMann Date: Wed, 16 Oct 2024 09:19:06 -0600 Subject: [PATCH 19/59] clean up --- .github/workflows/release_parallel.yml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/.github/workflows/release_parallel.yml b/.github/workflows/release_parallel.yml index e82f98281e..77a07b97f6 100644 --- a/.github/workflows/release_parallel.yml +++ b/.github/workflows/release_parallel.yml @@ -188,6 +188,10 @@ jobs: git merge --abort continue } + + # Delete the remote branch after successful merge + git push origin --delete "$branch" + echo "Deleted remote branch: $branch" done # Push changes @@ -197,6 +201,14 @@ jobs: exit 1 } + - name: Trigger tests + run: | + # Update a file to trigger the tests + echo "Release ${{ needs.prepare-release.outputs.release-version }} - $(date)" >> RELEASE.md + git add RELEASE.md + git commit -m "Trigger tests for release ${{ needs.prepare-release.outputs.release-version }}" + git push origin $CURRENT_BRANCH + - name: Create release run: | VERSION=${{ needs.prepare-release.outputs.release-version }} From 58ba02b1e768702eba9f7df567d047ad1e21a605 Mon Sep 17 00:00:00 2001 From: Benjamin DeMann Date: Wed, 16 Oct 2024 10:56:57 -0600 Subject: [PATCH 20/59] use PAT --- .github/workflows/release_parallel.yml | 14 ++++---------- .github/workflows/test.yml | 2 +- 2 files changed, 5 insertions(+), 11 deletions(-) diff --git a/.github/workflows/release_parallel.yml b/.github/workflows/release_parallel.yml index 77a07b97f6..80b329020d 100644 --- a/.github/workflows/release_parallel.yml +++ b/.github/workflows/release_parallel.yml @@ -165,6 +165,8 @@ jobs: fetch-depth: 0 # Fetch all history for all branches and tags - name: Merge update branches + env: + PAT: ${{ secrets.WORKFLOW_PAT }} run: | git config --global user.name 'Jordan Last' git config --global user.email 'jordan.michael.last@gmail.com' @@ -194,21 +196,13 @@ jobs: echo "Deleted remote branch: $branch" done - # Push changes + # Push changes using PAT echo "Pushing changes to $CURRENT_BRANCH" - git push origin $CURRENT_BRANCH || { + git push https://$PAT@github.com/${{ github.repository }}.git HEAD:$CURRENT_BRANCH || { echo "Failed to push changes" exit 1 } - - name: Trigger tests - run: | - # Update a file to trigger the tests - echo "Release ${{ needs.prepare-release.outputs.release-version }} - $(date)" >> RELEASE.md - git add RELEASE.md - git commit -m "Trigger tests for release ${{ needs.prepare-release.outputs.release-version }}" - git push origin $CURRENT_BRANCH - - name: Create release run: | VERSION=${{ needs.prepare-release.outputs.release-version }} diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 9a958115b6..47c06654ee 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -8,7 +8,7 @@ on: push: branches: - main - pull_request: # Runs on pull requests to any branch + pull_request: jobs: determine-should-run-tests: From fcef3f5f0b596e8150b137b6e16d9abe20077ebb Mon Sep 17 00:00:00 2001 From: Benjamin DeMann Date: Fri, 18 Oct 2024 14:03:40 -0600 Subject: [PATCH 21/59] correctly bring in the lastmjs pat --- .github/workflows/release.yml | 1 + .github/workflows/release_parallel.yml | 10 ++++++---- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index c762f5c3e7..2d61ac8886 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -53,3 +53,4 @@ jobs: GPG_SIGNING_KEY: ${{ secrets.GPG_SIGNING_KEY }} # All commits must be verified 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 80b329020d..318468e835 100644 --- a/.github/workflows/release_parallel.yml +++ b/.github/workflows/release_parallel.yml @@ -8,6 +8,8 @@ on: required: true NPM_TOKEN: required: true + LASTMJS_GITHUB_TOKEN: + required: true jobs: prepare-release: @@ -23,7 +25,7 @@ jobs: - uses: actions/checkout@v4 with: ref: ${{ github.event.pull_request.head.ref || github.ref }} - token: ${{ secrets.LASTMJS_GITHUB_TOKEN || github.token }} + token: ${{ secrets.LASTMJS_GITHUB_TOKEN }} - id: get-version run: | @@ -107,7 +109,7 @@ jobs: - uses: actions/checkout@v4 with: ref: ${{ github.event.pull_request.head.ref || github.ref }} - token: ${{ secrets.LASTMJS_GITHUB_TOKEN || github.token }} + token: ${{ secrets.LASTMJS_GITHUB_TOKEN }} - id: get-node-version uses: ./.github/actions/get_node_version @@ -161,12 +163,12 @@ jobs: - uses: actions/checkout@v4 with: ref: ${{ github.event.pull_request.head.ref || github.ref }} - token: ${{ secrets.LASTMJS_GITHUB_TOKEN || github.token }} + token: ${{ secrets.LASTMJS_GITHUB_TOKEN }} fetch-depth: 0 # Fetch all history for all branches and tags - name: Merge update branches env: - PAT: ${{ secrets.WORKFLOW_PAT }} + PAT: ${{ secrets.LASTMJS_GITHUB_TOKEN }} run: | git config --global user.name 'Jordan Last' git config --global user.email 'jordan.michael.last@gmail.com' From d4ebd9b3b828d4f5105a66387b3049b3c616a581 Mon Sep 17 00:00:00 2001 From: Benjamin DeMann Date: Fri, 18 Oct 2024 15:02:55 -0600 Subject: [PATCH 22/59] remove explicit path --- .github/workflows/release_parallel.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/release_parallel.yml b/.github/workflows/release_parallel.yml index 318468e835..930cc7c2ee 100644 --- a/.github/workflows/release_parallel.yml +++ b/.github/workflows/release_parallel.yml @@ -25,7 +25,7 @@ jobs: - uses: actions/checkout@v4 with: ref: ${{ github.event.pull_request.head.ref || github.ref }} - token: ${{ secrets.LASTMJS_GITHUB_TOKEN }} + token: ${{ secrets.LASTMJS_GITHUB_TOKEN || github.token }} - id: get-version run: | @@ -109,7 +109,7 @@ jobs: - uses: actions/checkout@v4 with: ref: ${{ github.event.pull_request.head.ref || github.ref }} - token: ${{ secrets.LASTMJS_GITHUB_TOKEN }} + token: ${{ secrets.LASTMJS_GITHUB_TOKEN || github.token }} - id: get-node-version uses: ./.github/actions/get_node_version @@ -200,7 +200,7 @@ jobs: # Push changes using PAT echo "Pushing changes to $CURRENT_BRANCH" - git push https://$PAT@github.com/${{ github.repository }}.git HEAD:$CURRENT_BRANCH || { + git push origin HEAD:$CURRENT_BRANCH || { echo "Failed to push changes" exit 1 } From 1b7da25ba3e5d5e0cfe95ed14e94a56d3e7ba209 Mon Sep 17 00:00:00 2001 From: Benjamin DeMann Date: Wed, 23 Oct 2024 15:30:44 -0600 Subject: [PATCH 23/59] pr fixes --- .github/workflows/release_parallel.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/release_parallel.yml b/.github/workflows/release_parallel.yml index 930cc7c2ee..f77085533e 100644 --- a/.github/workflows/release_parallel.yml +++ b/.github/workflows/release_parallel.yml @@ -76,8 +76,8 @@ jobs: sed -E -i "s/(\"version\": \")(.*)(\")/\1$VERSION\3/" package.json sed -E -i "s/(\"version\": \")(.*)(\")/\1$VERSION\3/" dfx_extension/extension.json npm install - npx azle template - npx azle template --experimental + AZLE_VERBOSE=true npx azle template + AZLE_VERBOSE=true npx azle template --experimental - name: Publish to npm run: | @@ -94,7 +94,7 @@ jobs: ./examples ./tests - update-dependencies: + update-tests-for-release: needs: prepare-release name: Update ${{ matrix.test.name }} runs-on: ubuntu-latest @@ -127,7 +127,7 @@ jobs: src/build/stable/commands/install_global_dependencies/install_dfx.sh ${{ steps.get-dfx-version.outputs.dfx-version }} echo "$HOME/.local/share/dfx/bin" >> $GITHUB_PATH - - name: Update dependencies + - name: Update azle version run: | cd ${{ matrix.test.path }} sed -E -i "s/(\"azle\": \")(.*)(\")/\1${{ needs.prepare-release.outputs.release-version }}\3/" package.json From bda1f3cd3d9eb1d690fff214c628665d650592f0 Mon Sep 17 00:00:00 2001 From: Benjamin DeMann Date: Wed, 23 Oct 2024 15:58:15 -0600 Subject: [PATCH 24/59] further update names --- .github/workflows/release_parallel.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release_parallel.yml b/.github/workflows/release_parallel.yml index f77085533e..c3821ec8da 100644 --- a/.github/workflows/release_parallel.yml +++ b/.github/workflows/release_parallel.yml @@ -94,7 +94,7 @@ jobs: ./examples ./tests - update-tests-for-release: + update-test-files-for-release-commit: needs: prepare-release name: Update ${{ matrix.test.name }} runs-on: ubuntu-latest From 73d01266b4579d44cac7eb8d4362ba3f8a9b168d Mon Sep 17 00:00:00 2001 From: Benjamin DeMann Date: Thu, 24 Oct 2024 15:05:09 -0600 Subject: [PATCH 25/59] restore old husky install --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 1fea4c64cf..7632b3fe75 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "scripts": { "typecheck": "tsc --noEmit", "lint": "if [ \"$npm_config_fix\" ]; then eslint . --ext .js,.ts --cache --fix; else eslint . --ext .js,.ts --cache; fi", - "prepare": "[ -f .git/hooks ] && husky install || true", + "prepare": "husky install", "install": "cd dfx_extension && ./install.sh", "test": "test/test.sh" }, From 10c660fa0fd16208e37c032895ad44bc7412d6f6 Mon Sep 17 00:00:00 2001 From: Benjamin DeMann Date: Thu, 24 Oct 2024 15:05:52 -0600 Subject: [PATCH 26/59] get rid of GH_TOKEN --- .github/workflows/release.yml | 1 - .github/workflows/release_parallel.yml | 7 +------ 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 2d61ac8886..8148c83111 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -51,6 +51,5 @@ jobs: uses: ./.github/workflows/release_parallel.yml secrets: GPG_SIGNING_KEY: ${{ secrets.GPG_SIGNING_KEY }} # All commits must be verified - 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 c3821ec8da..6e24f7e6de 100644 --- a/.github/workflows/release_parallel.yml +++ b/.github/workflows/release_parallel.yml @@ -4,8 +4,6 @@ on: secrets: GPG_SIGNING_KEY: required: true - GH_TOKEN: - required: true NPM_TOKEN: required: true LASTMJS_GITHUB_TOKEN: @@ -17,7 +15,6 @@ jobs: runs-on: ubuntu-latest env: 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 }} test-infos: ${{ steps.get-test-infos.outputs.test-infos }} @@ -100,7 +97,6 @@ jobs: runs-on: ubuntu-latest env: GPG_SIGNING_KEY: ${{ secrets.GPG_SIGNING_KEY }} - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} strategy: fail-fast: false matrix: @@ -153,12 +149,11 @@ jobs: git push origin "$BRANCH_NAME" finalize-release: - needs: [prepare-release, update-dependencies] + needs: [prepare-release, update-test-files-for-release-commit] name: Finalize Release runs-on: ubuntu-latest env: GPG_SIGNING_KEY: ${{ secrets.GPG_SIGNING_KEY }} - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} steps: - uses: actions/checkout@v4 with: From eee67f6138fa74950231b41bc89b624739a192d3 Mon Sep 17 00:00:00 2001 From: Benjamin DeMann Date: Thu, 24 Oct 2024 15:20:51 -0600 Subject: [PATCH 27/59] install azle before updating azle --- .github/workflows/release_parallel.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/release_parallel.yml b/.github/workflows/release_parallel.yml index 6e24f7e6de..3f2b2971f3 100644 --- a/.github/workflows/release_parallel.yml +++ b/.github/workflows/release_parallel.yml @@ -125,6 +125,7 @@ jobs: - name: Update azle version run: | + npm install cd ${{ matrix.test.path }} sed -E -i "s/(\"azle\": \")(.*)(\")/\1${{ needs.prepare-release.outputs.release-version }}\3/" package.json npm install From 6386be2b7d0cd1987375926958aac4fe32a6d4f7 Mon Sep 17 00:00:00 2001 From: Benjamin DeMann Date: Thu, 24 Oct 2024 15:40:09 -0600 Subject: [PATCH 28/59] bring back GH_TOKEN --- .github/workflows/release.yml | 1 + .github/workflows/release_parallel.yml | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 8148c83111..2d61ac8886 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -51,5 +51,6 @@ jobs: uses: ./.github/workflows/release_parallel.yml secrets: GPG_SIGNING_KEY: ${{ secrets.GPG_SIGNING_KEY }} # All commits must be verified + 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 3f2b2971f3..8a97338411 100644 --- a/.github/workflows/release_parallel.yml +++ b/.github/workflows/release_parallel.yml @@ -4,6 +4,8 @@ on: secrets: GPG_SIGNING_KEY: required: true + GH_TOKEN: + required: true NPM_TOKEN: required: true LASTMJS_GITHUB_TOKEN: @@ -15,6 +17,7 @@ jobs: runs-on: ubuntu-latest env: 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 }} test-infos: ${{ steps.get-test-infos.outputs.test-infos }} @@ -97,6 +100,7 @@ jobs: runs-on: ubuntu-latest env: GPG_SIGNING_KEY: ${{ secrets.GPG_SIGNING_KEY }} + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} strategy: fail-fast: false matrix: @@ -155,6 +159,7 @@ jobs: runs-on: ubuntu-latest env: GPG_SIGNING_KEY: ${{ secrets.GPG_SIGNING_KEY }} + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} steps: - uses: actions/checkout@v4 with: From ec0424d9dcf347fe6978db9a725ebdde1432083a Mon Sep 17 00:00:00 2001 From: Benjamin DeMann Date: Thu, 24 Oct 2024 15:49:06 -0600 Subject: [PATCH 29/59] try just fetching as we need --- .github/workflows/release_parallel.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.github/workflows/release_parallel.yml b/.github/workflows/release_parallel.yml index 8a97338411..c0a0d25aad 100644 --- a/.github/workflows/release_parallel.yml +++ b/.github/workflows/release_parallel.yml @@ -165,7 +165,6 @@ jobs: with: ref: ${{ github.event.pull_request.head.ref || github.ref }} token: ${{ secrets.LASTMJS_GITHUB_TOKEN }} - fetch-depth: 0 # Fetch all history for all branches and tags - name: Merge update branches env: @@ -181,9 +180,6 @@ jobs: CURRENT_BRANCH=$(git rev-parse --abbrev-ref HEAD) echo "Current branch: $CURRENT_BRANCH" - # Fetch all branches - git fetch --all - # List and merge update branches for branch in $(git branch -r | grep "origin/update-${{ needs.prepare-release.outputs.release-version }}-" | sed 's/origin\///'); do echo "Merging branch: $branch" From df84c5d620c6316c5156740e427ac9a9aaa0548c Mon Sep 17 00:00:00 2001 From: Benjamin DeMann Date: Thu, 24 Oct 2024 15:52:27 -0600 Subject: [PATCH 30/59] simpler getting of the current branch --- .github/workflows/release_parallel.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release_parallel.yml b/.github/workflows/release_parallel.yml index c0a0d25aad..7c862d19a5 100644 --- a/.github/workflows/release_parallel.yml +++ b/.github/workflows/release_parallel.yml @@ -177,7 +177,7 @@ jobs: git config --global user.signingkey C8B77BCBE16CD2B94B43F9C8757397B82D4ED7B0 # Determine the current branch name - CURRENT_BRANCH=$(git rev-parse --abbrev-ref HEAD) + CURRENT_BRANCH=$(git branch --show-current) echo "Current branch: $CURRENT_BRANCH" # List and merge update branches From 39f42da6ad6710a7cbff0f0ed57245a89bfcada3 Mon Sep 17 00:00:00 2001 From: Benjamin DeMann Date: Thu, 24 Oct 2024 16:05:14 -0600 Subject: [PATCH 31/59] try a squashing strategy --- .github/workflows/release_parallel.yml | 26 +++++++++++--------------- 1 file changed, 11 insertions(+), 15 deletions(-) diff --git a/.github/workflows/release_parallel.yml b/.github/workflows/release_parallel.yml index 7c862d19a5..3d3e65de93 100644 --- a/.github/workflows/release_parallel.yml +++ b/.github/workflows/release_parallel.yml @@ -166,7 +166,7 @@ jobs: ref: ${{ github.event.pull_request.head.ref || github.ref }} token: ${{ secrets.LASTMJS_GITHUB_TOKEN }} - - name: Merge update branches + - name: Squash merge update branches env: PAT: ${{ secrets.LASTMJS_GITHUB_TOKEN }} run: | @@ -176,31 +176,27 @@ jobs: echo -n "$GPG_SIGNING_KEY" | base64 --decode | gpg --import git config --global user.signingkey C8B77BCBE16CD2B94B43F9C8757397B82D4ED7B0 - # Determine the current branch name CURRENT_BRANCH=$(git branch --show-current) - echo "Current branch: $CURRENT_BRANCH" - # List and merge update branches + # Get all update branches for branch in $(git branch -r | grep "origin/update-${{ needs.prepare-release.outputs.release-version }}-" | sed 's/origin\///'); do - echo "Merging branch: $branch" + echo "Squash merging branch: $branch" git fetch origin $branch:$branch - git merge --no-ff "$branch" -m "Merge $branch" || { + + # Merge with squash + git merge --squash "$branch" || { echo "Failed to merge $branch" git merge --abort - continue + exit 1 } + git commit -m "Squashed changes from $branch" || true - # Delete the remote branch after successful merge + # Delete the remote branch git push origin --delete "$branch" - echo "Deleted remote branch: $branch" done - # Push changes using PAT - echo "Pushing changes to $CURRENT_BRANCH" - git push origin HEAD:$CURRENT_BRANCH || { - echo "Failed to push changes" - exit 1 - } + # Push the changes + git push origin HEAD:$CURRENT_BRANCH - name: Create release run: | From bd559c3d29285e2328d30f7990f41eb5af0e7686 Mon Sep 17 00:00:00 2001 From: Benjamin DeMann Date: Thu, 24 Oct 2024 16:10:11 -0600 Subject: [PATCH 32/59] just do fetch all --- .github/workflows/release_parallel.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/release_parallel.yml b/.github/workflows/release_parallel.yml index 3d3e65de93..f90e1ccb06 100644 --- a/.github/workflows/release_parallel.yml +++ b/.github/workflows/release_parallel.yml @@ -178,6 +178,8 @@ jobs: CURRENT_BRANCH=$(git branch --show-current) + git fetch --all + # Get all update branches for branch in $(git branch -r | grep "origin/update-${{ needs.prepare-release.outputs.release-version }}-" | sed 's/origin\///'); do echo "Squash merging branch: $branch" From 9929a89287d6f476a7d1bb915ca732bccab7f135 Mon Sep 17 00:00:00 2001 From: Benjamin DeMann Date: Thu, 24 Oct 2024 16:36:07 -0600 Subject: [PATCH 33/59] switch to cherry picking --- .github/workflows/release_parallel.yml | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/.github/workflows/release_parallel.yml b/.github/workflows/release_parallel.yml index f90e1ccb06..d0d65ab23d 100644 --- a/.github/workflows/release_parallel.yml +++ b/.github/workflows/release_parallel.yml @@ -76,8 +76,9 @@ jobs: sed -E -i "s/(\"version\": \")(.*)(\")/\1$VERSION\3/" package.json sed -E -i "s/(\"version\": \")(.*)(\")/\1$VERSION\3/" dfx_extension/extension.json npm install - AZLE_VERBOSE=true npx azle template - AZLE_VERBOSE=true npx azle template --experimental + ## TODO bring these back after we are done testing + # AZLE_VERBOSE=true npx azle template + # AZLE_VERBOSE=true npx azle template --experimental - name: Publish to npm run: | @@ -166,7 +167,7 @@ jobs: ref: ${{ github.event.pull_request.head.ref || github.ref }} token: ${{ secrets.LASTMJS_GITHUB_TOKEN }} - - name: Squash merge update branches + - name: Cherry-pick changes from update branches env: PAT: ${{ secrets.LASTMJS_GITHUB_TOKEN }} run: | @@ -179,19 +180,17 @@ jobs: CURRENT_BRANCH=$(git branch --show-current) git fetch --all - - # Get all update branches + # Get all update branches and cherry-pick their changes for branch in $(git branch -r | grep "origin/update-${{ needs.prepare-release.outputs.release-version }}-" | sed 's/origin\///'); do - echo "Squash merging branch: $branch" + echo "Cherry-picking changes from branch: $branch" git fetch origin $branch:$branch - # Merge with squash - git merge --squash "$branch" || { - echo "Failed to merge $branch" - git merge --abort + # Get the commit from the branch and cherry-pick it + git cherry-pick $branch || { + echo "Failed to cherry-pick from $branch" + git cherry-pick --abort exit 1 } - git commit -m "Squashed changes from $branch" || true # Delete the remote branch git push origin --delete "$branch" From b81f0156644738ba73cddbf2495c19fbeb4664e6 Mon Sep 17 00:00:00 2001 From: Benjamin DeMann Date: Thu, 24 Oct 2024 16:48:08 -0600 Subject: [PATCH 34/59] do a soft reset to squash all commits into one --- .github/workflows/release_parallel.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release_parallel.yml b/.github/workflows/release_parallel.yml index d0d65ab23d..aeb130b6be 100644 --- a/.github/workflows/release_parallel.yml +++ b/.github/workflows/release_parallel.yml @@ -167,7 +167,7 @@ jobs: ref: ${{ github.event.pull_request.head.ref || github.ref }} token: ${{ secrets.LASTMJS_GITHUB_TOKEN }} - - name: Cherry-pick changes from update branches + - name: Cherry-pick and squash changes env: PAT: ${{ secrets.LASTMJS_GITHUB_TOKEN }} run: | @@ -178,6 +178,7 @@ jobs: git config --global user.signingkey C8B77BCBE16CD2B94B43F9C8757397B82D4ED7B0 CURRENT_BRANCH=$(git branch --show-current) + BASE_COMMIT=$(git rev-parse HEAD) git fetch --all # Get all update branches and cherry-pick their changes @@ -196,7 +197,10 @@ jobs: git push origin --delete "$branch" done - # Push the changes + # Squash all cherry-picked commits into one + git reset --soft $BASE_COMMIT + git commit -am "Update all dependencies for release ${{ needs.prepare-release.outputs.release-version }}" + git push origin HEAD:$CURRENT_BRANCH - name: Create release From 622de9df5c2bf07a54424087ec6641d5a2fadf80 Mon Sep 17 00:00:00 2001 From: Benjamin DeMann Date: Thu, 24 Oct 2024 17:09:08 -0600 Subject: [PATCH 35/59] try squash again --- .github/workflows/release_parallel.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/release_parallel.yml b/.github/workflows/release_parallel.yml index aeb130b6be..58bdd325b5 100644 --- a/.github/workflows/release_parallel.yml +++ b/.github/workflows/release_parallel.yml @@ -186,12 +186,12 @@ jobs: echo "Cherry-picking changes from branch: $branch" git fetch origin $branch:$branch - # Get the commit from the branch and cherry-pick it - git cherry-pick $branch || { - echo "Failed to cherry-pick from $branch" - git cherry-pick --abort + git merge --squash "$branch" || { + echo "Failed to merge $branch" + git merge --abort exit 1 } + git commit -m "Squashed changes from $branch" || true # Delete the remote branch git push origin --delete "$branch" From 14df4fdc02a09a1af6edbd7cfaf6c64a3e0d7845 Mon Sep 17 00:00:00 2001 From: Benjamin DeMann Date: Fri, 25 Oct 2024 09:31:42 -0600 Subject: [PATCH 36/59] move install dfx into a setup dfx action --- .github/actions/get_dfx_version/action.yml | 14 ---------- .../{get_dfx_version => setup_dfx}/README.md | 6 ++--- .github/actions/setup_dfx/action.yml | 27 +++++++++++++++++++ .github/workflows/release_parallel.yml | 20 +++----------- .github/workflows/run_test.yml | 9 ++----- 5 files changed, 36 insertions(+), 40 deletions(-) delete mode 100644 .github/actions/get_dfx_version/action.yml rename .github/actions/{get_dfx_version => setup_dfx}/README.md (84%) create mode 100644 .github/actions/setup_dfx/action.yml diff --git a/.github/actions/get_dfx_version/action.yml b/.github/actions/get_dfx_version/action.yml deleted file mode 100644 index 3797571230..0000000000 --- a/.github/actions/get_dfx_version/action.yml +++ /dev/null @@ -1,14 +0,0 @@ -name: Get dfx version -description: Determines Azle's dfx version -outputs: - dfx-version: - description: Returns the version of dfx that Azle will test against and use to generate its Wasm binary templates - value: ${{ steps.get-dfx-version.outputs.dfx-version }} -runs: - using: composite - steps: - - id: get-dfx-version - run: | - DFX_VERSION=$(jq -r '.azle.globalDependencies.dfx // error("dfx version not found")' "package.json") - echo "dfx-version=${DFX_VERSION}" >> "$GITHUB_OUTPUT" - shell: bash diff --git a/.github/actions/get_dfx_version/README.md b/.github/actions/setup_dfx/README.md similarity index 84% rename from .github/actions/get_dfx_version/README.md rename to .github/actions/setup_dfx/README.md index 6a114e88db..293d76f9e3 100644 --- a/.github/actions/get_dfx_version/README.md +++ b/.github/actions/setup_dfx/README.md @@ -17,8 +17,8 @@ checking out a specific branch. steps: - uses: actions/checkout@v4 - - id: get-dfx-version - uses: ./.github/actions/get_dfx_version + - id: setup-dfx + uses: ./.github/actions/setup_dfx - - run: echo ${{ steps.get-dfx-version.outputs.dfx-version }} + - run: echo ${{ steps.setup-dfx.outputs.dfx-version }} ``` diff --git a/.github/actions/setup_dfx/action.yml b/.github/actions/setup_dfx/action.yml new file mode 100644 index 0000000000..1d2103cd1a --- /dev/null +++ b/.github/actions/setup_dfx/action.yml @@ -0,0 +1,27 @@ +name: Setup dfx +description: 'Sets up dfx by detecting version from package.json and installing it. (Note: DFX must be installed before `npm install` because the azle installation process requires dfx)' +inputs: + dfx-version: + description: 'The version of dfx to install (optional - will read from package.json if not provided)' + required: false +outputs: + dfx-version: + description: 'The version of dfx that was installed' + value: ${{ steps.get-dfx-version.outputs.dfx-version }} +runs: + using: composite + steps: + - id: get-dfx-version + if: inputs.dfx-version == '' + run: | + DFX_VERSION=$(jq -r '.azle.globalDependencies.dfx // error("dfx version not found")' "package.json") + echo "dfx-version=${DFX_VERSION}" >> "$GITHUB_OUTPUT" + shell: bash + + - name: Install dfx + run: | + VERSION="${{ inputs.dfx-version || steps.get-dfx-version.outputs.dfx-version }}" + # Install dfx (Note: dfx must be installed before `npx azle` because the azle installation process requires dfx) + src/build/stable/commands/install_global_dependencies/install_dfx.sh $VERSION + echo "$HOME/.local/share/dfx/bin" >> $GITHUB_PATH + shell: bash diff --git a/.github/workflows/release_parallel.yml b/.github/workflows/release_parallel.yml index 58bdd325b5..4d550c860c 100644 --- a/.github/workflows/release_parallel.yml +++ b/.github/workflows/release_parallel.yml @@ -46,14 +46,8 @@ jobs: - name: Install curl run: sudo apt-get install curl -y - - id: get-dfx-version - uses: ./.github/actions/get_dfx_version - - - name: Install dfx - run: | - # Install dfx (Note: dfx must be installed before `npx azle` because the azle installation process requires dfx) - src/build/stable/commands/install_global_dependencies/install_dfx.sh ${{ steps.get-dfx-version.outputs.dfx-version }} - echo "$HOME/.local/share/dfx/bin" >> $GITHUB_PATH + - name: Setup dfx + uses: ./.github/actions/setup_dfx - run: npm install @@ -119,14 +113,8 @@ jobs: with: node-version: ${{ steps.get-node-version.outputs.node-version }} - - id: get-dfx-version - uses: ./.github/actions/get_dfx_version - - - name: Install dfx - run: | - # Install dfx (Note: dfx must be installed before `npx azle` because the azle installation process requires dfx) - src/build/stable/commands/install_global_dependencies/install_dfx.sh ${{ steps.get-dfx-version.outputs.dfx-version }} - echo "$HOME/.local/share/dfx/bin" >> $GITHUB_PATH + - name: Setup dfx + uses: ./.github/actions/setup_dfx - name: Update azle version run: | diff --git a/.github/workflows/run_test.yml b/.github/workflows/run_test.yml index 49f8e74415..5074097cdf 100644 --- a/.github/workflows/run_test.yml +++ b/.github/workflows/run_test.yml @@ -65,16 +65,11 @@ jobs: with: node-version: ${{ steps.get-node-version.outputs.node-version }} - - id: get-dfx-version - uses: ./.github/actions/get_dfx_version + - id: setup-dfx + uses: ./.github/actions/setup_dfx - name: Run pre-test Azle setup run: | - - # Install dfx (Note: DFX must be installed before `npm install` because the azle installation process requires dfx) - src/build/stable/commands/install_global_dependencies/install_dfx.sh ${{ steps.get-dfx-version.outputs.dfx-version }} - echo "$HOME/.local/share/dfx/bin" >> $GITHUB_PATH - # MacOS-specific DNS configuration if [[ "${{ matrix.os }}" == "macos-latest" ]]; then sudo networksetup -setdnsservers Ethernet 9.9.9.9 From 9cb3b936d8dcdd9cfca7abf87f7ff6d3a36b9471 Mon Sep 17 00:00:00 2001 From: Benjamin DeMann Date: Fri, 25 Oct 2024 09:36:02 -0600 Subject: [PATCH 37/59] fix include_npm --- .github/workflows/run_test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/run_test.yml b/.github/workflows/run_test.yml index 5074097cdf..439d642b6c 100644 --- a/.github/workflows/run_test.yml +++ b/.github/workflows/run_test.yml @@ -30,7 +30,7 @@ jobs: # os: [macos-latest, ubuntu-latest] os: [ubuntu-latest] azle_source: - - ${{ inputs.include_npm == 'true' && 'npm' || 'repo' }} + - ${{ inputs.include_npm == true && 'npm' || 'repo' }} tests: ${{ fromJSON(inputs.test_infos) }} steps: - uses: actions/checkout@v4 From 790eccb3d128aa52eecc6167e2977e31201c960e Mon Sep 17 00:00:00 2001 From: Benjamin DeMann Date: Fri, 25 Oct 2024 09:38:35 -0600 Subject: [PATCH 38/59] run tests for benchmarks during release --- .github/workflows/release_parallel.yml | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release_parallel.yml b/.github/workflows/release_parallel.yml index 4d550c860c..1af6e66586 100644 --- a/.github/workflows/release_parallel.yml +++ b/.github/workflows/release_parallel.yml @@ -122,7 +122,15 @@ jobs: cd ${{ matrix.test.path }} sed -E -i "s/(\"azle\": \")(.*)(\")/\1${{ needs.prepare-release.outputs.release-version }}\3/" package.json npm install - rm -rf node_modules + + - 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: npm test # TODO we should use some Action-specific bot account - name: Commit and push changes From f6d4ba6f70eb588fc6e22ba81e24a8e6a58cfcde Mon Sep 17 00:00:00 2001 From: Benjamin DeMann Date: Fri, 25 Oct 2024 12:20:17 -0600 Subject: [PATCH 39/59] try this just one more time --- .github/workflows/release_parallel.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/release_parallel.yml b/.github/workflows/release_parallel.yml index 1af6e66586..363e5687bd 100644 --- a/.github/workflows/release_parallel.yml +++ b/.github/workflows/release_parallel.yml @@ -176,7 +176,6 @@ jobs: CURRENT_BRANCH=$(git branch --show-current) BASE_COMMIT=$(git rev-parse HEAD) - git fetch --all # Get all update branches and cherry-pick their changes for branch in $(git branch -r | grep "origin/update-${{ needs.prepare-release.outputs.release-version }}-" | sed 's/origin\///'); do echo "Cherry-picking changes from branch: $branch" From d2dda8b8260fb1874cadf54bb44fd74a3514ab43 Mon Sep 17 00:00:00 2001 From: Benjamin DeMann Date: Fri, 25 Oct 2024 12:36:01 -0600 Subject: [PATCH 40/59] skip some of the longer tests --- .github/workflows/release_parallel.yml | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/.github/workflows/release_parallel.yml b/.github/workflows/release_parallel.yml index 363e5687bd..c4f6b74219 100644 --- a/.github/workflows/release_parallel.yml +++ b/.github/workflows/release_parallel.yml @@ -85,9 +85,16 @@ jobs: - id: get-test-infos uses: ./.github/actions/get_test_infos with: - directories: | - ./examples - ./tests + directories: ${{ format('{0} {1}', './examples', './tests') }} + exclude_dirs: | + ${{ format(' + examples/basic_bitcoin + examples/bitcoin_psbt + examples/ckbtc + tests/end_to_end/http_server + tests/end_to_end/http_server/candid_rpc/functional_syntax + tests/property + ') }} update-test-files-for-release-commit: needs: prepare-release From 37819f0dd88db2b5901d3cd5aa811e4ea4499265 Mon Sep 17 00:00:00 2001 From: Benjamin DeMann Date: Fri, 25 Oct 2024 12:45:21 -0600 Subject: [PATCH 41/59] if we can't skip then at least don't include --- .github/workflows/release_parallel.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release_parallel.yml b/.github/workflows/release_parallel.yml index c4f6b74219..e964b5033b 100644 --- a/.github/workflows/release_parallel.yml +++ b/.github/workflows/release_parallel.yml @@ -85,7 +85,8 @@ jobs: - id: get-test-infos uses: ./.github/actions/get_test_infos with: - directories: ${{ format('{0} {1}', './examples', './tests') }} + directories: | + ./examples exclude_dirs: | ${{ format(' examples/basic_bitcoin From d6c930bece6a25452efacf90b1b06e20f5246fad Mon Sep 17 00:00:00 2001 From: Benjamin DeMann Date: Fri, 25 Oct 2024 12:55:17 -0600 Subject: [PATCH 42/59] try fetch depth 1 --- .github/workflows/release_parallel.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/release_parallel.yml b/.github/workflows/release_parallel.yml index e964b5033b..68b0f65b9c 100644 --- a/.github/workflows/release_parallel.yml +++ b/.github/workflows/release_parallel.yml @@ -170,6 +170,7 @@ jobs: with: ref: ${{ github.event.pull_request.head.ref || github.ref }} token: ${{ secrets.LASTMJS_GITHUB_TOKEN }} + fetch-depth: 0 - name: Cherry-pick and squash changes env: From 5ac562d3514d4bdc71cb27d5cd2836668545602b Mon Sep 17 00:00:00 2001 From: Benjamin DeMann Date: Fri, 25 Oct 2024 13:01:20 -0600 Subject: [PATCH 43/59] skip tests properly --- .github/workflows/release_parallel.yml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release_parallel.yml b/.github/workflows/release_parallel.yml index 68b0f65b9c..b5952a212f 100644 --- a/.github/workflows/release_parallel.yml +++ b/.github/workflows/release_parallel.yml @@ -87,14 +87,17 @@ jobs: with: directories: | ./examples - exclude_dirs: | + ./tests + exclude-dirs: | ${{ format(' examples/basic_bitcoin examples/bitcoin_psbt examples/ckbtc tests/end_to_end/http_server - tests/end_to_end/http_server/candid_rpc/functional_syntax + tests/end_to_end/candid_rpc/functional_syntax tests/property + tests/end_to_end/candid_rpc/class_syntax/bitcoin + tests/end_to_end/candid_rpc/class_syntax/stable_structures ') }} update-test-files-for-release-commit: From 8dac1a9a68246065ce38a387547a99ddb8ac727d Mon Sep 17 00:00:00 2001 From: Benjamin DeMann Date: Fri, 25 Oct 2024 13:13:56 -0600 Subject: [PATCH 44/59] clean up release workflow --- .github/workflows/release.yml | 28 +++------------------------- 1 file changed, 3 insertions(+), 25 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 2d61ac8886..897a33b66c 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -3,7 +3,8 @@ on: push: branches: - main - pull_request: # Runs on pull requests to any branch + pull_request: + jobs: determine-should-release: if: ${{ startsWith(github.head_ref, 'release--') }} @@ -17,28 +18,6 @@ jobs: - id: determine-should-release uses: ./.github/actions/should_release - get-test-infos: - needs: determine-should-release - if: ${{ startsWith(github.head_ref, 'release--') && needs.determine-should-release.outputs.should-release }} - name: Get test infos - runs-on: ubuntu-latest - outputs: - test-infos: ${{ steps.get-test-infos.outputs.test-infos }} - steps: - - uses: actions/checkout@v4 - - - id: get-node-version - uses: ./.github/actions/get_node_version - - - name: Get all test infos - id: get-test-infos - uses: ./.github/actions/get_test_infos - with: - node-version: ${{ steps.get-node-version.outputs.node-version }} - directories: | - ./examples - ./tests - 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 @@ -46,11 +25,10 @@ jobs: needs: - determine-should-release - - get-test-infos uses: ./.github/workflows/release_parallel.yml secrets: - GPG_SIGNING_KEY: ${{ secrets.GPG_SIGNING_KEY }} # All commits must be verified + GPG_SIGNING_KEY: ${{ secrets.GPG_SIGNING_KEY }} GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} NPM_TOKEN: ${{ secrets.NPM_TOKEN }} LASTMJS_GITHUB_TOKEN: ${{ secrets.LASTMJS_GITHUB_TOKEN }} From 81f028cda9bd18158f6a054654defa2859e642fa Mon Sep 17 00:00:00 2001 From: Benjamin DeMann Date: Fri, 25 Oct 2024 13:14:08 -0600 Subject: [PATCH 45/59] add printing for troubleshooting --- .github/actions/get_test_infos/action.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/actions/get_test_infos/action.yml b/.github/actions/get_test_infos/action.yml index 5c421bb733..b06f1dfc12 100644 --- a/.github/actions/get_test_infos/action.yml +++ b/.github/actions/get_test_infos/action.yml @@ -40,3 +40,9 @@ runs: TEST_INFOS=$(./.github/actions/get_test_infos/get_test_infos.sh | base64 -d) echo "test-infos=${TEST_INFOS}" >> "$GITHUB_OUTPUT" shell: bash + + - name: Echo test infos for troubleshooting + run: | + echo "Test Infos Output:" + echo "${{ steps.get-test-infos.outputs.test-infos }}" + shell: bash From 33c54988cec1b5185be6920f4903816adaa33895 Mon Sep 17 00:00:00 2001 From: Benjamin DeMann Date: Fri, 25 Oct 2024 14:50:06 -0600 Subject: [PATCH 46/59] this is crazy --- .github/workflows/release_parallel.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release_parallel.yml b/.github/workflows/release_parallel.yml index b5952a212f..bfae04d931 100644 --- a/.github/workflows/release_parallel.yml +++ b/.github/workflows/release_parallel.yml @@ -173,7 +173,6 @@ jobs: with: ref: ${{ github.event.pull_request.head.ref || github.ref }} token: ${{ secrets.LASTMJS_GITHUB_TOKEN }} - fetch-depth: 0 - name: Cherry-pick and squash changes env: @@ -188,6 +187,8 @@ jobs: CURRENT_BRANCH=$(git branch --show-current) BASE_COMMIT=$(git rev-parse HEAD) + git fetch --all + # Get all update branches and cherry-pick their changes for branch in $(git branch -r | grep "origin/update-${{ needs.prepare-release.outputs.release-version }}-" | sed 's/origin\///'); do echo "Cherry-picking changes from branch: $branch" From cfbb5b5c6996b95e23cc97c371ea4f3c4105738c Mon Sep 17 00:00:00 2001 From: Benjamin DeMann Date: Fri, 25 Oct 2024 15:16:46 -0600 Subject: [PATCH 47/59] try that --- .github/workflows/release_parallel.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/release_parallel.yml b/.github/workflows/release_parallel.yml index bfae04d931..72e2c9723c 100644 --- a/.github/workflows/release_parallel.yml +++ b/.github/workflows/release_parallel.yml @@ -94,7 +94,7 @@ jobs: examples/bitcoin_psbt examples/ckbtc tests/end_to_end/http_server - tests/end_to_end/candid_rpc/functional_syntax + tests/end_to_end/candid_rpc tests/property tests/end_to_end/candid_rpc/class_syntax/bitcoin tests/end_to_end/candid_rpc/class_syntax/stable_structures @@ -173,6 +173,7 @@ jobs: with: ref: ${{ github.event.pull_request.head.ref || github.ref }} token: ${{ secrets.LASTMJS_GITHUB_TOKEN }} + fetch-depth: 0 - name: Cherry-pick and squash changes env: @@ -187,8 +188,6 @@ jobs: CURRENT_BRANCH=$(git branch --show-current) BASE_COMMIT=$(git rev-parse HEAD) - git fetch --all - # Get all update branches and cherry-pick their changes for branch in $(git branch -r | grep "origin/update-${{ needs.prepare-release.outputs.release-version }}-" | sed 's/origin\///'); do echo "Cherry-picking changes from branch: $branch" From 7d89b369a47c83c60b769c74f64780d1ee864703 Mon Sep 17 00:00:00 2001 From: Benjamin DeMann Date: Fri, 25 Oct 2024 15:31:58 -0600 Subject: [PATCH 48/59] clean up --- .github/workflows/release_parallel.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/release_parallel.yml b/.github/workflows/release_parallel.yml index 72e2c9723c..20671d7b1f 100644 --- a/.github/workflows/release_parallel.yml +++ b/.github/workflows/release_parallel.yml @@ -175,9 +175,7 @@ jobs: token: ${{ secrets.LASTMJS_GITHUB_TOKEN }} fetch-depth: 0 - - name: Cherry-pick and squash changes - env: - PAT: ${{ secrets.LASTMJS_GITHUB_TOKEN }} + - name: Configure git run: | git config --global user.name 'Jordan Last' git config --global user.email 'jordan.michael.last@gmail.com' @@ -185,10 +183,13 @@ jobs: echo -n "$GPG_SIGNING_KEY" | base64 --decode | gpg --import git config --global user.signingkey C8B77BCBE16CD2B94B43F9C8757397B82D4ED7B0 + - name: Squash changes + env: + PAT: ${{ secrets.LASTMJS_GITHUB_TOKEN }} + run: | CURRENT_BRANCH=$(git branch --show-current) BASE_COMMIT=$(git rev-parse HEAD) - # Get all update branches and cherry-pick their changes for branch in $(git branch -r | grep "origin/update-${{ needs.prepare-release.outputs.release-version }}-" | sed 's/origin\///'); do echo "Cherry-picking changes from branch: $branch" git fetch origin $branch:$branch @@ -204,7 +205,6 @@ jobs: git push origin --delete "$branch" done - # Squash all cherry-picked commits into one git reset --soft $BASE_COMMIT git commit -am "Update all dependencies for release ${{ needs.prepare-release.outputs.release-version }}" From f54a68f438c17d3cbff167eee4def7d1f545bf90 Mon Sep 17 00:00:00 2001 From: Benjamin DeMann Date: Fri, 25 Oct 2024 15:41:03 -0600 Subject: [PATCH 49/59] batch delete branches --- .github/workflows/release_parallel.yml | 28 +++++++++++++++++++++----- 1 file changed, 23 insertions(+), 5 deletions(-) diff --git a/.github/workflows/release_parallel.yml b/.github/workflows/release_parallel.yml index 20671d7b1f..9ee7fc6b90 100644 --- a/.github/workflows/release_parallel.yml +++ b/.github/workflows/release_parallel.yml @@ -183,6 +183,14 @@ jobs: echo -n "$GPG_SIGNING_KEY" | base64 --decode | gpg --import git config --global user.signingkey C8B77BCBE16CD2B94B43F9C8757397B82D4ED7B0 + - name: Collect branches + id: collect-branches + run: | + BRANCHES=$(git branch -r | grep "origin/update-${{ needs.prepare-release.outputs.release-version }}-" | sed 's/origin\///') + echo "branches<> $GITHUB_OUTPUT + echo "$BRANCHES" >> $GITHUB_OUTPUT + echo "EOF" >> $GITHUB_OUTPUT + - name: Squash changes env: PAT: ${{ secrets.LASTMJS_GITHUB_TOKEN }} @@ -190,7 +198,7 @@ jobs: CURRENT_BRANCH=$(git branch --show-current) BASE_COMMIT=$(git rev-parse HEAD) - for branch in $(git branch -r | grep "origin/update-${{ needs.prepare-release.outputs.release-version }}-" | sed 's/origin\///'); do + while IFS= read -r branch; do echo "Cherry-picking changes from branch: $branch" git fetch origin $branch:$branch @@ -200,16 +208,26 @@ jobs: exit 1 } git commit -m "Squashed changes from $branch" || true - - # Delete the remote branch - git push origin --delete "$branch" - done + done <<< "${{ steps.collect-branches.outputs.branches }}" git reset --soft $BASE_COMMIT git commit -am "Update all dependencies for release ${{ needs.prepare-release.outputs.release-version }}" git push origin HEAD:$CURRENT_BRANCH + - name: Delete branches + run: | + # Convert newline-separated string to array + IFS=$'\n' read -r -d '' -a BRANCHES_TO_DELETE <<< "${{ steps.collect-branches.outputs.branches }}" + + # Delete branches in batches of 100 + BATCH_SIZE=100 + for ((i = 0; i < ${#BRANCHES_TO_DELETE[@]}; i += BATCH_SIZE)); do + BATCH=("${BRANCHES_TO_DELETE[@]:i:BATCH_SIZE}") + echo "Deleting batch of branches: ${BATCH[*]}" + git push origin --delete ${BATCH[@]} || echo "Failed to delete some branches in batch, continuing..." + done + - name: Create release run: | VERSION=${{ needs.prepare-release.outputs.release-version }} From 8fbf45fb540a82b07e50dc6e3e51c08111465074 Mon Sep 17 00:00:00 2001 From: Benjamin DeMann Date: Fri, 25 Oct 2024 15:43:28 -0600 Subject: [PATCH 50/59] batch fetching --- .github/workflows/release_parallel.yml | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/.github/workflows/release_parallel.yml b/.github/workflows/release_parallel.yml index 9ee7fc6b90..73baea6831 100644 --- a/.github/workflows/release_parallel.yml +++ b/.github/workflows/release_parallel.yml @@ -191,6 +191,13 @@ jobs: echo "$BRANCHES" >> $GITHUB_OUTPUT echo "EOF" >> $GITHUB_OUTPUT + - name: Fetch branches + run: | + echo "Fetching all branches..." + readarray -t BRANCH_ARRAY <<< "${{ steps.collect-branches.outputs.branches }}" + FETCH_REFS=$(printf "refs/remotes/origin/%s:refs/heads/%s " "${BRANCH_ARRAY[@]}" "${BRANCH_ARRAY[@]}") + git fetch origin $FETCH_REFS + - name: Squash changes env: PAT: ${{ secrets.LASTMJS_GITHUB_TOKEN }} @@ -198,10 +205,9 @@ jobs: CURRENT_BRANCH=$(git branch --show-current) BASE_COMMIT=$(git rev-parse HEAD) + # Process branches while IFS= read -r branch; do - echo "Cherry-picking changes from branch: $branch" - git fetch origin $branch:$branch - + echo "Merging changes from branch: $branch" git merge --squash "$branch" || { echo "Failed to merge $branch" git merge --abort From 0213570b8e49ee3b22a51dd6351316f8cb54b944 Mon Sep 17 00:00:00 2001 From: Benjamin DeMann Date: Fri, 25 Oct 2024 15:51:11 -0600 Subject: [PATCH 51/59] try that --- .github/workflows/release_parallel.yml | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release_parallel.yml b/.github/workflows/release_parallel.yml index 73baea6831..2ad06cb1cb 100644 --- a/.github/workflows/release_parallel.yml +++ b/.github/workflows/release_parallel.yml @@ -191,10 +191,32 @@ jobs: echo "$BRANCHES" >> $GITHUB_OUTPUT echo "EOF" >> $GITHUB_OUTPUT + - name: Display collected branches + run: | + echo "Collected branches:" + echo "${{ steps.collect-branches.outputs.branches }}" | while read branch; do + echo " - $branch" + done + echo "End of branch list" + - name: Fetch branches run: | echo "Fetching all branches..." - readarray -t BRANCH_ARRAY <<< "${{ steps.collect-branches.outputs.branches }}" + # Check if we have any branches to fetch + if [ -z "${{ steps.collect-branches.outputs.branches }}" ]; then + echo "No branches to fetch" + exit 0 + fi + + # Convert to array, filtering out empty lines + readarray -t BRANCH_ARRAY < <(echo "${{ steps.collect-branches.outputs.branches }}" | grep .) + + if [ ${#BRANCH_ARRAY[@]} -eq 0 ]; then + echo "No valid branches found" + exit 0 + fi + + echo "Found ${#BRANCH_ARRAY[@]} branches to fetch" FETCH_REFS=$(printf "refs/remotes/origin/%s:refs/heads/%s " "${BRANCH_ARRAY[@]}" "${BRANCH_ARRAY[@]}") git fetch origin $FETCH_REFS From 0d49b8174bdb33dd65668862575c406cf7bbf048 Mon Sep 17 00:00:00 2001 From: Benjamin DeMann Date: Fri, 25 Oct 2024 15:57:27 -0600 Subject: [PATCH 52/59] show fetch refs --- .github/workflows/release_parallel.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/release_parallel.yml b/.github/workflows/release_parallel.yml index 2ad06cb1cb..c84f271cc1 100644 --- a/.github/workflows/release_parallel.yml +++ b/.github/workflows/release_parallel.yml @@ -218,6 +218,7 @@ jobs: echo "Found ${#BRANCH_ARRAY[@]} branches to fetch" FETCH_REFS=$(printf "refs/remotes/origin/%s:refs/heads/%s " "${BRANCH_ARRAY[@]}" "${BRANCH_ARRAY[@]}") + echo "FETCH_REFS: $FETCH_REFS" git fetch origin $FETCH_REFS - name: Squash changes From 26bbf2b785329a9baf93ba37268c3efc7c8610df Mon Sep 17 00:00:00 2001 From: Benjamin DeMann Date: Fri, 25 Oct 2024 16:03:39 -0600 Subject: [PATCH 53/59] remove white space --- .github/workflows/release_parallel.yml | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/.github/workflows/release_parallel.yml b/.github/workflows/release_parallel.yml index c84f271cc1..02de4bc876 100644 --- a/.github/workflows/release_parallel.yml +++ b/.github/workflows/release_parallel.yml @@ -208,8 +208,8 @@ jobs: exit 0 fi - # Convert to array, filtering out empty lines - readarray -t BRANCH_ARRAY < <(echo "${{ steps.collect-branches.outputs.branches }}" | grep .) + # Convert to array, filtering out empty lines and trimming whitespace + readarray -t BRANCH_ARRAY < <(echo "${{ steps.collect-branches.outputs.branches }}" | grep . | xargs) if [ ${#BRANCH_ARRAY[@]} -eq 0 ]; then echo "No valid branches found" @@ -217,7 +217,12 @@ jobs: fi echo "Found ${#BRANCH_ARRAY[@]} branches to fetch" - FETCH_REFS=$(printf "refs/remotes/origin/%s:refs/heads/%s " "${BRANCH_ARRAY[@]}" "${BRANCH_ARRAY[@]}") + # Build fetch refs with proper formatting + FETCH_REFS="" + for branch in "${BRANCH_ARRAY[@]}"; do + FETCH_REFS+="refs/remotes/origin/${branch}:refs/heads/${branch} " + done + echo "FETCH_REFS: $FETCH_REFS" git fetch origin $FETCH_REFS From 82076307656439701304665ec127b20e487708fc Mon Sep 17 00:00:00 2001 From: Benjamin DeMann Date: Fri, 25 Oct 2024 16:26:46 -0600 Subject: [PATCH 54/59] I don't see how this would be different --- .github/workflows/release_parallel.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release_parallel.yml b/.github/workflows/release_parallel.yml index 02de4bc876..b079c32f34 100644 --- a/.github/workflows/release_parallel.yml +++ b/.github/workflows/release_parallel.yml @@ -220,11 +220,12 @@ jobs: # Build fetch refs with proper formatting FETCH_REFS="" for branch in "${BRANCH_ARRAY[@]}"; do - FETCH_REFS+="refs/remotes/origin/${branch}:refs/heads/${branch} " + # Each refspec should be "refs/remotes/origin/branch:refs/heads/branch" + FETCH_REFS+=" refs/remotes/origin/${branch}:refs/heads/${branch}" done echo "FETCH_REFS: $FETCH_REFS" - git fetch origin $FETCH_REFS + git fetch origin ${FETCH_REFS} - name: Squash changes env: From e74cee89a06a635fc6a06733f6a8c3fca3b79573 Mon Sep 17 00:00:00 2001 From: Benjamin DeMann Date: Fri, 25 Oct 2024 16:40:07 -0600 Subject: [PATCH 55/59] try that on for size --- .github/workflows/release_parallel.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release_parallel.yml b/.github/workflows/release_parallel.yml index b079c32f34..5f9969b7ea 100644 --- a/.github/workflows/release_parallel.yml +++ b/.github/workflows/release_parallel.yml @@ -186,7 +186,7 @@ jobs: - name: Collect branches id: collect-branches run: | - BRANCHES=$(git branch -r | grep "origin/update-${{ needs.prepare-release.outputs.release-version }}-" | sed 's/origin\///') + BRANCHES=$(git branch -r | grep "origin/update-${{ needs.prepare-release.outputs.release-version }}-" | sed 's/origin\///' | xargs -n1) echo "branches<> $GITHUB_OUTPUT echo "$BRANCHES" >> $GITHUB_OUTPUT echo "EOF" >> $GITHUB_OUTPUT @@ -209,7 +209,7 @@ jobs: fi # Convert to array, filtering out empty lines and trimming whitespace - readarray -t BRANCH_ARRAY < <(echo "${{ steps.collect-branches.outputs.branches }}" | grep . | xargs) + readarray -t BRANCH_ARRAY < <(echo "${{ steps.collect-branches.outputs.branches }}" | grep .) if [ ${#BRANCH_ARRAY[@]} -eq 0 ]; then echo "No valid branches found" From 386e5b63b21e23c876cf5f922b44c1511c322d2e Mon Sep 17 00:00:00 2001 From: Benjamin DeMann Date: Fri, 25 Oct 2024 16:49:01 -0600 Subject: [PATCH 56/59] remove the ref nonsense --- .github/workflows/release_parallel.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release_parallel.yml b/.github/workflows/release_parallel.yml index 5f9969b7ea..d6a9a041b8 100644 --- a/.github/workflows/release_parallel.yml +++ b/.github/workflows/release_parallel.yml @@ -221,7 +221,7 @@ jobs: FETCH_REFS="" for branch in "${BRANCH_ARRAY[@]}"; do # Each refspec should be "refs/remotes/origin/branch:refs/heads/branch" - FETCH_REFS+=" refs/remotes/origin/${branch}:refs/heads/${branch}" + FETCH_REFS+=" ${branch}:${branch}" done echo "FETCH_REFS: $FETCH_REFS" From 9e6ddf2bfeb9ba063aab6574fc968cb52955ef6a Mon Sep 17 00:00:00 2001 From: Benjamin DeMann Date: Fri, 25 Oct 2024 16:58:46 -0600 Subject: [PATCH 57/59] echo delete --- .github/workflows/release_parallel.yml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/.github/workflows/release_parallel.yml b/.github/workflows/release_parallel.yml index d6a9a041b8..100a9fe1ce 100644 --- a/.github/workflows/release_parallel.yml +++ b/.github/workflows/release_parallel.yml @@ -252,17 +252,31 @@ jobs: - name: Delete branches run: | + echo "Starting branch deletion process..." + echo "Raw branches input:" + echo "${{ steps.collect-branches.outputs.branches }}" + # Convert newline-separated string to array IFS=$'\n' read -r -d '' -a BRANCHES_TO_DELETE <<< "${{ steps.collect-branches.outputs.branches }}" + echo "Number of branches to delete: ${#BRANCHES_TO_DELETE[@]}" + echo "All branches to delete:" + printf '%s\n' "${BRANCHES_TO_DELETE[@]}" + # Delete branches in batches of 100 BATCH_SIZE=100 for ((i = 0; i < ${#BRANCHES_TO_DELETE[@]}; i += BATCH_SIZE)); do BATCH=("${BRANCHES_TO_DELETE[@]:i:BATCH_SIZE}") + echo "Processing batch starting at index $i" + echo "Batch size: ${#BATCH[@]}" + echo "Batch contents:" + printf '%s\n' "${BATCH[@]}" echo "Deleting batch of branches: ${BATCH[*]}" git push origin --delete ${BATCH[@]} || echo "Failed to delete some branches in batch, continuing..." done + echo "Branch deletion process complete" + - name: Create release run: | VERSION=${{ needs.prepare-release.outputs.release-version }} From 5c5b5c7b3cecec6e8143122d073ea9e57600e0d3 Mon Sep 17 00:00:00 2001 From: Benjamin DeMann Date: Fri, 25 Oct 2024 16:58:55 -0600 Subject: [PATCH 58/59] release--0.24.2-rc.79 --- dfx_extension/extension.json | 2 +- package-lock.json | 4 ++-- package.json | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/dfx_extension/extension.json b/dfx_extension/extension.json index 88e7a5fbe6..8c1bac15c8 100644 --- a/dfx_extension/extension.json +++ b/dfx_extension/extension.json @@ -1,6 +1,6 @@ { "name": "azle", - "version": "0.24.1", + "version": "0.24.2-rc.79", "homepage": "https://github.com/dfinity/dfx-extensions", "authors": "", "summary": "", diff --git a/package-lock.json b/package-lock.json index de86c9c76d..9f0f87682e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "azle", - "version": "0.25.0", + "version": "0.24.2-rc.79", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "azle", - "version": "0.25.0", + "version": "0.24.2-rc.79", "hasInstallScript": true, "license": "MIT", "dependencies": { diff --git a/package.json b/package.json index c7675cedef..c592714a99 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "azle", - "version": "0.25.0", + "version": "0.24.2-rc.79", "description": "TypeScript and JavaScript CDK for the Internet Computer", "scripts": { "typecheck": "tsc --noEmit", From 7b9a9304d4ace4460e6e0e373e4ddcff8b554a57 Mon Sep 17 00:00:00 2001 From: Jordan Last Date: Fri, 25 Oct 2024 23:04:13 +0000 Subject: [PATCH 59/59] Update all dependencies for release 0.24.2-rc.79 --- examples/hello_world/benchmarks.json | 15 ++++++++++++ examples/hello_world/benchmarks.md | 24 +++++++++++++++++++ examples/hello_world/package-lock.json | 9 ++++--- examples/hello_world/package.json | 2 +- .../hello_world_http_server/package-lock.json | 15 ++++++------ examples/hello_world_http_server/package.json | 2 +- 6 files changed, 52 insertions(+), 15 deletions(-) create mode 100644 examples/hello_world/benchmarks.json create mode 100644 examples/hello_world/benchmarks.md diff --git a/examples/hello_world/benchmarks.json b/examples/hello_world/benchmarks.json new file mode 100644 index 0000000000..e3398982cb --- /dev/null +++ b/examples/hello_world/benchmarks.json @@ -0,0 +1,15 @@ +{ + "hello_world": { + "previous": { "version": "0.24.2-rc.79", "benchmarks": [] }, + "current": { + "version": "0.24.2-rc.79", + "benchmarks": [ + { + "instructions": { "__bigint__": "1297524" }, + "method_name": "setMessage", + "timestamp": { "__bigint__": "1729897421950324679" } + } + ] + } + } +} diff --git a/examples/hello_world/benchmarks.md b/examples/hello_world/benchmarks.md new file mode 100644 index 0000000000..a189cd7f38 --- /dev/null +++ b/examples/hello_world/benchmarks.md @@ -0,0 +1,24 @@ +# Benchmarks for hello_world + +## Current benchmarks Azle version: 0.24.2-rc.79 + +| Id | Method Name | Instructions | Cycles | USD | USD/Million Calls | +| --- | ----------- | ------------ | --------- | ------------- | ----------------- | +| 0 | setMessage | 1_297_524 | 1_109_009 | $0.0000014746 | $1.47 | + +## Baseline benchmarks Azle version: 0.24.2-rc.79 + +No benchmarks reported + +--- + +**Note on calculations:** + +- Cycles are calculated using the formula: base_fee + (per_instruction_fee \* number_of_instructions) + (additional_fee_per_billion \* floor(number_of_instructions / 1_000_000_000)) +- base_fee: 590_000 cycles +- per_instruction_fee: 0.4 cycles +- additional_fee_per_billion: 400_000_000 cycles per billion instructions +- USD value is derived from the total cycles, where 1 trillion cycles = 1 XDR, and 1 XDR = $1.329670 (as of October 24, 2024) + +For the most up-to-date XDR to USD conversion rate, please refer to the [IMF website](https://www.imf.org/external/np/fin/data/rms_sdrv.aspx). +For the most current fee information, please check the [official documentation](https://internetcomputer.org/docs/current/developer-docs/gas-cost#execution). diff --git a/examples/hello_world/package-lock.json b/examples/hello_world/package-lock.json index e5d8539dac..1cb0cf80e4 100644 --- a/examples/hello_world/package-lock.json +++ b/examples/hello_world/package-lock.json @@ -5,7 +5,7 @@ "packages": { "": { "dependencies": { - "azle": "0.24.1" + "azle": "0.24.2-rc.79" }, "devDependencies": { "jest": "^29.7.0", @@ -1799,11 +1799,10 @@ "dev": true }, "node_modules/azle": { - "version": "0.24.1", - "resolved": "https://registry.npmjs.org/azle/-/azle-0.24.1.tgz", - "integrity": "sha512-k7E3TyKSdIH25fbLP8ix4kwJtKHQH9ooPtATyPCTWkGyRMs2RedyEimfcEjznPgYvciS4AcNwyWJUwx0jKpKsw==", + "version": "0.24.2-rc.79", + "resolved": "https://registry.npmjs.org/azle/-/azle-0.24.2-rc.79.tgz", + "integrity": "sha512-fScK5q1EW7QgFIdq9uLAIl+uUN2rK2BeMDsZVsE7uJUiFvwt/Ca0EtLnVUti3OZG4dUQvT1LgJSHrg9VGM8Y1Q==", "hasInstallScript": true, - "license": "MIT", "dependencies": { "@dfinity/agent": "^1.1.0", "@dfinity/identity-secp256k1": "^1.1.0", diff --git a/examples/hello_world/package.json b/examples/hello_world/package.json index 68c9541149..6d16790466 100644 --- a/examples/hello_world/package.json +++ b/examples/hello_world/package.json @@ -4,7 +4,7 @@ "test": "jest" }, "dependencies": { - "azle": "0.24.1" + "azle": "0.24.2-rc.79" }, "devDependencies": { "jest": "^29.7.0", diff --git a/examples/hello_world_http_server/package-lock.json b/examples/hello_world_http_server/package-lock.json index 91fe11ca5f..2674c6a356 100644 --- a/examples/hello_world_http_server/package-lock.json +++ b/examples/hello_world_http_server/package-lock.json @@ -5,7 +5,7 @@ "packages": { "": { "dependencies": { - "azle": "0.24.1", + "azle": "0.24.2-rc.79", "express": "^4.18.2", "lit": "^3.1.2" }, @@ -2447,11 +2447,10 @@ } }, "node_modules/azle": { - "version": "0.24.1", - "resolved": "https://registry.npmjs.org/azle/-/azle-0.24.1.tgz", - "integrity": "sha512-k7E3TyKSdIH25fbLP8ix4kwJtKHQH9ooPtATyPCTWkGyRMs2RedyEimfcEjznPgYvciS4AcNwyWJUwx0jKpKsw==", + "version": "0.24.2-rc.79", + "resolved": "https://registry.npmjs.org/azle/-/azle-0.24.2-rc.79.tgz", + "integrity": "sha512-fScK5q1EW7QgFIdq9uLAIl+uUN2rK2BeMDsZVsE7uJUiFvwt/Ca0EtLnVUti3OZG4dUQvT1LgJSHrg9VGM8Y1Q==", "hasInstallScript": true, - "license": "MIT", "dependencies": { "@dfinity/agent": "^1.1.0", "@dfinity/identity-secp256k1": "^1.1.0", @@ -9590,9 +9589,9 @@ } }, "azle": { - "version": "0.24.1", - "resolved": "https://registry.npmjs.org/azle/-/azle-0.24.1.tgz", - "integrity": "sha512-k7E3TyKSdIH25fbLP8ix4kwJtKHQH9ooPtATyPCTWkGyRMs2RedyEimfcEjznPgYvciS4AcNwyWJUwx0jKpKsw==", + "version": "0.24.2-rc.79", + "resolved": "https://registry.npmjs.org/azle/-/azle-0.24.2-rc.79.tgz", + "integrity": "sha512-fScK5q1EW7QgFIdq9uLAIl+uUN2rK2BeMDsZVsE7uJUiFvwt/Ca0EtLnVUti3OZG4dUQvT1LgJSHrg9VGM8Y1Q==", "requires": { "@dfinity/agent": "^1.1.0", "@dfinity/identity-secp256k1": "^1.1.0", diff --git a/examples/hello_world_http_server/package.json b/examples/hello_world_http_server/package.json index b40d113f6d..8be336f713 100644 --- a/examples/hello_world_http_server/package.json +++ b/examples/hello_world_http_server/package.json @@ -5,7 +5,7 @@ "test": "jest" }, "dependencies": { - "azle": "0.24.1", + "azle": "0.24.2-rc.79", "express": "^4.18.2", "lit": "^3.1.2" },