Skip to content

Commit

Permalink
Merge pull request #2428 from demergent-labs/fix_bins
Browse files Browse the repository at this point in the history
use npm exec --offline for tsc and cuzz to attempt a solution that wi…
  • Loading branch information
lastmjs authored Jan 6, 2025
2 parents 52cbdd7 + bf2d50a commit ea8f365
Show file tree
Hide file tree
Showing 9 changed files with 18 additions and 57 deletions.
43 changes: 5 additions & 38 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,42 +4,12 @@ on:
inputs:
release-version:
required: true
exclude-slow-tests:
description: 'Exclude slow tests'
required: true
type: boolean
default: false
exclude-unstable-tests:
description: 'Exclude unstable tests'
required: true
type: boolean
default: false
exclude-release-only-tests:
description: 'Exclude release tests'
required: true
type: boolean
default: false
signing-key-id:
required: true
type: string
default: C8B77BCBE16CD2B94B43F9C8757397B82D4ED7B0

jobs:
get-exclude-dirs:
name: Get exclude directories
runs-on: ubuntu-latest
outputs:
exclude-dirs: ${{ steps.get-exclude-dirs.outputs.exclude-dirs }}
steps:
- uses: actions/checkout@v4

- id: get-exclude-dirs
uses: ./.github/actions/get_exclude_dirs
with:
exclude-slow: ${{ github.event.inputs.exclude-slow-tests }}
exclude-unstable: ${{ github.event.inputs.exclude-unstable-tests }}
exclude-release-only: ${{ github.event.inputs.exclude-release-only-tests }}

create-branch-prefix:
uses: ./.github/workflows/create_branch_prefix.yml
with:
Expand All @@ -52,7 +22,6 @@ jobs:
prepare-release:
name: Prepare Release
needs:
- get-exclude-dirs
- create-branch-prefix
runs-on: ubuntu-latest
env:
Expand Down Expand Up @@ -111,9 +80,7 @@ jobs:
- id: get-test-infos
uses: ./.github/actions/get_test_infos
with:
directories: |
./examples
exclude-dirs: ${{ needs.get-exclude-dirs.outputs.exclude-dirs }}
directories: ./examples

update-test-files-for-release-commit:
needs:
Expand Down Expand Up @@ -152,10 +119,10 @@ jobs:
working-directory: ${{ matrix.test.path }}
run: dfx start --clean --background --host 127.0.0.1:8000 --artificial-delay 0

- name: Run npm test (continue on error)
working-directory: ${{ matrix.test.path }}
continue-on-error: true
run: npm test
# TODO we would like to also update the Candid files
# TODO what we should do is detect if there is a Candid file to generate
# TODO probably by looking at the dfx.json candid property of any azle canisters
# TODO if that is defined and if it does not go to .azle, we should probably generate it

- name: Create branch name
id: create-branch-name
Expand Down
4 changes: 1 addition & 3 deletions package-lock.json

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

4 changes: 1 addition & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,7 @@
},
"type": "module",
"bin": {
"azle": "./src/build/index.ts",
"cuzz": "./node_modules/.bin/cuzz",
"tsc": "./node_modules/.bin/tsc"
"azle": "./src/build/index.ts"
},
"main": "./src/lib/stable/index.ts",
"repository": {
Expand Down
2 changes: 1 addition & 1 deletion src/lib/experimental/globals.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import './experimental';
import '../stable/globals'; // We import this to remove type errors having to do with the stable and experimental globals

// @ts-expect-error
// @ts-ignore
import { TextDecoder, TextEncoder } from '@sinonjs/text-encoding';
import { Buffer } from 'buffer';
import * as process from 'process';
Expand Down
2 changes: 1 addition & 1 deletion src/lib/stable/globals.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// @ts-expect-error
// @ts-ignore
import { TextDecoder, TextEncoder } from '@sinonjs/text-encoding';

import { AzleIcExperimental } from '../experimental/ic/azle_ic_experimental';
Expand Down
2 changes: 1 addition & 1 deletion src/lib/stable/ic_apis/reject_code.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// TODO this should be removed once https://github.com/demergent-labs/azle/issues/2271 is resolved
// @ts-expect-error
// @ts-ignore
import { TextDecoder, TextEncoder } from '@sinonjs/text-encoding';
globalThis.TextDecoder = TextDecoder;
globalThis.TextEncoder = TextEncoder;
Expand Down
2 changes: 1 addition & 1 deletion src/lib/stable/stable_structures/stable_json.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Principal } from '@dfinity/principal';
// @ts-expect-error
// @ts-ignore
import { TextDecoder, TextEncoder } from '@sinonjs/text-encoding';

import { Serializable } from './stable_b_tree_map';
Expand Down
6 changes: 5 additions & 1 deletion test/fuzz.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,10 @@ function getCallDelay(cuzzConfig: CuzzConfig): string {

function fuzzTestCanister(canisterName: string, callDelay: string): void {
const baseCuzzArgs = [
'exec',
'--offline',
'cuzz',
'--',
'--canister-name',
canisterName,
'--skip-deploy',
Expand All @@ -69,7 +73,7 @@ function fuzzTestCanister(canisterName: string, callDelay: string): void {
: [])
];

let cuzzProcess = spawn('node_modules/.bin/cuzz', cuzzArgs, {
let cuzzProcess = spawn('npm', cuzzArgs, {
stdio: 'inherit'
});

Expand Down
10 changes: 2 additions & 8 deletions test/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ dns.setDefaultResultOrder('ipv4first');

import { describe, expect, test } from '@jest/globals';
import * as fc from 'fast-check';
import { join } from 'path';

import { execSyncPretty } from '../src/build/stable/utils/exec_sync_pretty';
export { expect } from '@jest/globals';
Expand All @@ -17,7 +16,7 @@ export { getCanisterActor } from './get_canister_actor';
export function runTests(
tests: Test,
canisterNames: string | string[] | undefined = undefined,
cwd: string = process.cwd()
_cwd: string = process.cwd()
): void {
const {
shouldRunTests,
Expand All @@ -35,12 +34,7 @@ export function runTests(
it('checks types', () => {
try {
execSyncPretty(
`${join(
cwd,
'node_modules',
'.bin',
'tsc'
)} --noEmit --skipLibCheck --target es2020 --strict --moduleResolution node --allowJs`,
`npm exec --offline tsc -- --noEmit --skipLibCheck --target es2020 --strict --moduleResolution node --allowJs`,
'inherit'
);
} catch {
Expand Down

0 comments on commit ea8f365

Please sign in to comment.