Skip to content

Commit

Permalink
Merge branch 'main' of github.com:demergent-labs/azle into updating_cuzz
Browse files Browse the repository at this point in the history
  • Loading branch information
lastmjs committed Dec 20, 2024
2 parents 7ad6b45 + f3decce commit aa4190f
Show file tree
Hide file tree
Showing 408 changed files with 8,115 additions and 30,122 deletions.
2 changes: 1 addition & 1 deletion .github/actions/commit_and_push/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ steps:

- uses: ./.github/actions/commit_and_push
with:
gpg_signing_key: ${{ secrets.GPG_SIGNING_KEY }}
gpg-signing-key: ${{ secrets.GPG_SIGNING_KEY }}
branch-name: 'branch-name'
commit-message: 'commit message'
create-branch: 'true'
Expand Down
8 changes: 6 additions & 2 deletions .github/actions/commit_and_push/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,19 @@ inputs:
commit-message:
description: 'Commit message'
required: true
gpg_signing_key:
gpg-signing-key:
description: 'The GPG signing key to use for signing commits'
required: true
signing-key-id:
description: 'The GPG signing key ID to configure for git'
required: true
runs:
using: composite
steps:
- uses: ./.github/actions/configure_git
with:
gpg_signing_key: ${{ inputs.gpg_signing_key }}
gpg-signing-key: ${{ inputs.gpg-signing-key }}
signing-key-id: ${{ inputs.signing-key-id }}

- name: Commit and push changes
shell: bash
Expand Down
2 changes: 1 addition & 1 deletion .github/actions/configure_git/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ steps:

- uses: ./.github/actions/configure_git
with:
gpg_signing_key: ${{ secrets.GPG_SIGNING_KEY }}
gpg-signing-key: ${{ secrets.GPG_SIGNING_KEY }}
```
9 changes: 6 additions & 3 deletions .github/actions/configure_git/action.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
name: Configure Git
description: 'Configures git with user info and GPG signing'
inputs:
gpg_signing_key:
gpg-signing-key:
description: 'The GPG signing key to use for signing commits'
required: true
signing-key-id:
description: 'The GPG signing key ID to configure for git'
required: true
runs:
using: composite
steps:
Expand All @@ -13,6 +16,6 @@ runs:
git config --global user.name 'Jordan Last'
git config --global user.email '[email protected]'
git config --global commit.gpgsign true
echo -n "${{ inputs.gpg_signing_key }}" | base64 --decode | gpg --import
git config --global user.signingkey C8B77BCBE16CD2B94B43F9C8757397B82D4ED7B0
echo -n "${{ inputs.gpg-signing-key }}" | base64 --decode | gpg --import
git config --global user.signingkey ${{ inputs.signing-key-id }}
shell: bash
11 changes: 9 additions & 2 deletions .github/actions/determine_workflow_config/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ outputs:
fuzz:
description: 'Whether to run fuzz tests'
value: ${{ steps.determine_workflow_config.outputs.fuzz }}
is-dependabot:
description: 'Whether the commit is from Dependabot'
value: ${{ steps.determine_workflow_config.outputs.is-dependabot }}

runs:
using: 'composite'
Expand All @@ -54,10 +57,11 @@ runs:
echo "exclude-release-only=${{ inputs.exclude-release-only-dispatch-input-value }}" >> $GITHUB_OUTPUT
echo "link-azle=${{ inputs.link-azle-dispatch-input-value }}" >> $GITHUB_OUTPUT
echo "fuzz=${{ inputs.fuzz-dispatch-input-value }}" >> $GITHUB_OUTPUT
echo "is-dependabot=false" >> $GITHUB_OUTPUT
else
EXCLUDE_SLOW=${{ steps.workflow-context.outputs.is_feature_branch_draft_pr == 'true' }}
EXCLUDE_UNSTABLE=${{ steps.workflow-context.outputs.is_feature_branch_draft_pr == 'true' || steps.workflow-context.outputs.is_feature_branch_pr == 'true' }}
EXCLUDE_RELEASE_ONLY=${{ steps.workflow-context.outputs.is_feature_branch_draft_pr == 'true' || steps.workflow-context.outputs.is_feature_branch_pr == 'true' || steps.workflow-context.outputs.is_main_branch_push == 'true' }}
EXCLUDE_UNSTABLE=${{ steps.workflow-context.outputs.is_feature_branch_draft_pr == 'true' || steps.workflow-context.outputs.is_feature_branch_pr == 'true' || steps.workflow-context.outputs.is_main_branch_push_from_feature_merge == 'true' }}
EXCLUDE_RELEASE_ONLY=${{ steps.workflow-context.outputs.is_feature_branch_draft_pr == 'true' || steps.workflow-context.outputs.is_feature_branch_pr == 'true' || steps.workflow-context.outputs.is_main_branch_push_from_feature_merge == 'true' }}
echo "exclude-slow=$EXCLUDE_SLOW" >> $GITHUB_OUTPUT
echo "exclude-unstable=$EXCLUDE_UNSTABLE" >> $GITHUB_OUTPUT
Expand All @@ -69,6 +73,8 @@ runs:
echo "link-azle=true" >> $GITHUB_OUTPUT
fi
echo "fuzz=false" >> $GITHUB_OUTPUT
echo ${{ github.actor }}
echo "is-dependabot=${{ github.actor == 'dependabot[bot]' }}" >> $GITHUB_OUTPUT
fi
- id: echo-outputs
Expand All @@ -80,3 +86,4 @@ runs:
echo "exclude-release-only: ${{ steps.determine_workflow_config.outputs.exclude-release-only }}"
echo "link-azle: ${{ steps.determine_workflow_config.outputs.link-azle }}"
echo "fuzz: ${{ steps.determine_workflow_config.outputs.fuzz }}"
echo "is-dependabot: ${{ steps.determine_workflow_config.outputs.is-dependabot }}"
4 changes: 2 additions & 2 deletions .github/actions/determine_workflow_context/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ steps:

- name: Use run conditions
run: |
echo "Is main branch push: ${{ steps.workflow-context.outputs.is_main_branch_push }}"
echo "Is main branch merge from release push: ${{ steps.workflow-context.outputs.is_main_branch_merge_from_release_push }}"
echo "Is main branch push from feature merge: ${{ steps.workflow-context.outputs.is_main_branch_push_from_feature_merge }}"
echo "Is main branch push from release merge: ${{ steps.workflow-context.outputs.is_main_branch_push_from_release_merge }}"
echo "Is release branch PR: ${{ steps.workflow-context.outputs.is_release_branch_pr }}"
echo "Is feature branch PR: ${{ steps.workflow-context.outputs.is_feature_branch_pr }}"
echo "Is feature branch draft PR: ${{ steps.workflow-context.outputs.is_feature_branch_draft_pr }}"
Expand Down
8 changes: 4 additions & 4 deletions .github/actions/determine_workflow_context/action.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
name: 'Determine workflow context'
description: 'Determines the workflow context based on the current GitHub context'
outputs:
is_main_branch_push:
is_main_branch_push_from_feature_merge:
description: 'True if this is a push to the main branch (excluding merges from release branches)'
value: ${{ steps.workflow-context.outputs.is_main_branch_push }}
value: ${{ steps.workflow-context.outputs.is_main_branch_push_from_feature_merge }}
is_main_branch_push_from_release_merge:
description: 'True if this is a push to the main branch from a release branch merge'
value: ${{ steps.workflow-context.outputs.is_main_branch_push_from_release_merge }}
Expand All @@ -22,14 +22,14 @@ runs:
- id: workflow-context
run: |
# Define conditions using shell variables
AZLE_IS_MAIN_BRANCH_PUSH=${{ github.ref == 'refs/heads/main' && !contains(github.event.head_commit.message, 'demergent-labs/release--') }}
AZLE_IS_MAIN_BRANCH_PUSH_FROM_FEATURE_MERGE=${{ github.ref == 'refs/heads/main' && !contains(github.event.head_commit.message, 'demergent-labs/release--') }}
AZLE_IS_MAIN_BRANCH_PUSH_FROM_RELEASE_MERGE=${{ github.ref == 'refs/heads/main' && contains(github.event.head_commit.message, 'demergent-labs/release--') }}
AZLE_IS_RELEASE_BRANCH_PR=${{ startsWith(github.head_ref, 'release--') }}
AZLE_IS_FEATURE_BRANCH_PR=${{ !startsWith(github.head_ref, 'release--') && github.ref != 'refs/heads/main' && github.event.pull_request.draft == false }}
AZLE_IS_FEATURE_BRANCH_DRAFT_PR=${{ !startsWith(github.head_ref, 'release--') && github.ref != 'refs/heads/main' && github.event.pull_request.draft == true }}
# Set individual outputs
echo "is_main_branch_push=$AZLE_IS_MAIN_BRANCH_PUSH" >> $GITHUB_OUTPUT
echo "is_main_branch_push_from_feature_merge=$AZLE_IS_MAIN_BRANCH_PUSH_FROM_FEATURE_MERGE" >> $GITHUB_OUTPUT
echo "is_main_branch_push_from_release_merge=$AZLE_IS_MAIN_BRANCH_PUSH_FROM_RELEASE_MERGE" >> $GITHUB_OUTPUT
echo "is_release_branch_pr=$AZLE_IS_RELEASE_BRANCH_PR" >> $GITHUB_OUTPUT
echo "is_feature_branch_pr=$AZLE_IS_FEATURE_BRANCH_PR" >> $GITHUB_OUTPUT
Expand Down
43 changes: 43 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
version: 2
updates:
- package-ecosystem: 'npm'
directory: '/'
schedule:
interval: 'daily'
versioning-strategy: increase
commit-message:
prefix: 'deps'
prefix-development: 'deps(dev)'
groups:
dfinity:
patterns:
- '@dfinity/*'
eslint:
patterns:
- 'eslint*'
- 'typescript-eslint'
- '@eslint/*'
- '@typescript-eslint/*'
jest:
patterns:
- 'jest*'
- 'ts-jest'
ignore:
- dependency-name: 'binaryen'

- package-ecosystem: 'cargo'
directory: '/'
schedule:
interval: 'daily'
commit-message:
prefix: 'deps'
groups:
ic-dependencies:
patterns:
- 'ic-cdk*'
- 'ic-stable-structures'
- 'ic-wasi-polyfill'
- 'candid*'
serde:
patterns:
- 'serde*'
1 change: 1 addition & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@
- [ ] Error handling beautiful (no unwraps or expects etc)
- [ ] Code tested thoroughly
- [ ] All new functions have JSDoc/Rustdoc comments
- [ ] All tasks in linked issues have been completed or made into separate issues
72 changes: 62 additions & 10 deletions .github/workflows/benchmark.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
name: Benchmark

on:
workflow_dispatch:
inputs:
Expand All @@ -17,6 +18,10 @@ on:
required: true
type: boolean
default: false
signing-key-id:
required: true
type: string
default: C8B77BCBE16CD2B94B43F9C8757397B82D4ED7B0

jobs:
get-exclude-dirs:
Expand All @@ -39,6 +44,7 @@ jobs:
with:
prefix: 'benchmark'
version: $(jq -r '.version' package.json)
signing-key-id: ${{ inputs.signing-key-id }}
secrets:
GPG_SIGNING_KEY: ${{ secrets.GPG_SIGNING_KEY }}

Expand All @@ -51,22 +57,37 @@ jobs:
fail-fast: false
matrix:
benchmark_group:
- { name: 'Examples', directories: './examples' }
- {
name: 'E2E Class',
directories: './tests/end_to_end/candid_rpc/class_syntax'
name: 'Stable Demo',
directories: './examples/stable/demo'
}
- {
name: 'Experimental Demo',
directories: './examples/experimental/demo'
}
- {
name: 'E2E Functional',
directories: './tests/end_to_end/candid_rpc/functional_syntax'
name: 'Stable E2E CRPC',
directories: './examples/stable/test/end_to_end/candid_rpc'
}
- {
name: 'E2E HTTP Server',
directories: './tests/end_to_end/http_server'
name: 'Experimental E2E CRPC',
directories: './examples/experimental/test/end_to_end/candid_rpc'
}
- {
name: 'Property Class',
directories: './tests/property/candid_rpc/class_api'
name: 'Experimental E2E HTTP Server',
directories: './examples/experimental/test/end_to_end/http_server'
}
- {
name: 'Stable Property CRPC',
directories: './examples/stable/test/property/candid_rpc'
}
- {
name: 'Experimental Property CRPC',
directories: './examples/experimental/test/property/candid_rpc'
}
- {
name: 'Stable Property IC API',
directories: './examples/stable/test/property/ic_api'
}
uses: ./.github/workflows/benchmark_parallel.yml
secrets:
Expand All @@ -78,6 +99,7 @@ jobs:
branch-prefix: ${{ needs.create-branch-prefix.outputs.branch-prefix }}
directories: ${{ matrix.benchmark_group.directories }}
exclude-dirs: ${{ needs.get-exclude-dirs.outputs.exclude-dirs }}
signing-key-id: ${{ inputs.signing-key-id }}

squash-branches:
needs: [run-benchmarks, create-branch-prefix]
Expand All @@ -86,16 +108,46 @@ jobs:
base-branch: ${{ needs.create-branch-prefix.outputs.base-branch }}
branch-prefix: ${{ needs.create-branch-prefix.outputs.branch-prefix }}
commit-message: 'run benchmarks'
signing-key-id: ${{ inputs.signing-key-id }}
secrets:
GPG_SIGNING_KEY: ${{ secrets.GPG_SIGNING_KEY }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
LASTMJS_GITHUB_TOKEN: ${{ secrets.LASTMJS_GITHUB_TOKEN }}

create-pr:
analyze-benchmarks:
name: Analyze Benchmark Results
needs:
- squash-branches
- create-branch-prefix
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ needs.create-branch-prefix.outputs.base-branch }}

- uses: ./.github/actions/setup_node

- uses: ./.github/actions/setup_dfx

- name: Install dependencies
run: npm install

- name: Analyze benchmarks
run: npx tsx scripts/analyze_benchmarks/index.ts

- uses: ./.github/actions/commit_and_push
with:
gpg-signing-key: ${{ secrets.GPG_SIGNING_KEY }}
branch-name: ${{ needs.create-branch-prefix.outputs.base-branch }}
commit-message: 'analyze benchmark results'
create-branch: 'false'
signing-key-id: ${{ inputs.signing-key-id }}

create-pr:
needs:
- analyze-benchmarks
- create-branch-prefix
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
Expand Down
7 changes: 6 additions & 1 deletion .github/workflows/benchmark_parallel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ on:
required: false
type: string
default: ''
signing-key-id:
required: true
type: string
description: 'Signing key ID to use for signing commits'

secrets:
GPG_SIGNING_KEY:
Expand Down Expand Up @@ -119,5 +123,6 @@ jobs:
with:
branch-name: ${{ steps.create-branch-name.outputs.branch-name }}
commit-message: 'Run benchmarks for ${{ matrix.test.displayPath }}'
gpg_signing_key: ${{ secrets.GPG_SIGNING_KEY }}
gpg-signing-key: ${{ secrets.GPG_SIGNING_KEY }}
create-branch: 'true'
signing-key-id: ${{ inputs.signing-key-id }}
61 changes: 61 additions & 0 deletions .github/workflows/build_templates.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: Build Templates

on:
pull_request:
types:
- opened
- synchronize
- ready_for_review
- reopened

jobs:
workflow-config:
name: Determine workflow config
runs-on: ubuntu-latest
outputs:
is-dependabot: ${{ steps.determine-workflow-config.outputs.is-dependabot }}
steps:
- uses: actions/checkout@v4

- id: determine-workflow-config
uses: ./.github/actions/determine_workflow_config
with:
is-workflow-dispatch: false
exclude-slow-dispatch-input-value: false
exclude-unstable-dispatch-input-value: false
exclude-release-only-dispatch-input-value: false
link-azle-dispatch-input-value: false

build-templates:
name: Build templates for Dependabot
needs: workflow-config
if: ${{ needs.workflow-config.outputs.is-dependabot == 'true' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}
token: ${{ secrets.LASTMJS_GITHUB_TOKEN }}

- uses: ./.github/actions/setup_node

- uses: ./.github/actions/setup_dfx

- run: npm install

- name: Install global dependencies
run: |
AZLE_VERBOSE=true npx azle install-global-dependencies --rust --wasi2ic
- name: Build stable template
run: AZLE_VERBOSE=true npx azle template

- name: Build experimental template
run: AZLE_VERBOSE=true npx azle template --experimental

- uses: ./.github/actions/commit_and_push
with:
branch-name: ${{ github.head_ref }}
commit-message: 'chore: update templates for dependency changes'
gpg-signing-key: ${{ secrets.GPG_SIGNING_KEY }}
signing-key-id: ${{ needs.workflow-config.outputs.is-dependabot == 'true' && '2ED5FB11C6D5168EB9D69C5EF524010C7419CA66' || 'C8B77BCBE16CD2B94B43F9C8757397B82D4ED7B0' }}
Loading

0 comments on commit aa4190f

Please sign in to comment.