Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release 0.24.2 rc.42 #2168

Closed
wants to merge 35 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
c882082
use reusable workflows for running tests
bdemann Oct 4, 2024
ee4fc08
try splitting it up into two things
bdemann Oct 4, 2024
45542b5
this would be crazy
bdemann Oct 4, 2024
86ffe52
move run conditions into action
bdemann Oct 8, 2024
abbb9df
move node version inside get test infos action
bdemann Oct 8, 2024
eb31aec
remove name to prefer just id
bdemann Oct 8, 2024
5afdaab
try using variables instead of jq
bdemann Oct 8, 2024
bcedb3b
fold into one action
bdemann Oct 8, 2024
6f135d8
move get and run tests to a workflow
bdemann Oct 8, 2024
9001e67
update names
bdemann Oct 8, 2024
36df50f
improve readability
bdemann Oct 8, 2024
3495704
move os and include npm into the run tests workflow
bdemann Oct 8, 2024
65250e6
bring back comments
bdemann Oct 8, 2024
7e1fa2b
bring back dfx without artificial delay and comments
bdemann Oct 8, 2024
e0cf9b1
check conditions
bdemann Oct 8, 2024
85bd45d
restore lower case
bdemann Oct 8, 2024
8c31c99
set env variables to be '' by default
bdemann Oct 9, 2024
9d08830
fix spacing
bdemann Oct 9, 2024
8ba60a1
use underscore instead of dash
bdemann Oct 9, 2024
3b6b84c
try parallel release
bdemann Oct 14, 2024
b6aef35
WIP
bdemann Oct 14, 2024
2024b93
move into workflow
bdemann Oct 14, 2024
f78d288
fixup
bdemann Oct 14, 2024
52d6840
pass npm token secret
bdemann Oct 15, 2024
bff3610
fixup
bdemann Oct 15, 2024
a391563
fixup
bdemann Oct 15, 2024
1d4468d
install dfx before npm install
bdemann Oct 15, 2024
042cb70
make sure all commits are verified
bdemann Oct 15, 2024
1d94df3
add release version to the branch names
bdemann Oct 15, 2024
6a91528
add env variable
bdemann Oct 15, 2024
6bab4a4
update checkout
bdemann Oct 15, 2024
9b2f482
create branch
bdemann Oct 15, 2024
2da525f
remove sub release trouble shooter
bdemann Oct 15, 2024
41cffb9
make sure branches are unique
bdemann Oct 15, 2024
2bc1043
release--0.24.2-rc.42
bdemann Oct 15, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .github/actions/get_test_infos/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ steps:
- id: get-test-infos
uses: ./.github/actions/get_test_infos
with:
node-version: '20.x'
directories: './tests ./examples'
exclude-dirs: 'tests/exclude_this_directory examples/exclude_this exclude_all_with_this_dir_in_path'

Expand Down
16 changes: 8 additions & 8 deletions .github/actions/get_test_infos/action.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Get test infos
name: 'Get test infos'
description:
'Gets a list of test info objects for each npm project with an npm test script
The shape of the object is
Expand All @@ -9,26 +9,26 @@ description:
displayPath: string // An abbreviated version of the path for display purposes only
}'
inputs:
node-version:
description: The version of Node.js to use
required: true
directories:
description: List of directories to search for npm projects with an npm test script
description: 'List of directories to search for npm projects with an npm test script'
required: true
exclude-dirs:
description: List of directories to exclude from the search
description: 'List of directories to exclude from the search'
required: false
default: ''
outputs:
test-infos:
description: All of the test info objects found by this action
description: 'All of the test info objects found by this action'
value: ${{ steps.get-test-infos.outputs.test-infos }}
runs:
using: composite
steps:
- id: get-node-version
uses: ./.github/actions/get_node_version

- uses: actions/setup-node@v4
with:
node-version: ${{ inputs.node-version }}
node-version: ${{ steps.get-node-version.outputs.node-version }}

- name: Get test infos
id: get-test-infos
Expand Down
33 changes: 33 additions & 0 deletions .github/actions/set_run_conditions/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: 'Set run conditions'
description: 'Sets the run conditions based on the current GitHub context'
outputs:
conditions:
description: 'JSON string of run conditions'
value: ${{ steps.set-conditions.outputs.conditions }}
runs:
using: 'composite'
steps:
- id: set-conditions
run: |
# Define conditions using shell variables
IS_MAIN_PUSH=${{ github.ref == 'refs/heads/main' && !contains(github.event.head_commit.message, 'demergent-labs/release--') }}
IS_MAIN_MERGE_RELEASE=${{ github.ref == 'refs/heads/main' && contains(github.event.head_commit.message, 'demergent-labs/release--') }}
IS_RELEASE_PR=${{ startsWith(github.head_ref, 'release--') }}
IS_FEATURE_PR=${{ !startsWith(github.head_ref, 'release--') && github.ref != 'refs/heads/main' && github.event.pull_request.draft == false }}
IS_DRAFT_PR=${{ !startsWith(github.head_ref, 'release--') && github.ref != 'refs/heads/main' && github.event.pull_request.draft == true }}

# Create JSON object
CONDITIONS=$(cat <<EOF
{
"is_main_branch_push": $IS_MAIN_PUSH,
"is_main_branch_merge_from_release_push": $IS_MAIN_MERGE_RELEASE,
"is_release_branch_pr": $IS_RELEASE_PR,
"is_feature_branch_pr": $IS_FEATURE_PR,
"is_feature_branch_draft_pr": $IS_DRAFT_PR
}
EOF
)

# Set output
echo "conditions=$(echo $CONDITIONS | base64 -w 0)" >> $GITHUB_OUTPUT
shell: bash
46 changes: 23 additions & 23 deletions .github/scripts/publish_github_action.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
33 changes: 33 additions & 0 deletions .github/workflows/get_and_run_tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Get and Run Tests

on:
workflow_call:
inputs:
directories:
required: true
type: string
exclude-dirs:
required: false
type: string
default: ''

jobs:
get-test-infos:
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-test-infos
uses: ./.github/actions/get_test_infos
with:
directories: ${{ inputs.directories }}
exclude-dirs: ${{ inputs.exclude-dirs }}

run-tests:
name: 'Run'
needs: get-test-infos
uses: ./.github/workflows/run_test.yml
with:
test_infos: ${{ needs.get-test-infos.outputs.test-infos }}
55 changes: 5 additions & 50 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,58 +43,13 @@ jobs:
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/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) }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
Loading
Loading