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.8 #2102

Closed
wants to merge 23 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
16 changes: 16 additions & 0 deletions .github/actions/get_dfx_version/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: Get dfx version
description: Determines Azle's dfx version
outputs:
dfx-version:
description: Returns the version of dfx Azle used for it's last template
value: ${{ steps.get-dfx-version.outputs.dfx-version }}
runs:
using: composite
steps:
- uses: actions/checkout@v4

- id: get-dfx-version
run: |
DFX_VERSION=$(./.github/actions/get_dfx_version/get_dfx_version.sh)
echo "dfx-version=${DFX_VERSION}" >> "$GITHUB_OUTPUT"
shell: bash
20 changes: 20 additions & 0 deletions .github/actions/get_dfx_version/get_dfx_version.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/bin/bash

# Path to package.json
PACKAGE_JSON_PATH="package.json"

# Check if package.json exists
if [ ! -f "$PACKAGE_JSON_PATH" ]; then
echo "Error: $PACKAGE_JSON_PATH not found."
exit 1
fi

# Extract the Node.js version from globalDependencies
DFX_VERSION=$(jq -r '.azle.globalDependencies.dfx // empty' "$PACKAGE_JSON_PATH")

if [ -z "$DFX_VERSION" ]; then
echo "dfx version not found in globalDependencies."
exit 1
else
echo "$DFX_VERSION"
fi
16 changes: 16 additions & 0 deletions .github/actions/get_node_version/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: Get node version
description: Determines Azle's node version
outputs:
node-version:
description: Returns the version of node Azle used for it's last template
value: ${{ steps.get-node-version.outputs.node-version }}
runs:
using: composite
steps:
- uses: actions/checkout@v4

- id: get-node-version
run: |
NODE_VERSION=$(./.github/actions/get_node_version/get_node_version.sh)
echo "node-version=${NODE_VERSION}" >> "$GITHUB_OUTPUT"
shell: bash
20 changes: 20 additions & 0 deletions .github/actions/get_node_version/get_node_version.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/bin/bash

# Path to package.json
PACKAGE_JSON_PATH="package.json"

# Check if package.json exists
if [ ! -f "$PACKAGE_JSON_PATH" ]; then
echo "Error: $PACKAGE_JSON_PATH not found."
exit 1
fi

# Extract the Node.js version from globalDependencies
NODE_VERSION=$(jq -r '.azle.globalDependencies.node // empty' "$PACKAGE_JSON_PATH")

if [ -z "$NODE_VERSION" ]; then
echo "Node.js version not found in globalDependencies."
exit 1
else
echo "$NODE_VERSION"
fi
7 changes: 3 additions & 4 deletions .github/actions/get_test_infos/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,16 @@ 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
required: true
exclude-dirs:
description: List of directories to exclude from the search
required: false
default: ''
node-version:
description: The version of Node.js to use
required: true
default: '20.x'
outputs:
test-infos:
description: All of the test info objects found by this action
Expand Down
58 changes: 0 additions & 58 deletions .github/scripts/install_global_dependencies.sh

This file was deleted.

40 changes: 32 additions & 8 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@ on:
branches:
- main
pull_request: # Runs on pull requests to any branch
env:
DFX_VERSION: 0.21.0
NODE_VERSION: 20
jobs:
determine-should-release:
if: ${{ startsWith(github.head_ref, 'release--') }}
Expand All @@ -20,9 +17,26 @@ jobs:
- id: determine-should-release
uses: ./.github/actions/should_release

get-test-infos:
get-node-version:
needs: determine-should-release
if: ${{ startsWith(github.head_ref, 'release--') && needs.determine-should-release.outputs.should-release }}
name: Get node version
runs-on: ubuntu-latest
outputs:
node-version: ${{ steps.get-node-version.outputs.node-version }}
steps:
- uses: actions/checkout@v4

- id: get-node-version
uses: ./.github/actions/get_node_version
- id: report
run: echo ${{steps.get-node-version.outputs.node-version}}

get-test-infos:
needs:
- determine-should-release
- get-node-version
if: ${{ startsWith(github.head_ref, 'release--') && needs.determine-should-release.outputs.should-release }}
name: Get test infos
runs-on: ubuntu-latest
outputs:
Expand All @@ -34,6 +48,7 @@ jobs:
id: get-test-infos
uses: ./.github/actions/get_test_infos
with:
node-version: ${{ needs.get-node-version.outputs.node-version }}
directories: |
./examples
./tests
Expand All @@ -45,6 +60,7 @@ jobs:
needs:
- determine-should-release
- get-test-infos
- get-node-version
runs-on: ubuntu-latest
env:
GPG_SIGNING_KEY: ${{ secrets.GPG_SIGNING_KEY }} # All commits must be verified
Expand All @@ -57,20 +73,28 @@ jobs:

- uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
node-version: ${{ needs.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

- name: Install global dependencies
run: ./.github/scripts/install_global_dependencies.sh
- id: get-dfx-version
# TODO Hey Jordan, This is here to demonstrate two different ways of doing get node version and get dfx version. I think we should unify them, but I wanted to have both to see which you prefered
uses: ./.github/actions/get_dfx_version

- name: Install dfx
run: |
DFXVM_INIT_YES=true DFX_VERSION=${{ env.DFX_VERSION }} sh -ci "$(curl -fsSL https://sdk.dfinity.org/install.sh)"

# Install dfx (Note: DFX must be installed before `npm install` because the azle instalation process required dfx)
# TODO if you want we could explore using the install script... it's kind of overkill and we would still have to supply the version. Though if dfinity ever changed their install script again it would be only one place we would have to update. This would apply to the installation in the test.yml as well
DFXVM_INIT_YES=true DFX_VERSION=${{ steps.get-dfx-version.outputs.dfx-version }} sh -ci "$(curl -fsSL https://sdk.dfinity.org/install.sh)"

- name: Install global dependencies
run: |
npx azle install-global-dependencies --rust --wasi2ic
echo "$HOME/.local/share/dfx/bin" >> $GITHUB_PATH

# TODO we should use some Action-specific bot account
Expand Down
29 changes: 23 additions & 6 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ on:
- main
pull_request: # Runs on pull requests to any branch
env:
DFX_VERSION: 0.22.0
NODE_VERSION: 20
IS_MAIN_BRANCH: ${{ github.ref == 'refs/heads/main' }}
IS_RELEASE_BRANCH_PR: ${{ startsWith(github.head_ref, 'release--') }}
IS_FEATURE_BRANCH_PR: ${{ !startsWith(github.head_ref, 'release--') }}
Expand All @@ -28,9 +26,22 @@ jobs:
- id: determine-should-run-tests
uses: ./.github/actions/should_release

get-node-version:
name: Get node version
runs-on: ubuntu-latest
outputs:
node-version: ${{ steps.get-node-version.outputs.node-version }}
steps:
- uses: actions/checkout@v4

- id: get-node-version
uses: ./.github/actions/get_node_version

get-test-infos:
name: Get test infos
needs: determine-should-run-tests
needs:
- determine-should-run-tests
- get-node-version
if: ${{ needs.determine-should-run-tests.outputs.should-run-tests == 'true' }}
runs-on: ubuntu-latest
outputs:
Expand All @@ -42,6 +53,7 @@ jobs:
id: get-test-infos
uses: ./.github/actions/get_test_infos
with:
node-version: ${{ needs.get-node-version.outputs.node-version }}
directories: |
./examples
./tests
Expand All @@ -61,6 +73,7 @@ jobs:
name: '${{matrix.tests.name}} | ${{matrix.tests.displayPath}} | ${{matrix.azle_source}}'
needs:
- determine-should-run-tests
- get-node-version
- get-test-infos
if: ${{ needs.determine-should-run-tests.outputs.should-run-tests == 'true' }}
runs-on: ${{ matrix.os }}
Expand Down Expand Up @@ -96,13 +109,17 @@ jobs:

- uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
node-version: ${{ needs.get-node-version.outputs.node-version }}

- id: get-dfx-version
# TODO Hey Jordan, This is here to demonstrate two different ways of doing get node version and get dfx version. I think we should unify them, but I wanted to have both to see which you prefered
uses: ./.github/actions/get_dfx_version

- name: Run pre-test Azle setup
run: |

# Install dfx
DFXVM_INIT_YES=true DFX_VERSION=${{ env.DFX_VERSION }} sh -ci "$(curl -fsSL https://sdk.dfinity.org/install.sh)"
# Install dfx (Note: DFX must be installed before `npm install` because the azle instalation process required dfx)
DFXVM_INIT_YES=true DFX_VERSION=${{ steps.get-dfx-version.outputs.dfx-version }} sh -ci "$(curl -fsSL https://sdk.dfinity.org/install.sh)"
echo "$HOME/.local/share/dfx/bin" >> $GITHUB_PATH

# MacOS-specific DNS configuration
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "azle",
"version": "0.24.1",
"version": "0.24.2-rc.8",
"description": "TypeScript and JavaScript CDK for the Internet Computer",
"scripts": {
"typecheck": "tsc --noEmit",
Expand Down Expand Up @@ -81,7 +81,8 @@
"globalDependencies": {
"wasi2ic": "https://github.com/wasm-forge/wasi2ic?rev=806c3558aad24224852a9582f018178402cb3679#806c3558",
"node": "20.11.0",
"rustc": "1.80.1"
"rustc": "1.80.1",
"dfx": "0.22.0"
}
}
}
13 changes: 13 additions & 0 deletions src/build/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import {
import { runCommand as runCleanCommand } from './stable/commands/clean';
import { runCommand as runStableCompileCommand } from './stable/commands/compile';
import { runCommand as runInstallDfxExtensionCommand } from './stable/commands/install_dfx_extension';
import { runCommand as runInstallGlobalDependenciesCommand } from './stable/commands/install_global_dependencies';
import { runCommand as runNewCommand } from './stable/commands/new';
import { runCommand as runStableTemplateCommand } from './stable/commands/template';
import { runCommand as runVersionCommand } from './stable/commands/version';
Expand All @@ -38,6 +39,12 @@ async function build(): Promise<void> {
return;
}

if (command === 'install-global-dependencies') {
handleInstallGlobalDependenciesCommand(ioType);

return;
}

if (command === 'upload-assets') {
await handleUploadAssetsCommand();

Expand Down Expand Up @@ -129,6 +136,12 @@ async function handleTemplateCommand(ioType: IOType): Promise<void> {
}
}

async function handleInstallGlobalDependenciesCommand(
ioType: IOType
): Promise<void> {
await runInstallGlobalDependenciesCommand(ioType);
}

async function handleNewCommand(): Promise<void> {
const experimental = process.argv.includes('--experimental');
const httpServer = process.argv.includes('--http-server');
Expand Down
Loading
Loading