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.0 rc.0 #2032

Closed
wants to merge 57 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
57 commits
Select commit Hold shift + click to select a range
5ecc634
put service tests in the right place
bdemann Aug 26, 2024
c30880a
try setting name
bdemann Aug 26, 2024
b683952
first pass
bdemann Aug 27, 2024
a7f3854
limit to npm packages
bdemann Aug 27, 2024
4ae2ebd
restrict to npm packages
bdemann Aug 27, 2024
b7e5ed1
add exclusions
bdemann Aug 27, 2024
6657880
alphabetize
bdemann Aug 27, 2024
181eabc
update to json
bdemann Aug 27, 2024
0a48161
limit to only packages that have tests
bdemann Aug 27, 2024
9322394
test new auto generated tests
bdemann Aug 27, 2024
7e2adee
hook into real tests
bdemann Aug 28, 2024
f78eccb
update publish-github-actions
bdemann Aug 28, 2024
174bb65
move should run tests to it's own job
bdemann Aug 28, 2024
27dce50
clean up
bdemann Aug 28, 2024
21748da
make num runs a variable
bdemann Aug 28, 2024
fd4b9c0
join similar command into one job
bdemann Aug 28, 2024
5f1de50
move generate-tests script
bdemann Aug 28, 2024
57031d1
update to variables
bdemann Aug 28, 2024
e03f5ac
add report of full path of tests just incase it isn't obvious from th…
bdemann Aug 28, 2024
45273a6
update yml to use new outputs
bdemann Aug 28, 2024
8127bd4
move out conditionals to top levels
bdemann Aug 28, 2024
1b24bb6
get rid of artificial delay for feature prs
bdemann Aug 29, 2024
2c51bba
move versions to env variables
bdemann Aug 29, 2024
e76c4fe
create custom action for finding test dirs
bdemann Aug 29, 2024
2434e2a
first pass at build job
bdemann Aug 29, 2024
6a1993c
move build to it's own workflow
bdemann Aug 29, 2024
35954b9
file clean up
bdemann Aug 29, 2024
45c87d7
try object filtering
bdemann Aug 29, 2024
3593238
pr fixes
bdemann Aug 29, 2024
2a2d8c0
pr fixes
bdemann Aug 29, 2024
006a615
better wording in action
bdemann Aug 29, 2024
96a37f5
naming updates
bdemann Aug 29, 2024
d95051f
get rid of unused var
bdemann Aug 29, 2024
fe2c5a6
pr fixes
bdemann Aug 29, 2024
3ff7ef1
make sure empty all_directories leads to empty result
bdemann Aug 30, 2024
c410511
fix capitalization
bdemann Aug 30, 2024
c304651
rename generate_tests
bdemann Aug 30, 2024
b4e9f2c
variable clean up
bdemann Aug 30, 2024
8e3dac1
test commit message
bdemann Aug 30, 2024
c64698c
Merge branch 'main' into update_github_workflows
bdemann Aug 30, 2024
e86a157
pr fixes
bdemann Aug 30, 2024
3772934
rename build workflow
bdemann Aug 30, 2024
e758108
rename to release candidate deploy
bdemann Aug 30, 2024
a98b9ca
move should release to it's own action
bdemann Aug 30, 2024
4fc4061
clean up and stabilize should run action
bdemann Aug 30, 2024
e86715e
pr fixes
bdemann Aug 30, 2024
bc5b666
simplify logic for num runs
bdemann Aug 30, 2024
0e319a4
move configurable options to the top of the env
bdemann Aug 30, 2024
50f898c
update env logic
bdemann Aug 30, 2024
e83c98d
release
bdemann Aug 29, 2024
640a6ed
try this for skipping tests
bdemann Aug 30, 2024
d95f45a
fix logic
bdemann Aug 30, 2024
b584178
restore release_version to release.yml
bdemann Aug 30, 2024
91f1478
trouble shooting
bdemann Aug 30, 2024
ee81e63
try that
bdemann Aug 30, 2024
c67c9d2
try this
bdemann Aug 30, 2024
73f59e1
azle-bot automated release 0.24.0-rc.0
lastmjs Aug 30, 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
29 changes: 29 additions & 0 deletions .github/actions/get_tests/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Get tests
description: Gets a list of directories of npm projects with an npm test script
inputs:
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: ''
outputs:
tests:
description: All of the tests found by this action
value: ${{ steps.get_tests.outputs.tests }}
runs:
using: composite
steps:
- uses: actions/checkout@v4

- name: Get tests
id: get_tests
run: |
# Export the input variables to make them available to the script
export INPUT_DIRECTORIES="${{ inputs.directories }}"
export INPUT_EXCLUDE_DIRS="${{ inputs.exclude_dirs }}"
# Run the script
tests=$(./.github/scripts/get_tests.sh | base64 -d)
echo "tests=${tests}" >> "$GITHUB_OUTPUT"
shell: bash
27 changes: 27 additions & 0 deletions .github/actions/should_release/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# TODO I feel like the wording on this is a little clunky and/or ethereal.
# TODO we have is release vs should release and I don't feel like it's clear what the answer is
name: Should release
description: Determines if the current pull request is for testing or for starting a release
outputs:
should_release:
description: Returns true if this branch should start a release, otherwise false
value: ${{ steps.determine_should_release.outputs.should_release }}
runs:
using: composite
steps:
- uses: actions/checkout@v4

- id: determine_should_release
run: |
BRANCH_NAME="${{ github.head_ref }}"
RELEASE_VERSION="${BRANCH_NAME:9}"
COMMIT_MESSAGE=$(git log -1 --pretty=format:"%s")
IS_RELEASE_BRANCH_PR="${{ contains(github.head_ref, 'release--') }}"

SHOULD_RELEASE="false"
if [[ $IS_RELEASE_BRANCH_PR == "true" && "$COMMIT_MESSAGE" == "azle-bot automated release $RELEASE_VERSION" ]]; then
SHOULD_RELEASE="true"
fi

echo "should_release=${SHOULD_RELEASE}" >> "$GITHUB_OUTPUT"
shell: bash
108 changes: 108 additions & 0 deletions .github/scripts/get_tests.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
#!/bin/bash

# Inputs from action.yml
DIRECTORIES=($INPUT_DIRECTORIES)
EXCLUDE_DIRS=($INPUT_EXCLUDE_DIRS)

# Function to discover test directories
discover_directories() {
local dir=$1
find "$dir" -type d -not -path "*/node_modules/*" -exec sh -c '
for pkg in "$@"; do
if [ -f "$pkg/package.json" ]; then
if jq -e ".scripts.test" "$pkg/package.json" > /dev/null; then
echo "$pkg"
fi
fi
done
' sh {} +
}

# Function to check if a directory is excluded
is_excluded() {
local dir=$1
for exclude in "${EXCLUDE_DIRS[@]}"; do
if [[ "$dir" == *"$exclude"* ]]; then
return 0
fi
done
return 1
}

# Generate JSON object for each directory
generate_json() {
local dir=$1
local name=$(basename "$dir")
local type=""
local syntax=""
local api=""

if [[ "$dir" == *"/examples/"* ]]; then
type="ex"
elif [[ "$dir" == *"/property/"* ]]; then
type="prop"
if [[ "$dir" == *"/candid_rpc/"* ]]; then
syntax="crpc"
if [[ "$dir" == *"/functional_api/"* ]]; then
api="functional"
elif [[ "$dir" == *"/class_api/"* ]]; then
api="class"
fi
elif [[ "$dir" == *"/ic_api/"* ]]; then
syntax="ic_api"
fi
elif [[ "$dir" == *"/end_to_end/"* ]]; then
type="e2e"
if [[ "$dir" == *"/http_server/"* ]]; then
syntax="http"
elif [[ "$dir" == *"/candid_rpc/"* ]]; then
syntax="crpc"
fi
fi

# Construct JSON object
echo "{"
echo "\"path\":\"$dir\","
echo "\"name\":\"$name\","
echo "\"type\":\"$type\""
[[ -n "$syntax" ]] && echo ",\"syntax\":\"$syntax\""
[[ -n "$api" ]] && echo ",\"api\":\"$api\""
echo "}"
}

# Discover directories in the provided directories, excluding specified directories
all_directories=""
for dir in "${DIRECTORIES[@]}"; do
all_directories+=$(discover_directories "$dir")
done

# Initialize an empty variable to store the JSON result
json_result="["

if [[ -n "$all_directories" ]]; then # Check if all_directories is not an empty string
while read -r dir; do
if [[ -n "$dir" ]]; then # Check if dir is not an empty string
if ! is_excluded "$dir"; then
json_result+=$(generate_json "$dir")
json_result+=","
fi
fi
done <<< "$(echo "$all_directories" | sort)" # Feed sorted directories into the loop

# Remove the trailing comma from the json_result, if necessary
json_result="${json_result%,}"
fi

# Remove the last comma and close the JSON array
json_result=$(echo "$json_result" | sed '$ s/,$//')
json_result=$(echo "$json_result" | sed ':a;N;$!ba;s/\n//g') # Remove new lines
json_result+="]"

# Store the result in a variable (you can use it as needed)
result="$json_result"
result="${result//'%'/'%25'}"
result="${result//$'\n'/'%0A'}"
result="${result//$'\r'/'%0D'}"

# Print the result if needed
echo "$result" | base64
File renamed without changes.
84 changes: 84 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
name: Release
on:
push:
branches:
- main
pull_request: # Runs on pull requests to any branch
env:
DFX_VERSION: 0.21.0
NODE_VERSION: 20
jobs:
get-tests:
if: ${{ contains(github.head_ref, 'release--') }}
name: Get tests
runs-on: ubuntu-latest
outputs:
tests: ${{ steps.get_tests.outputs.tests }}
steps:
- uses: actions/checkout@v4

- name: Get all test dirs
id: get_tests
uses: ./.github/actions/get_tests
with:
directories: |
./examples
./tests

determine-should-release:
if: ${{ contains(github.head_ref, 'release--') }}
name: Determine if this branch should release
runs-on: ubuntu-latest
outputs:
should_release: ${{ steps.determine_should_release.outputs.should_release }}
steps:
- uses: actions/checkout@v4

- id: determine_should_release
uses: ./.github/actions/should_release

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
if: ${{ needs.determine-should-release.outputs.should_release }}
needs:
- get-tests
- determine-should-release
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 }}

- uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
registry-url: https://registry.npmjs.org
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

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

# 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 '[email protected]'
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}"
echo $RELEASE_VERSION
echo ${{toJson(needs.get-tests.outputs.tests.*.path)}}
./.github/scripts/publish_github_action.sh $RELEASE_VERSION ${{ toJSON(needs.get-tests.outputs.tests.*.path) }}
Loading
Loading