Skip to content

Commit

Permalink
Merge pull request #2136 from demergent-labs/update_release_process
Browse files Browse the repository at this point in the history
Update release process
  • Loading branch information
lastmjs authored Sep 23, 2024
2 parents 17dd175 + 0a8902a commit 70015f2
Show file tree
Hide file tree
Showing 16 changed files with 183 additions and 92 deletions.
24 changes: 24 additions & 0 deletions .github/actions/get_dfx_version/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
## 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. Additionally, rerunning a checkout at this stage could potentially
overwrite any earlier `actions/checkout` step with different parameters, such as
checking out a specific branch.

## Example Usage

```yaml
steps:
- uses: actions/checkout@v4

- id: get-dfx-version
uses: ./.github/actions/get_dfx_version

- run: echo ${{ steps.get-dfx-version.outputs.dfx-version }}
```
2 changes: 0 additions & 2 deletions .github/actions/get_dfx_version/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ outputs:
runs:
using: composite
steps:
- uses: actions/checkout@v4

- id: get-dfx-version
run: |
DFX_VERSION=$(jq -r '.azle.globalDependencies.dfx // error("dfx version not found")' "package.json")
Expand Down
24 changes: 24 additions & 0 deletions .github/actions/get_node_version/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
## 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. Additionally, rerunning a checkout at this stage could potentially
overwrite any earlier `actions/checkout` step with different parameters, such as
checking out a specific branch.

## Example Usage

```yaml
steps:
- uses: actions/checkout@v4

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

- run: echo "${{ steps.get-node-version.outputs.node-version }}"
```
2 changes: 0 additions & 2 deletions .github/actions/get_node_version/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ outputs:
runs:
using: composite
steps:
- uses: actions/checkout@v4

- id: get-node-version
run: |
NODE_VERSION=$(jq -r '.azle.globalDependencies.node // error("node version not found")' "package.json")
Expand Down
28 changes: 28 additions & 0 deletions .github/actions/get_test_infos/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
## 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. Additionally, rerunning a checkout at this stage could potentially
overwrite any earlier `actions/checkout` step with different parameters, such as
checking out a specific branch.

## Example Usage

```yaml
steps:
- uses: actions/checkout@v4

- 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'

- run: echo "${{ steps.get-test-infos.outputs.test-infos }}"
```
2 changes: 0 additions & 2 deletions .github/actions/get_test_infos/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@ outputs:
runs:
using: composite
steps:
- uses: actions/checkout@v4

- uses: actions/setup-node@v4
with:
node-version: ${{ inputs.node-version }}
Expand Down
19 changes: 19 additions & 0 deletions .github/actions/should_release/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
> [!IMPORTANT]
> This action performs a checkout using `actions/checkout@v4`, specifically
> checking out the `github.event.pull_request.head.ref`. If your workflow
> includes other checkout steps, be mindful that this checkout will override
> previous checkouts, as it checks out a specific branch for the action to
> function correctly. You should consider this when planning future steps in
> your workflow, especially if those steps rely on a different commit or branch.
## Example Usage

```yaml
steps:
- uses: actions/checkout@v4

- id: should-release
uses: ./.github/actions/should_release

- run: echo "${{ steps.should-release.outputs.should-release }}"
```
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ jobs:

- name: Install dfx
run: |
# Install dfx (Note: DFX must be installed before `npx azle` because the azle instalation process requires dfx)
# 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
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ jobs:
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
') }}"
SLOW_TESTS="${{ format('
Expand Down
6 changes: 1 addition & 5 deletions examples/ckbtc/wallet/backend/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,7 @@
// better using the latest Wasm and did that I know of

import { call, caller, id, IDL, Principal, update } from 'azle';
import {
Account,
TransferArgs,
TransferResult
} from 'azle/canisters/icrc/icrc_1';
import { Account, TransferArgs, TransferResult } from 'azle/canisters/icrc_1';

import {
GetBtcAddressArgs,
Expand Down
34 changes: 34 additions & 0 deletions scripts/setup_release_branch.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#!/bin/bash

set -e

LATEST_VERSION=$(npm view azle dist-tags.next)

# Check if the version is in the format of "0.X.X-rc.Y"
if [[ "$LATEST_VERSION" =~ ^([0-9]+\.[0-9]+\.[0-9]+)-rc\.([0-9]+)$ ]]; then
VERSION_BASE="${BASH_REMATCH[1]}" # e.g., "0.24.2"
RC_NUMBER="${BASH_REMATCH[2]}" # e.g., "17"

# Increment the RC number
NEXT_RC_NUMBER=$((RC_NUMBER + 1))

# Construct the next version
VERSION="${VERSION_BASE}-rc.${NEXT_RC_NUMBER}"
else
# TODO when this case comes up write code for it accordingly. I just don't know what it looks like at this point
echo "No matching rc version found, or version format incorrect."
exit 1
fi


BRANCH="release--$VERSION"

git switch -c "$BRANCH"

sed -E -i "s/(\"version\": \")(.*)(\")/\1$VERSION\3/" package.json
sed -E -i "s/(\"version\": \")(.*)(\")/\1$VERSION\3/" dfx_extension/extension.json

npm install

git commit -am "$BRANCH"
git push origin "$BRANCH"
1 change: 1 addition & 0 deletions tests/end_to_end/http_server/large_files/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
module.exports = {
preset: 'ts-jest',
testEnvironment: 'node',
testTimeout: 100_000_000,
transform: {
'^.+\\.ts$': ['ts-jest', { isolatedModules: true }],
'^.+\\.js$': 'ts-jest'
Expand Down
3 changes: 1 addition & 2 deletions tests/end_to_end/http_server/large_files/test/auto_tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,7 @@ export function generateFiles(): Test {
`generate file: ${getAutoGeneratedFileName(size, units)}`,
async () => {
await generateTestFileOfSize(size, units);
},
10 * 60 * 1_000
}
);
}
);
Expand Down
26 changes: 8 additions & 18 deletions tests/end_to_end/http_server/large_files/test/huge_file_tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,27 +21,17 @@ export function hugeFilesTests(origin: string): Test {
'generate huge files',
(size, units) => {
const fileName = getAutoGeneratedFileName(size, units);
please(
`generate huge file: ${fileName}`,
async () => {
await generateTestFileOfSize(size, units);
},
// TODO fix these numbers when we know them better
(10 + 20 + 40) * 60 * 1_000
);
please(`generate huge file: ${fileName}`, async () => {
await generateTestFileOfSize(size, units);
});
}
);

please(
'redeploy the canister to reupload',
async () => {
execSync(`dfx deploy --upgrade-unchanged`, {
stdio: 'inherit'
});
},
(40 + 40) * 60 * 1_000
// TODO fix these numbers when we know them better
);
please('redeploy the canister to reupload', async () => {
execSync(`dfx deploy --upgrade-unchanged`, {
stdio: 'inherit'
});
});

describe.each(hugeAutoGenAutoUploadFileInfos)(
'verify huge files were uploaded correctly',
Expand Down
46 changes: 19 additions & 27 deletions tests/end_to_end/http_server/large_files/test/manual_tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,42 +22,34 @@ export function manualTests(origin: string): Test {
'prepare auto generated files locally for manual upload',
(size, units) => {
const fileName = getAutoGeneratedFileName(size, units);
please(
`generate file: ${fileName}`,
async () => {
await generateTestFileOfSize(size, units, 'manual');
},
10 * 60 * 1_000
);
please(`generate file: ${fileName}`, async () => {
await generateTestFileOfSize(size, units, 'manual');
});
}
);

describe.each(autoGenManualUploadFileInfos)(
'initial manual upload of auto files',
(size, units) => {
const fileName = getAutoGeneratedFileName(size, units);
it(
'manually uploads files via azle command',
async () => {
execSync(
`node_modules/.bin/azle upload-assets backend ${join(
'assets',
'manual',
fileName
)} assets/${fileName}`,
{
stdio: 'inherit'
}
);
it('manually uploads files via azle command', async () => {
execSync(
`node_modules/.bin/azle upload-assets backend ${join(
'assets',
'manual',
fileName
)} assets/${fileName}`,
{
stdio: 'inherit'
}
);

const response = await fetch(
`${origin}/exists?path=assets/${fileName}`
);
const response = await fetch(
`${origin}/exists?path=assets/${fileName}`
);

expect(await response.json()).toBe(true);
},
10 * 60 * 1_000
);
expect(await response.json()).toBe(true);
});
}
);

Expand Down
54 changes: 21 additions & 33 deletions tests/end_to_end/http_server/large_files/test/tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,11 @@ export function getTests(canisterId: string): Test {

// Now that the files are generated locally, deploy the canister (which will upload the files to the canister)
// This initial deploy is here instead of in pretest so that we can time how long the deploy takes
please(
'deploy the canister',
() => {
execSync(`dfx deploy`, {
stdio: 'inherit'
});
},
15 * 60 * 1_000
);
please('deploy the canister', () => {
execSync(`dfx deploy`, {
stdio: 'inherit'
});
});

describe('authorization tests', getAuthorizationTests());

Expand All @@ -55,18 +51,14 @@ export function getTests(canisterId: string): Test {
);

describeLongTest('redeploy while only uploading modified files', () => {
please(
'modify files and redeploy',
async () => {
await generateTestFileOfSize(1, 'KiB');
await generateTestFileOfSize(10, 'KiB');
await generateTestFileOfSize(100, 'KiB');
execSync(`dfx deploy --upgrade-unchanged`, {
stdio: 'inherit'
});
},
15 * 60 * 1_000
);
please('modify files and redeploy', async () => {
await generateTestFileOfSize(1, 'KiB');
await generateTestFileOfSize(10, 'KiB');
await generateTestFileOfSize(100, 'KiB');
execSync(`dfx deploy --upgrade-unchanged`, {
stdio: 'inherit'
});
});

describe(
'verify files specified in dfx.json exist after redeploy',
Expand All @@ -75,18 +67,14 @@ export function getTests(canisterId: string): Test {
});

describe('redeploy with no upload', () => {
please(
'redeploy with no upload',
async () => {
execSync(
`AZLE_DISABLE_AUTO_FILE_UPLOAD=true dfx deploy --upgrade-unchanged`,
{
stdio: 'inherit'
}
);
},
1 * 60 * 1_000
);
please('redeploy with no upload', async () => {
execSync(
`AZLE_DISABLE_AUTO_FILE_UPLOAD=true dfx deploy --upgrade-unchanged`,
{
stdio: 'inherit'
}
);
});

describe(
'verify files specified in dfx.json exist after redeploy even with file uploading disabled',
Expand Down

0 comments on commit 70015f2

Please sign in to comment.