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 d24b4669cffbcd14e5d5f4cae20a888df89ca27d Mon Sep 17 00:00:00 2001 From: Benjamin DeMann Date: Fri, 25 Oct 2024 12:20:17 -0600 Subject: [PATCH 39/59] clean up fetching workflow --- .github/actions/get_test_infos/action.yml | 6 +++++ .github/workflows/release.yml | 28 +++-------------------- .github/workflows/release_parallel.yml | 23 ++++++++++++++----- 3 files changed, 26 insertions(+), 31 deletions(-) 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 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 }} diff --git a/.github/workflows/release_parallel.yml b/.github/workflows/release_parallel.yml index 1af6e66586..20671d7b1f 100644 --- a/.github/workflows/release_parallel.yml +++ b/.github/workflows/release_parallel.yml @@ -88,6 +88,17 @@ jobs: directories: | ./examples ./tests + exclude-dirs: | + ${{ format(' + examples/basic_bitcoin + examples/bitcoin_psbt + examples/ckbtc + tests/end_to_end/http_server + 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 + ') }} update-test-files-for-release-commit: needs: prepare-release @@ -162,10 +173,9 @@ 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: - 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' @@ -173,11 +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) - 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" git fetch origin $branch:$branch @@ -193,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 8980ae1f445c80ac22a6d6a5ca87aeaf7e6186fb Mon Sep 17 00:00:00 2001 From: Benjamin DeMann Date: Fri, 25 Oct 2024 15:41:03 -0600 Subject: [PATCH 40/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 406b86914d0b87a471ee11b06c4e3545fc0fda24 Mon Sep 17 00:00:00 2001 From: Benjamin DeMann Date: Fri, 25 Oct 2024 15:43:28 -0600 Subject: [PATCH 41/59] batch fetching --- .github/workflows/release_parallel.yml | 43 +++++++++++++++++++++++--- 1 file changed, 39 insertions(+), 4 deletions(-) diff --git a/.github/workflows/release_parallel.yml b/.github/workflows/release_parallel.yml index 9ee7fc6b90..d6a9a041b8 100644 --- a/.github/workflows/release_parallel.yml +++ b/.github/workflows/release_parallel.yml @@ -186,11 +186,47 @@ 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 + - 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..." + # 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 and trimming whitespace + 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" + # Build fetch refs with proper formatting + FETCH_REFS="" + for branch in "${BRANCH_ARRAY[@]}"; do + # Each refspec should be "refs/remotes/origin/branch:refs/heads/branch" + FETCH_REFS+=" ${branch}:${branch}" + done + + echo "FETCH_REFS: $FETCH_REFS" + git fetch origin ${FETCH_REFS} + - name: Squash changes env: PAT: ${{ secrets.LASTMJS_GITHUB_TOKEN }} @@ -198,10 +234,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 554951886f17b612ea7df5c640692ffb0292d41d Mon Sep 17 00:00:00 2001 From: Benjamin DeMann Date: Fri, 25 Oct 2024 16:58:46 -0600 Subject: [PATCH 42/59] make delete like fetch --- .github/workflows/release_parallel.yml | 32 ++++++++++++++++++-------- 1 file changed, 23 insertions(+), 9 deletions(-) diff --git a/.github/workflows/release_parallel.yml b/.github/workflows/release_parallel.yml index d6a9a041b8..a838a0447f 100644 --- a/.github/workflows/release_parallel.yml +++ b/.github/workflows/release_parallel.yml @@ -252,17 +252,31 @@ jobs: - 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..." + echo "Deleting all branches..." + # Check if we have any branches to fetch + if [ -z "${{ steps.collect-branches.outputs.branches }}" ]; then + echo "No branches to delete" + exit 0 + fi + + # Convert to array, filtering out empty lines and trimming whitespace + 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 delete" + # Build fetch refs with proper formatting + BRANCHES_TO_DELETE="" + for branch in "${BRANCH_ARRAY[@]}"; do + BRANCHES_TO_DELETE+=" ${branch}" done + echo "BRANCHES_TO_DELETE: $BRANCHES_TO_DELETE" + git push origin --delete ${BRANCHES_TO_DELETE} + - name: Create release run: | VERSION=${{ needs.prepare-release.outputs.release-version }} From b7787065efb93ab0f1d607f0130cc60fee646d9e Mon Sep 17 00:00:00 2001 From: Benjamin DeMann Date: Mon, 28 Oct 2024 09:24:04 -0600 Subject: [PATCH 43/59] simplification --- .github/workflows/release_parallel.yml | 64 +++++++++++--------------- 1 file changed, 28 insertions(+), 36 deletions(-) diff --git a/.github/workflows/release_parallel.yml b/.github/workflows/release_parallel.yml index a838a0447f..217f7285a8 100644 --- a/.github/workflows/release_parallel.yml +++ b/.github/workflows/release_parallel.yml @@ -186,10 +186,14 @@ jobs: - name: Collect branches id: collect-branches run: | - 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 + # Create array of branches + readarray -t BRANCH_ARRAY < <(git branch -r | grep "origin/update-${{ needs.prepare-release.outputs.release-version }}-" | sed 's/origin\///' | xargs -n1) + + # Convert array to string with specific delimiter (e.g., comma) + BRANCHES=$(IFS=,; echo "${BRANCH_ARRAY[*]}") + + echo "branches=$BRANCHES" >> $GITHUB_OUTPUT + echo "count=${#BRANCH_ARRAY[@]}" >> $GITHUB_OUTPUT - name: Display collected branches run: | @@ -202,25 +206,17 @@ jobs: - name: Fetch branches run: | echo "Fetching all branches..." - # Check if we have any branches to fetch - if [ -z "${{ steps.collect-branches.outputs.branches }}" ]; then + if [ "${{ steps.collect-branches.outputs.count }}" -eq 0 ]; then echo "No branches to fetch" exit 0 fi - # Convert to array, filtering out empty lines and trimming whitespace - 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 + # Convert comma-separated string back to array + IFS=',' read -ra BRANCHES <<< "${{ steps.collect-branches.outputs.branches }}" - echo "Found ${#BRANCH_ARRAY[@]} branches to fetch" - # Build fetch refs with proper formatting + echo "Found ${#BRANCHES[@]} branches to fetch" FETCH_REFS="" - for branch in "${BRANCH_ARRAY[@]}"; do - # Each refspec should be "refs/remotes/origin/branch:refs/heads/branch" + for branch in "${BRANCHES[@]}"; do FETCH_REFS+=" ${branch}:${branch}" done @@ -234,8 +230,11 @@ jobs: CURRENT_BRANCH=$(git branch --show-current) BASE_COMMIT=$(git rev-parse HEAD) + # Convert comma-separated string back to array + IFS=',' read -ra BRANCHES <<< "${{ steps.collect-branches.outputs.branches }}" + # Process branches - while IFS= read -r branch; do + for branch in "${BRANCHES[@]}"; do echo "Merging changes from branch: $branch" git merge --squash "$branch" || { echo "Failed to merge $branch" @@ -243,7 +242,7 @@ jobs: exit 1 } git commit -m "Squashed changes from $branch" || true - done <<< "${{ steps.collect-branches.outputs.branches }}" + done git reset --soft $BASE_COMMIT git commit -am "Update all dependencies for release ${{ needs.prepare-release.outputs.release-version }}" @@ -252,30 +251,23 @@ jobs: - name: Delete branches run: | - echo "Deleting all branches..." - # Check if we have any branches to fetch - if [ -z "${{ steps.collect-branches.outputs.branches }}" ]; then + echo "Starting branch deletion process..." + if [ "${{ steps.collect-branches.outputs.count }}" -eq 0 ]; then echo "No branches to delete" exit 0 fi - # Convert to array, filtering out empty lines and trimming whitespace - 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 + # Convert comma-separated string back to array + IFS=',' read -ra BRANCHES <<< "${{ steps.collect-branches.outputs.branches }}" - echo "Found ${#BRANCH_ARRAY[@]} branches to delete" - # Build fetch refs with proper formatting - BRANCHES_TO_DELETE="" - for branch in "${BRANCH_ARRAY[@]}"; do - BRANCHES_TO_DELETE+=" ${branch}" + echo "Found ${#BRANCHES[@]} branches to delete" + DELETE_REFS="" + for branch in "${BRANCHES[@]}"; do + DELETE_REFS+=" ${branch}" done - echo "BRANCHES_TO_DELETE: $BRANCHES_TO_DELETE" - git push origin --delete ${BRANCHES_TO_DELETE} + echo "DELETE_REFS: $DELETE_REFS" + git push origin --delete ${DELETE_REFS} - name: Create release run: | From aa3beb1356f327962f932581cd49f33bd817341e Mon Sep 17 00:00:00 2001 From: Benjamin DeMann Date: Mon, 28 Oct 2024 09:46:15 -0600 Subject: [PATCH 44/59] better display --- .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 217f7285a8..45ba5369bd 100644 --- a/.github/workflows/release_parallel.yml +++ b/.github/workflows/release_parallel.yml @@ -198,7 +198,9 @@ jobs: - name: Display collected branches run: | echo "Collected branches:" - echo "${{ steps.collect-branches.outputs.branches }}" | while read branch; do + # Convert comma-separated string back to array and display each branch + IFS=',' read -ra BRANCHES <<< "${{ steps.collect-branches.outputs.branches }}" + for branch in "${BRANCHES[@]}"; do echo " - $branch" done echo "End of branch list" From a5c85b2271e1c9aa6af8477e82c3753fc174cabd Mon Sep 17 00:00:00 2001 From: Benjamin DeMann Date: Mon, 28 Oct 2024 10:00:17 -0600 Subject: [PATCH 45/59] switch to while read to --- .github/workflows/release_parallel.yml | 48 ++++++++++---------------- 1 file changed, 18 insertions(+), 30 deletions(-) diff --git a/.github/workflows/release_parallel.yml b/.github/workflows/release_parallel.yml index 45ba5369bd..340d065dcc 100644 --- a/.github/workflows/release_parallel.yml +++ b/.github/workflows/release_parallel.yml @@ -189,18 +189,18 @@ jobs: # Create array of branches readarray -t BRANCH_ARRAY < <(git branch -r | grep "origin/update-${{ needs.prepare-release.outputs.release-version }}-" | sed 's/origin\///' | xargs -n1) - # Convert array to string with specific delimiter (e.g., comma) - BRANCHES=$(IFS=,; echo "${BRANCH_ARRAY[*]}") - - echo "branches=$BRANCHES" >> $GITHUB_OUTPUT + # Output array count echo "count=${#BRANCH_ARRAY[@]}" >> $GITHUB_OUTPUT + # Output array elements as multiline value + echo "branches<> $GITHUB_OUTPUT + printf '%s\n' "${BRANCH_ARRAY[@]}" >> $GITHUB_OUTPUT + echo "EOF" >> $GITHUB_OUTPUT + - name: Display collected branches run: | echo "Collected branches:" - # Convert comma-separated string back to array and display each branch - IFS=',' read -ra BRANCHES <<< "${{ steps.collect-branches.outputs.branches }}" - for branch in "${BRANCHES[@]}"; do + echo "${{ steps.collect-branches.outputs.branches }}" | while read branch; do echo " - $branch" done echo "End of branch list" @@ -213,17 +213,13 @@ jobs: exit 0 fi - # Convert comma-separated string back to array - IFS=',' read -ra BRANCHES <<< "${{ steps.collect-branches.outputs.branches }}" - - echo "Found ${#BRANCHES[@]} branches to fetch" - FETCH_REFS="" - for branch in "${BRANCHES[@]}"; do - FETCH_REFS+=" ${branch}:${branch}" + BRANCHES_TO_FETCH="" + echo "${{ steps.collect-branches.outputs.branches }}" | while read branch; do + BRANCHES_TO_FETCH+=" ${branch}:${branch}" done - echo "FETCH_REFS: $FETCH_REFS" - git fetch origin ${FETCH_REFS} + echo "BRANCHES_TO_FETCH: $BRANCHES_TO_FETCH" + git fetch origin ${BRANCHES_TO_FETCH} - name: Squash changes env: @@ -232,11 +228,7 @@ jobs: CURRENT_BRANCH=$(git branch --show-current) BASE_COMMIT=$(git rev-parse HEAD) - # Convert comma-separated string back to array - IFS=',' read -ra BRANCHES <<< "${{ steps.collect-branches.outputs.branches }}" - - # Process branches - for branch in "${BRANCHES[@]}"; do + echo "${{ steps.collect-branches.outputs.branches }}" | while read branch; do echo "Merging changes from branch: $branch" git merge --squash "$branch" || { echo "Failed to merge $branch" @@ -259,17 +251,13 @@ jobs: exit 0 fi - # Convert comma-separated string back to array - IFS=',' read -ra BRANCHES <<< "${{ steps.collect-branches.outputs.branches }}" - - echo "Found ${#BRANCHES[@]} branches to delete" - DELETE_REFS="" - for branch in "${BRANCHES[@]}"; do - DELETE_REFS+=" ${branch}" + BRANCHES_TO_DELETE="" + echo "${{ steps.collect-branches.outputs.branches }}" | while read branch; do + BRANCHES_TO_DELETE+=" ${branch}" done - echo "DELETE_REFS: $DELETE_REFS" - git push origin --delete ${DELETE_REFS} + echo "BRANCHES_TO_DELETE: $BRANCHES_TO_DELETE" + git push origin --delete ${BRANCHES_TO_DELETE} - name: Create release run: | From c744d2683e68140bf9541220cf7a0e37baab85dd Mon Sep 17 00:00:00 2001 From: Benjamin DeMann Date: Mon, 28 Oct 2024 10:14:50 -0600 Subject: [PATCH 46/59] clean up counts and expand run --- .github/workflows/release_parallel.yml | 51 +++++++++++++------------- 1 file changed, 26 insertions(+), 25 deletions(-) diff --git a/.github/workflows/release_parallel.yml b/.github/workflows/release_parallel.yml index 340d065dcc..659dbab14b 100644 --- a/.github/workflows/release_parallel.yml +++ b/.github/workflows/release_parallel.yml @@ -70,9 +70,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 - ## TODO bring these back after we are done testing - # AZLE_VERBOSE=true npx azle template - # AZLE_VERBOSE=true npx azle template --experimental + AZLE_VERBOSE=true npx azle template + AZLE_VERBOSE=true npx azle template --experimental - name: Publish to npm run: | @@ -90,15 +89,30 @@ jobs: ./tests exclude-dirs: | ${{ format(' - examples/basic_bitcoin - examples/bitcoin_psbt - examples/ckbtc - tests/end_to_end/http_server - 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 - ') }} + tests/end_to_end/candid_rpc/class_syntax/new + tests/end_to_end/http_server/new + examples/basic_bitcoin + examples/bitcoin_psbt + examples/ckbtc + tests/end_to_end/http_server/ethers_base + tests/end_to_end/http_server/http_outcall_fetch + tests/end_to_end/http_server/ic_evm_rpc + tests/property/candid_rpc/class_api/stable_b_tree_map + tests/property/candid_rpc/functional_api/stable_b_tree_map + tests/property/ic_api/performance_counter + tests/property/ic_api/instruction_counter + tests/end_to_end/candid_rpc/functional_syntax/ckbtc + tests/end_to_end/candid_rpc/class_syntax/bitcoin + tests/end_to_end/http_server/large_files + tests/end_to_end/http_server/open_value_sharing + tests/end_to_end/candid_rpc/class_syntax/stable_structures + tests/end_to_end/candid_rpc/functional_syntax/bitcoin + tests/end_to_end/candid_rpc/functional_syntax/composite_queries + tests/end_to_end/candid_rpc/functional_syntax/cross_canister_calls + tests/end_to_end/candid_rpc/functional_syntax/management_canister + tests/end_to_end/candid_rpc/functional_syntax/stable_structures + tests/end_to_end/http_server/autoreload + ') }} update-test-files-for-release-commit: needs: prepare-release @@ -189,9 +203,6 @@ jobs: # Create array of branches readarray -t BRANCH_ARRAY < <(git branch -r | grep "origin/update-${{ needs.prepare-release.outputs.release-version }}-" | sed 's/origin\///' | xargs -n1) - # Output array count - echo "count=${#BRANCH_ARRAY[@]}" >> $GITHUB_OUTPUT - # Output array elements as multiline value echo "branches<> $GITHUB_OUTPUT printf '%s\n' "${BRANCH_ARRAY[@]}" >> $GITHUB_OUTPUT @@ -208,11 +219,6 @@ jobs: - name: Fetch branches run: | echo "Fetching all branches..." - if [ "${{ steps.collect-branches.outputs.count }}" -eq 0 ]; then - echo "No branches to fetch" - exit 0 - fi - BRANCHES_TO_FETCH="" echo "${{ steps.collect-branches.outputs.branches }}" | while read branch; do BRANCHES_TO_FETCH+=" ${branch}:${branch}" @@ -246,11 +252,6 @@ jobs: - name: Delete branches run: | echo "Starting branch deletion process..." - if [ "${{ steps.collect-branches.outputs.count }}" -eq 0 ]; then - echo "No branches to delete" - exit 0 - fi - BRANCHES_TO_DELETE="" echo "${{ steps.collect-branches.outputs.branches }}" | while read branch; do BRANCHES_TO_DELETE+=" ${branch}" From 68cf4a26b9e408aee6f969d81181217f3dab75ac Mon Sep 17 00:00:00 2001 From: Benjamin DeMann Date: Mon, 28 Oct 2024 11:25:26 -0600 Subject: [PATCH 47/59] don't use pipe so that the subshell won't eat the output --- .github/workflows/release_parallel.yml | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/.github/workflows/release_parallel.yml b/.github/workflows/release_parallel.yml index 659dbab14b..7d4aab1c38 100644 --- a/.github/workflows/release_parallel.yml +++ b/.github/workflows/release_parallel.yml @@ -219,10 +219,11 @@ jobs: - name: Fetch branches run: | echo "Fetching all branches..." + # Use process substitution instead of pipe to avoid subshell BRANCHES_TO_FETCH="" - echo "${{ steps.collect-branches.outputs.branches }}" | while read branch; do + while read branch; do BRANCHES_TO_FETCH+=" ${branch}:${branch}" - done + done < <(echo "${{ steps.collect-branches.outputs.branches }}") echo "BRANCHES_TO_FETCH: $BRANCHES_TO_FETCH" git fetch origin ${BRANCHES_TO_FETCH} @@ -234,7 +235,7 @@ jobs: CURRENT_BRANCH=$(git branch --show-current) BASE_COMMIT=$(git rev-parse HEAD) - echo "${{ steps.collect-branches.outputs.branches }}" | while read branch; do + while read branch; do echo "Merging changes from branch: $branch" git merge --squash "$branch" || { echo "Failed to merge $branch" @@ -242,7 +243,7 @@ jobs: exit 1 } git commit -m "Squashed changes from $branch" || true - done + done < <(echo "${{ steps.collect-branches.outputs.branches }}") git reset --soft $BASE_COMMIT git commit -am "Update all dependencies for release ${{ needs.prepare-release.outputs.release-version }}" @@ -253,9 +254,9 @@ jobs: run: | echo "Starting branch deletion process..." BRANCHES_TO_DELETE="" - echo "${{ steps.collect-branches.outputs.branches }}" | while read branch; do + while read branch; do BRANCHES_TO_DELETE+=" ${branch}" - done + done < <(echo "${{ steps.collect-branches.outputs.branches }}") echo "BRANCHES_TO_DELETE: $BRANCHES_TO_DELETE" git push origin --delete ${BRANCHES_TO_DELETE} From 37fcbcf77ac1a02373699a1c1e96468855f4098b Mon Sep 17 00:00:00 2001 From: Benjamin DeMann Date: Mon, 28 Oct 2024 12:04:17 -0600 Subject: [PATCH 48/59] create configure git action --- .github/actions/configure_git/README.md | 21 ++++++++++++++++ .github/actions/configure_git/action.yml | 18 ++++++++++++++ .github/workflows/release_parallel.yml | 31 ++++++++---------------- 3 files changed, 49 insertions(+), 21 deletions(-) create mode 100644 .github/actions/configure_git/README.md create mode 100644 .github/actions/configure_git/action.yml diff --git a/.github/actions/configure_git/README.md b/.github/actions/configure_git/README.md new file mode 100644 index 0000000000..19d3e8aea9 --- /dev/null +++ b/.github/actions/configure_git/README.md @@ -0,0 +1,21 @@ +## Prerequisite + +This action assumes that the repository has already been checked out before +calling the action, typically using `actions/checkout@v4`. If you have not +checked out the code in a previous step, make sure to do so to avoid errors. + +This action does **not** perform a checkout action itself because it would be +redundant. This action is part of the repository's codebase, so if the code +hasn't already been checked out, the action itself wouldn't even be available to +call. + +## Example Usage + +```yaml +steps: + - uses: actions/checkout@v4 + + - uses: ./.github/actions/configure_git + with: + gpg_signing_key: ${{ secrets.GPG_SIGNING_KEY }} +``` diff --git a/.github/actions/configure_git/action.yml b/.github/actions/configure_git/action.yml new file mode 100644 index 0000000000..6f18cb7a71 --- /dev/null +++ b/.github/actions/configure_git/action.yml @@ -0,0 +1,18 @@ +name: Configure Git +description: 'Configures git with user info and GPG signing' +inputs: + gpg_signing_key: + description: 'The GPG signing key to use for signing commits' + required: true +runs: + using: composite + steps: + - name: Configure git + run: | + # TODO we should use some Action-specific bot account + 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 "${{ inputs.gpg_signing_key }}" | base64 --decode | gpg --import + git config --global user.signingkey C8B77BCBE16CD2B94B43F9C8757397B82D4ED7B0 + shell: bash diff --git a/.github/workflows/release_parallel.yml b/.github/workflows/release_parallel.yml index 7d4aab1c38..497f03aa9c 100644 --- a/.github/workflows/release_parallel.yml +++ b/.github/workflows/release_parallel.yml @@ -55,14 +55,9 @@ jobs: 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 + - uses: ./.github/actions/configure_git + with: + gpg_signing_key: ${{ secrets.GPG_SIGNING_KEY }} - name: Update version and build templates run: | @@ -157,14 +152,12 @@ jobs: continue-on-error: true run: npm test - # TODO we should use some Action-specific bot account + - uses: ./.github/actions/configure_git + with: + gpg_signing_key: ${{ secrets.GPG_SIGNING_KEY }} + - name: Commit and push changes 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 BRANCH_NAME="update-${{ needs.prepare-release.outputs.release-version }}-$(echo '${{ matrix.test.displayPath }}' | sed 's/\//-/g')" git switch -c "$BRANCH_NAME" git add --all @@ -189,13 +182,9 @@ jobs: token: ${{ secrets.LASTMJS_GITHUB_TOKEN }} fetch-depth: 0 - - name: Configure git - 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 + - uses: ./.github/actions/configure_git + with: + gpg_signing_key: ${{ secrets.GPG_SIGNING_KEY }} - name: Collect branches id: collect-branches From 7a3585ed59d6ae5d5d6df130f357936512bc3281 Mon Sep 17 00:00:00 2001 From: Benjamin DeMann Date: Mon, 28 Oct 2024 12:04:25 -0600 Subject: [PATCH 49/59] remove install curl --- .github/workflows/release_parallel.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/release_parallel.yml b/.github/workflows/release_parallel.yml index 497f03aa9c..30a065c7ab 100644 --- a/.github/workflows/release_parallel.yml +++ b/.github/workflows/release_parallel.yml @@ -43,9 +43,6 @@ jobs: env: NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} - - name: Install curl - run: sudo apt-get install curl -y - - name: Setup dfx uses: ./.github/actions/setup_dfx From d1bf02253b031c8c980df5102edb554e940b4ca3 Mon Sep 17 00:00:00 2001 From: Benjamin DeMann Date: Mon, 28 Oct 2024 12:13:59 -0600 Subject: [PATCH 50/59] create setup-node action --- .github/actions/get_node_version/action.yml | 14 ------ .github/actions/get_test_infos/action.yml | 7 +-- .../README.md | 5 +-- .github/actions/setup-node/action.yml | 43 +++++++++++++++++++ .github/workflows/release_parallel.yml | 16 ++----- .github/workflows/run_test.yml | 7 +-- 6 files changed, 50 insertions(+), 42 deletions(-) delete mode 100644 .github/actions/get_node_version/action.yml rename .github/actions/{get_node_version => setup-node}/README.md (83%) create mode 100644 .github/actions/setup-node/action.yml diff --git a/.github/actions/get_node_version/action.yml b/.github/actions/get_node_version/action.yml deleted file mode 100644 index b97e3d32e0..0000000000 --- a/.github/actions/get_node_version/action.yml +++ /dev/null @@ -1,14 +0,0 @@ -name: Get node version -description: Determines Azle's node version -outputs: - node-version: - description: Returns the version of node that Azle will test against and use to generate its Wasm binary templates - value: ${{ steps.get-node-version.outputs.node-version }} -runs: - using: composite - steps: - - id: get-node-version - run: | - NODE_VERSION=$(jq -r '.azle.globalDependencies.node // error("node version not found")' "package.json") - echo "node-version=${NODE_VERSION}" >> "$GITHUB_OUTPUT" - shell: bash diff --git a/.github/actions/get_test_infos/action.yml b/.github/actions/get_test_infos/action.yml index b06f1dfc12..b2fe19158a 100644 --- a/.github/actions/get_test_infos/action.yml +++ b/.github/actions/get_test_infos/action.yml @@ -23,12 +23,7 @@ outputs: runs: using: composite steps: - - 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 }} + - uses: ./.github/actions/setup-node - name: Get test infos id: get-test-infos diff --git a/.github/actions/get_node_version/README.md b/.github/actions/setup-node/README.md similarity index 83% rename from .github/actions/get_node_version/README.md rename to .github/actions/setup-node/README.md index 478190d010..9c5219de3f 100644 --- a/.github/actions/get_node_version/README.md +++ b/.github/actions/setup-node/README.md @@ -17,8 +17,7 @@ checking out a specific branch. steps: - uses: actions/checkout@v4 - - id: get-node-version - uses: ./.github/actions/get_node_version + - uses: ./.github/actions/setup-node - - run: echo "${{ steps.get-node-version.outputs.node-version }}" + - run: echo "${{ steps.setup-node.outputs.version }}" ``` diff --git a/.github/actions/setup-node/action.yml b/.github/actions/setup-node/action.yml new file mode 100644 index 0000000000..1196c6da9b --- /dev/null +++ b/.github/actions/setup-node/action.yml @@ -0,0 +1,43 @@ +name: 'Setup Node.js' +description: 'Sets up Node.js environment and gets Node version from package.json' +inputs: + working-directory: + description: 'Directory containing package.json' + required: false + default: '.' + registry-url: + description: 'Optional registry URL' + required: false + node-version-file: + description: 'File containing the version Spec' + required: false + default: 'package.json' + cache: + description: 'Used to specify a package manager for caching' + required: false + cache-dependency-path: + description: 'Path to package-lock.json file' + required: false + +outputs: + node-version: + description: 'The Node.js version from package.json' + value: ${{ steps.get-version.outputs.version }} + +runs: + using: 'composite' + steps: + - id: get-version + shell: bash + working-directory: ${{ inputs.working-directory }} + run: | + VERSION=$(jq -r '.azle.globalDependencies.node // error("node version not found")' "package.json") + echo "version=$VERSION" >> $GITHUB_OUTPUT + + - uses: actions/setup-node@v4 + with: + node-version: ${{ steps.get-version.outputs.version }} + registry-url: ${{ inputs.registry-url }} + node-version-file: ${{ inputs.node-version-file }} + cache: ${{ inputs.cache }} + cache-dependency-path: ${{ inputs.cache-dependency-path }} diff --git a/.github/workflows/release_parallel.yml b/.github/workflows/release_parallel.yml index 30a065c7ab..64ef1e7ccf 100644 --- a/.github/workflows/release_parallel.yml +++ b/.github/workflows/release_parallel.yml @@ -33,12 +33,8 @@ jobs: 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 + - uses: ./.github/actions/setup-node with: - node-version: ${{ steps.get-node-version.outputs.node-version }} registry-url: https://registry.npmjs.org env: NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} @@ -123,15 +119,9 @@ jobs: 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 }} + - uses: ./.github/actions/setup-node - - name: Setup dfx - uses: ./.github/actions/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 439d642b6c..ff0de532b1 100644 --- a/.github/workflows/run_test.yml +++ b/.github/workflows/run_test.yml @@ -58,12 +58,7 @@ jobs: # Just in case the path isn't obvious from the name, this will remove ambiguity run: echo ${{matrix.tests.path}} - - 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 }} + - uses: ./.github/actions/setup-node - id: setup-dfx uses: ./.github/actions/setup_dfx From 308968e46f417fd99f0aec5dcb3427df1bde16f2 Mon Sep 17 00:00:00 2001 From: Benjamin DeMann Date: Mon, 28 Oct 2024 12:43:47 -0600 Subject: [PATCH 51/59] clean up code --- .github/workflows/release_parallel.yml | 36 +++----------------------- .github/workflows/run_test.yml | 11 +++++--- 2 files changed, 11 insertions(+), 36 deletions(-) diff --git a/.github/workflows/release_parallel.yml b/.github/workflows/release_parallel.yml index 64ef1e7ccf..dbd0e179a0 100644 --- a/.github/workflows/release_parallel.yml +++ b/.github/workflows/release_parallel.yml @@ -39,8 +39,7 @@ jobs: env: NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} - - name: Setup dfx - uses: ./.github/actions/setup_dfx + - uses: ./.github/actions/setup_dfx - run: npm install @@ -75,36 +74,10 @@ jobs: directories: | ./examples ./tests - exclude-dirs: | - ${{ format(' - tests/end_to_end/candid_rpc/class_syntax/new - tests/end_to_end/http_server/new - examples/basic_bitcoin - examples/bitcoin_psbt - examples/ckbtc - tests/end_to_end/http_server/ethers_base - tests/end_to_end/http_server/http_outcall_fetch - tests/end_to_end/http_server/ic_evm_rpc - tests/property/candid_rpc/class_api/stable_b_tree_map - tests/property/candid_rpc/functional_api/stable_b_tree_map - tests/property/ic_api/performance_counter - tests/property/ic_api/instruction_counter - tests/end_to_end/candid_rpc/functional_syntax/ckbtc - tests/end_to_end/candid_rpc/class_syntax/bitcoin - tests/end_to_end/http_server/large_files - tests/end_to_end/http_server/open_value_sharing - tests/end_to_end/candid_rpc/class_syntax/stable_structures - tests/end_to_end/candid_rpc/functional_syntax/bitcoin - tests/end_to_end/candid_rpc/functional_syntax/composite_queries - tests/end_to_end/candid_rpc/functional_syntax/cross_canister_calls - tests/end_to_end/candid_rpc/functional_syntax/management_canister - tests/end_to_end/candid_rpc/functional_syntax/stable_structures - tests/end_to_end/http_server/autoreload - ') }} update-test-files-for-release-commit: needs: prepare-release - name: Update ${{ matrix.test.name }} + name: Update ${{ matrix.test.name }} files for release commit runs-on: ubuntu-latest env: GPG_SIGNING_KEY: ${{ secrets.GPG_SIGNING_KEY }} @@ -187,15 +160,14 @@ jobs: - name: Display collected branches run: | echo "Collected branches:" - echo "${{ steps.collect-branches.outputs.branches }}" | while read branch; do + while read branch; do echo " - $branch" - done + done < <(echo "${{ steps.collect-branches.outputs.branches }}") echo "End of branch list" - name: Fetch branches run: | echo "Fetching all branches..." - # Use process substitution instead of pipe to avoid subshell BRANCHES_TO_FETCH="" while read branch; do BRANCHES_TO_FETCH+=" ${branch}:${branch}" diff --git a/.github/workflows/run_test.yml b/.github/workflows/run_test.yml index ff0de532b1..4d4d25c3c0 100644 --- a/.github/workflows/run_test.yml +++ b/.github/workflows/run_test.yml @@ -60,8 +60,7 @@ jobs: - uses: ./.github/actions/setup-node - - id: setup-dfx - uses: ./.github/actions/setup_dfx + - uses: ./.github/actions/setup_dfx - name: Run pre-test Azle setup run: | @@ -101,7 +100,8 @@ jobs: working-directory: ${{ matrix.tests.path }} run: dfx start --clean --background --host 127.0.0.1:8000 - - name: Run test + - name: Calculate number of test runs + id: calc-runs run: | RUNS=1 @@ -126,7 +126,10 @@ jobs: fi echo "Running tests $RUNS times" + echo "runs=$RUNS" >> $GITHUB_OUTPUT + shell: bash -l {0} - AZLE_PROPTEST_NUM_RUNS=$RUNS AZLE_PROPTEST_VERBOSE=true npm test + - name: Run tests + run: AZLE_PROPTEST_NUM_RUNS=${{ steps.calc-runs.outputs.runs }} AZLE_PROPTEST_VERBOSE=true npm test shell: bash -l {0} working-directory: ${{ matrix.tests.path }} From 5c9b02536d8ab0b39629e3683994bc31cee62c3f Mon Sep 17 00:00:00 2001 From: Benjamin DeMann Date: Mon, 28 Oct 2024 14:20:16 -0600 Subject: [PATCH 52/59] remove inputs from set-up node --- .github/actions/get_test_infos/action.yml | 2 +- .github/actions/setup-node/action.yml | 43 ------------------- .../{setup-node => setup_node}/README.md | 2 +- .github/actions/setup_node/action.yml | 19 ++++++++ .github/workflows/release_parallel.yml | 6 +-- .github/workflows/run_test.yml | 2 +- 6 files changed, 24 insertions(+), 50 deletions(-) delete mode 100644 .github/actions/setup-node/action.yml rename .github/actions/{setup-node => setup_node}/README.md (95%) create mode 100644 .github/actions/setup_node/action.yml diff --git a/.github/actions/get_test_infos/action.yml b/.github/actions/get_test_infos/action.yml index b2fe19158a..c325e84f33 100644 --- a/.github/actions/get_test_infos/action.yml +++ b/.github/actions/get_test_infos/action.yml @@ -23,7 +23,7 @@ outputs: runs: using: composite steps: - - uses: ./.github/actions/setup-node + - uses: ./.github/actions/setup_node - name: Get test infos id: get-test-infos diff --git a/.github/actions/setup-node/action.yml b/.github/actions/setup-node/action.yml deleted file mode 100644 index 1196c6da9b..0000000000 --- a/.github/actions/setup-node/action.yml +++ /dev/null @@ -1,43 +0,0 @@ -name: 'Setup Node.js' -description: 'Sets up Node.js environment and gets Node version from package.json' -inputs: - working-directory: - description: 'Directory containing package.json' - required: false - default: '.' - registry-url: - description: 'Optional registry URL' - required: false - node-version-file: - description: 'File containing the version Spec' - required: false - default: 'package.json' - cache: - description: 'Used to specify a package manager for caching' - required: false - cache-dependency-path: - description: 'Path to package-lock.json file' - required: false - -outputs: - node-version: - description: 'The Node.js version from package.json' - value: ${{ steps.get-version.outputs.version }} - -runs: - using: 'composite' - steps: - - id: get-version - shell: bash - working-directory: ${{ inputs.working-directory }} - run: | - VERSION=$(jq -r '.azle.globalDependencies.node // error("node version not found")' "package.json") - echo "version=$VERSION" >> $GITHUB_OUTPUT - - - uses: actions/setup-node@v4 - with: - node-version: ${{ steps.get-version.outputs.version }} - registry-url: ${{ inputs.registry-url }} - node-version-file: ${{ inputs.node-version-file }} - cache: ${{ inputs.cache }} - cache-dependency-path: ${{ inputs.cache-dependency-path }} diff --git a/.github/actions/setup-node/README.md b/.github/actions/setup_node/README.md similarity index 95% rename from .github/actions/setup-node/README.md rename to .github/actions/setup_node/README.md index 9c5219de3f..c13ab9d22f 100644 --- a/.github/actions/setup-node/README.md +++ b/.github/actions/setup_node/README.md @@ -17,7 +17,7 @@ checking out a specific branch. steps: - uses: actions/checkout@v4 - - uses: ./.github/actions/setup-node + - uses: ./.github/actions/setup_node - run: echo "${{ steps.setup-node.outputs.version }}" ``` diff --git a/.github/actions/setup_node/action.yml b/.github/actions/setup_node/action.yml new file mode 100644 index 0000000000..2c97cf48f7 --- /dev/null +++ b/.github/actions/setup_node/action.yml @@ -0,0 +1,19 @@ +name: 'Setup Node.js' +description: 'Sets up Node.js environment and gets Node version from package.json' + +outputs: + node-version: + description: 'The Node.js version from package.json' + value: ${{ steps.get-version.outputs.version }} + +runs: + using: 'composite' + steps: + - id: get-version + shell: bash + working-directory: ${{ inputs.working-directory }} + run: | + VERSION=$(jq -r '.azle.globalDependencies.node // error("node version not found")' "package.json") + echo "version=$VERSION" >> $GITHUB_OUTPUT + + - uses: actions/setup-node@v4 diff --git a/.github/workflows/release_parallel.yml b/.github/workflows/release_parallel.yml index dbd0e179a0..1e3c0e3fca 100644 --- a/.github/workflows/release_parallel.yml +++ b/.github/workflows/release_parallel.yml @@ -33,9 +33,7 @@ jobs: RELEASE_VERSION="${BRANCH_NAME:9}" echo "release-version=$RELEASE_VERSION" >> $GITHUB_OUTPUT - - uses: ./.github/actions/setup-node - with: - registry-url: https://registry.npmjs.org + - uses: ./.github/actions/setup_node env: NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} @@ -92,7 +90,7 @@ jobs: ref: ${{ github.event.pull_request.head.ref || github.ref }} token: ${{ secrets.LASTMJS_GITHUB_TOKEN || github.token }} - - uses: ./.github/actions/setup-node + - uses: ./.github/actions/setup_node - uses: ./.github/actions/setup_dfx diff --git a/.github/workflows/run_test.yml b/.github/workflows/run_test.yml index 4d4d25c3c0..946a05616c 100644 --- a/.github/workflows/run_test.yml +++ b/.github/workflows/run_test.yml @@ -58,7 +58,7 @@ jobs: # Just in case the path isn't obvious from the name, this will remove ambiguity run: echo ${{matrix.tests.path}} - - uses: ./.github/actions/setup-node + - uses: ./.github/actions/setup_node - uses: ./.github/actions/setup_dfx From e800a20b30bed2500567550d1098eaa56b7b34b0 Mon Sep 17 00:00:00 2001 From: Benjamin DeMann Date: Mon, 28 Oct 2024 14:28:03 -0600 Subject: [PATCH 53/59] get rid or dfx input --- .github/actions/setup_dfx/action.yml | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/.github/actions/setup_dfx/action.yml b/.github/actions/setup_dfx/action.yml index 1d2103cd1a..bdff0d646f 100644 --- a/.github/actions/setup_dfx/action.yml +++ b/.github/actions/setup_dfx/action.yml @@ -1,9 +1,5 @@ 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' @@ -12,7 +8,6 @@ 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" @@ -20,8 +15,7 @@ runs: - 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 + 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 shell: bash From c15b223fc70c5b24b076ccebfaf2b39e47a70795 Mon Sep 17 00:00:00 2001 From: Benjamin DeMann Date: Mon, 28 Oct 2024 14:49:57 -0600 Subject: [PATCH 54/59] update branch name --- .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 1e3c0e3fca..14f7a360a5 100644 --- a/.github/workflows/release_parallel.yml +++ b/.github/workflows/release_parallel.yml @@ -116,7 +116,7 @@ jobs: - name: Commit and push changes run: | - BRANCH_NAME="update-${{ needs.prepare-release.outputs.release-version }}-$(echo '${{ matrix.test.displayPath }}' | sed 's/\//-/g')" + BRANCH_NAME="update--${{ needs.prepare-release.outputs.release-version }}-$(echo '${{ matrix.test.displayPath }}' | sed 's/\//-/g')" git switch -c "$BRANCH_NAME" git add --all if ! git diff --cached --quiet; then @@ -148,7 +148,7 @@ jobs: id: collect-branches run: | # Create array of branches - readarray -t BRANCH_ARRAY < <(git branch -r | grep "origin/update-${{ needs.prepare-release.outputs.release-version }}-" | sed 's/origin\///' | xargs -n1) + readarray -t BRANCH_ARRAY < <(git branch -r | grep "origin/update--${{ needs.prepare-release.outputs.release-version }}-" | sed 's/origin\///' | xargs -n1) # Output array elements as multiline value echo "branches<> $GITHUB_OUTPUT From e13123e8ea340257d3133bcecc3447240aa9b6ba Mon Sep 17 00:00:00 2001 From: Benjamin DeMann Date: Mon, 28 Oct 2024 15:15:55 -0600 Subject: [PATCH 55/59] delete file --- .github/scripts/publish_github_action.sh | 59 ------------------------ 1 file changed, 59 deletions(-) delete mode 100755 .github/scripts/publish_github_action.sh diff --git a/.github/scripts/publish_github_action.sh b/.github/scripts/publish_github_action.sh deleted file mode 100755 index 7d326a5bc4..0000000000 --- a/.github/scripts/publish_github_action.sh +++ /dev/null @@ -1,59 +0,0 @@ -#!/bin/bash - -set -e - -root_dir=$PWD - -VERSION=$1 - -directories_json_string_with_linebreaks=$2 -directories_json_string="${directories_json_string_with_linebreaks//$'\\n'/''}" -directories=$(echo "$directories_json_string" | jq -c -r '.[] | .path') - -sed -E -i "s/(\"version\": \")(.*)(\")/\1$VERSION\3/" package.json -sed -E -i "s/(\"version\": \")(.*)(\")/\1$VERSION\3/" dfx_extension/extension.json -# TODO we need to keep the dependencies.json file up-to-date as well -npm install - -# Build the binary templates -npx azle template -npx azle template --experimental - -if [[ "$VERSION" == *"-rc."* ]]; -then - npm publish --tag next -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" - -# sleep 30 - -# for directory in ${directories[@]} -# do -# cd "$directory" -# echo "updating $directory" - -# sed -E -i "s/(\"azle\": \")(.*)(\")/\1$VERSION\3/" package.json -# npm install - -# rm -rf node_modules - -# cd $root_dir -# done - -# git add --all -# git commit -am "azle-bot automated release $VERSION" -# git push origin $GITHUB_HEAD_REF - -# 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 7871dfa7b1ebdd4de9223f59f4d04ede14e71f51 Mon Sep 17 00:00:00 2001 From: Benjamin DeMann Date: Mon, 28 Oct 2024 15:29:59 -0600 Subject: [PATCH 56/59] bring back the repo --- .github/actions/setup_node/README.md | 3 ++- .github/actions/setup_node/action.yml | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/actions/setup_node/README.md b/.github/actions/setup_node/README.md index c13ab9d22f..0de04bd24e 100644 --- a/.github/actions/setup_node/README.md +++ b/.github/actions/setup_node/README.md @@ -17,7 +17,8 @@ checking out a specific branch. steps: - uses: actions/checkout@v4 - - uses: ./.github/actions/setup_node + - id: setup-node + uses: ./.github/actions/setup_node - run: echo "${{ steps.setup-node.outputs.version }}" ``` diff --git a/.github/actions/setup_node/action.yml b/.github/actions/setup_node/action.yml index 2c97cf48f7..0c782e5c27 100644 --- a/.github/actions/setup_node/action.yml +++ b/.github/actions/setup_node/action.yml @@ -17,3 +17,5 @@ runs: echo "version=$VERSION" >> $GITHUB_OUTPUT - uses: actions/setup-node@v4 + with: + registry-url: https://registry.npmjs.org From 26ee9ce90f01af86163d8e62583a7679dc78b74a Mon Sep 17 00:00:00 2001 From: Benjamin DeMann Date: Mon, 28 Oct 2024 15:58:02 -0600 Subject: [PATCH 57/59] try this --- .github/actions/setup_node/action.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/actions/setup_node/action.yml b/.github/actions/setup_node/action.yml index 0c782e5c27..55e700ad50 100644 --- a/.github/actions/setup_node/action.yml +++ b/.github/actions/setup_node/action.yml @@ -11,7 +11,6 @@ runs: steps: - id: get-version shell: bash - working-directory: ${{ inputs.working-directory }} run: | VERSION=$(jq -r '.azle.globalDependencies.node // error("node version not found")' "package.json") echo "version=$VERSION" >> $GITHUB_OUTPUT From fb0b14ede43bad698f9661645a51e3ed12d0a75f Mon Sep 17 00:00:00 2001 From: Benjamin DeMann Date: Mon, 28 Oct 2024 16:05:35 -0600 Subject: [PATCH 58/59] try all of this --- .github/actions/setup_node/action.yml | 25 +++++++++++++++++++++++-- .github/workflows/release_parallel.yml | 2 ++ 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/.github/actions/setup_node/action.yml b/.github/actions/setup_node/action.yml index 55e700ad50..94427b9539 100644 --- a/.github/actions/setup_node/action.yml +++ b/.github/actions/setup_node/action.yml @@ -1,6 +1,23 @@ name: 'Setup Node.js' description: 'Sets up Node.js environment and gets Node version from package.json' - +inputs: + working-directory: + description: 'Directory containing package.json' + required: false + default: '.' + registry-url: + description: 'Optional registry URL' + required: false + node-version-file: + description: 'File containing the version Spec' + required: false + default: 'package.json' + cache: + description: 'Used to specify a package manager for caching' + required: false + cache-dependency-path: + description: 'Path to package-lock.json file' + required: false outputs: node-version: description: 'The Node.js version from package.json' @@ -17,4 +34,8 @@ runs: - uses: actions/setup-node@v4 with: - registry-url: https://registry.npmjs.org + registry-url: ${{ inputs.registry-url }} + node-version: ${{ steps.get-version.outputs.version }} + node-version-file: ${{ inputs.node-version-file }} + cache: ${{ inputs.cache }} + cache-dependency-path: ${{ inputs.cache-dependency-path }} diff --git a/.github/workflows/release_parallel.yml b/.github/workflows/release_parallel.yml index 14f7a360a5..bbd427d712 100644 --- a/.github/workflows/release_parallel.yml +++ b/.github/workflows/release_parallel.yml @@ -34,6 +34,8 @@ jobs: echo "release-version=$RELEASE_VERSION" >> $GITHUB_OUTPUT - uses: ./.github/actions/setup_node + with: + registry-url: https://registry.npmjs.org env: NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} From 886b7122214c9cd5ddff4d40dd0e0ffef73af1f8 Mon Sep 17 00:00:00 2001 From: Benjamin DeMann Date: Mon, 28 Oct 2024 16:12:07 -0600 Subject: [PATCH 59/59] try that --- .github/actions/setup_node/action.yml | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/.github/actions/setup_node/action.yml b/.github/actions/setup_node/action.yml index 94427b9539..5485bb0611 100644 --- a/.github/actions/setup_node/action.yml +++ b/.github/actions/setup_node/action.yml @@ -1,10 +1,6 @@ name: 'Setup Node.js' description: 'Sets up Node.js environment and gets Node version from package.json' inputs: - working-directory: - description: 'Directory containing package.json' - required: false - default: '.' registry-url: description: 'Optional registry URL' required: false @@ -12,12 +8,6 @@ inputs: description: 'File containing the version Spec' required: false default: 'package.json' - cache: - description: 'Used to specify a package manager for caching' - required: false - cache-dependency-path: - description: 'Path to package-lock.json file' - required: false outputs: node-version: description: 'The Node.js version from package.json' @@ -37,5 +27,3 @@ runs: registry-url: ${{ inputs.registry-url }} node-version: ${{ steps.get-version.outputs.version }} node-version-file: ${{ inputs.node-version-file }} - cache: ${{ inputs.cache }} - cache-dependency-path: ${{ inputs.cache-dependency-path }}