Skip to content

Commit

Permalink
Merge pull request #2377 from demergent-labs/simple_main_merge
Browse files Browse the repository at this point in the history
shorten main from feature pr merge tests
  • Loading branch information
lastmjs authored Dec 20, 2024
2 parents 34f8375 + d1f34e5 commit d72f0ad
Show file tree
Hide file tree
Showing 14 changed files with 35 additions and 25 deletions.
4 changes: 2 additions & 2 deletions .github/actions/determine_workflow_config/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ runs:
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 Down
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
14 changes: 7 additions & 7 deletions .github/workflows/run_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ jobs:
ETHEREUM_URL: ${{ secrets.ETHEREUM_URL }}
AZLE_IDENTITY_STORAGE_MODE: 'plaintext'
AZLE_END_TO_END_TEST_LINK_AZLE: ${{ matrix.azle_source == 'repo' }}
AZLE_IS_MAIN_BRANCH_PUSH: ''
AZLE_IS_MAIN_BRANCH_PUSH_FROM_FEATURE_MERGE: ''
AZLE_IS_MAIN_BRANCH_PUSH_FROM_RELEASE_MERGE: ''
AZLE_IS_RELEASE_BRANCH_PR: ''
AZLE_IS_FEATURE_BRANCH_PR: ''
Expand All @@ -75,15 +75,15 @@ jobs:

- name: Set condition environment variables
run: |
echo "AZLE_IS_MAIN_BRANCH_PUSH=${{ steps.set-conditions.outputs.is_main_branch_push }}" >> $GITHUB_ENV
echo "AZLE_IS_MAIN_BRANCH_PUSH_FROM_FEATURE_MERGE=${{ steps.set-conditions.outputs.is_main_branch_push_from_feature_merge }}" >> $GITHUB_ENV
echo "AZLE_IS_MAIN_BRANCH_PUSH_FROM_RELEASE_MERGE=${{ steps.set-conditions.outputs.is_main_branch_push_from_release_merge }}" >> $GITHUB_ENV
echo "AZLE_IS_RELEASE_BRANCH_PR=${{ steps.set-conditions.outputs.is_release_branch_pr }}" >> $GITHUB_ENV
echo "AZLE_IS_FEATURE_BRANCH_PR=${{ steps.set-conditions.outputs.is_feature_branch_pr }}" >> $GITHUB_ENV
echo "AZLE_IS_FEATURE_BRANCH_DRAFT_PR=${{ steps.set-conditions.outputs.is_feature_branch_draft_pr }}" >> $GITHUB_ENV
- name: Print environment variables
run: |
echo "AZLE_IS_MAIN_BRANCH_PUSH: $AZLE_IS_MAIN_BRANCH_PUSH"
echo "AZLE_IS_MAIN_BRANCH_PUSH_FROM_FEATURE_MERGE: $AZLE_IS_MAIN_BRANCH_PUSH_FROM_FEATURE_MERGE"
echo "AZLE_IS_MAIN_BRANCH_PUSH_FROM_RELEASE_MERGE: $AZLE_IS_MAIN_BRANCH_PUSH_FROM_RELEASE_MERGE"
echo "AZLE_IS_RELEASE_BRANCH_PR: $AZLE_IS_RELEASE_BRANCH_PR"
echo "AZLE_IS_FEATURE_BRANCH_PR: $AZLE_IS_FEATURE_BRANCH_PR"
Expand Down Expand Up @@ -119,12 +119,12 @@ jobs:
working-directory: ${{ matrix.test.path }}

- name: Start dfx with artificial delay 0
if: ${{ steps.set-conditions.outputs.is_feature_branch_pr == 'true' || steps.set-conditions.outputs.is_feature_branch_draft_pr == 'true' }}
if: ${{ steps.set-conditions.outputs.is_feature_branch_pr == 'true' || steps.set-conditions.outputs.is_feature_branch_draft_pr == 'true' || steps.set-conditions.outputs.is_main_branch_push_from_feature_merge == 'true' }}
working-directory: ${{ matrix.test.path }}
run: dfx start --clean --background --host 127.0.0.1:8000 --artificial-delay 0

- name: Start dfx
if: ${{ steps.set-conditions.outputs.is_release_branch_pr == 'true' || steps.set-conditions.outputs.is_main_branch_push == 'true' || steps.set-conditions.outputs.is_main_branch_push_from_release_merge == 'true' }}
if: ${{ steps.set-conditions.outputs.is_release_branch_pr == 'true' || steps.set-conditions.outputs.is_main_branch_push_from_release_merge == 'true' }}
working-directory: ${{ matrix.test.path }}
run: dfx start --clean --background --host 127.0.0.1:8000

Expand All @@ -133,8 +133,8 @@ jobs:
run: |
RUNS=1
if [[ "${{ steps.set-conditions.outputs.is_main_branch_push }}" == "true" ]]; then
RUNS=100
if [[ "${{ steps.set-conditions.outputs.is_main_branch_push_from_feature_merge }}" == "true" ]]; then
RUNS=5
fi
if [[ "${{ steps.set-conditions.outputs.is_main_branch_push_from_release_merge }}" == "true" ]]; then
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ const autoGenAutoUploadSmallFileInfos: [number, Unit][] = [

const autoGenAutoUploadFileInfos: [number, Unit][] =
process.env.AZLE_IS_FEATURE_BRANCH_PR === 'true' ||
process.env.AZLE_IS_FEATURE_BRANCH_DRAFT_PR === 'true'
process.env.AZLE_IS_FEATURE_BRANCH_DRAFT_PR === 'true' ||
process.env.AZLE_IS_MAIN_BRANCH_PUSH_FROM_FEATURE_MERGE === 'true'
? autoGenAutoUploadSmallFileInfos
: [
...autoGenAutoUploadSmallFileInfos,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ const hugeAutoGenAutoUploadSmallFileInfos: [number, Unit][] = [[0, 'GiB']]; // T

const hugeAutoGenAutoUploadFileInfos: [number, Unit][] =
process.env.AZLE_IS_FEATURE_BRANCH_PR === 'true' ||
process.env.AZLE_IS_FEATURE_BRANCH_DRAFT_PR === 'true'
process.env.AZLE_IS_FEATURE_BRANCH_DRAFT_PR === 'true' ||
process.env.AZLE_IS_MAIN_BRANCH_PUSH_FROM_FEATURE_MERGE === 'true'
? hugeAutoGenAutoUploadSmallFileInfos
: [...hugeAutoGenAutoUploadSmallFileInfos, [2, 'GiB']]; // TODO add tests for 5GiB and maybe larger https://github.com/demergent-labs/azle/issues/2065

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ import { getAutoGeneratedFileName, verifyUpload } from './tests';
export function manualTests(origin: string): Test {
const manualFileSize =
process.env.AZLE_IS_FEATURE_BRANCH_PR === 'true' ||
process.env.AZLE_IS_FEATURE_BRANCH_DRAFT_PR === 'true'
process.env.AZLE_IS_FEATURE_BRANCH_DRAFT_PR === 'true' ||
process.env.AZLE_IS_MAIN_BRANCH_PUSH_FROM_FEATURE_MERGE === 'true'
? 7
: 150;
const autoGenManualUploadFileInfos: [number, Unit][] = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ export function getTests(canisterId: string): Test {
const origin = `http://${canisterId}.localhost:8000`;
const describeLongTest =
process.env.AZLE_IS_FEATURE_BRANCH_PR === 'true' ||
process.env.AZLE_IS_FEATURE_BRANCH_DRAFT_PR === 'true'
process.env.AZLE_IS_FEATURE_BRANCH_DRAFT_PR === 'true' ||
process.env.AZLE_IS_MAIN_BRANCH_PUSH_FROM_FEATURE_MERGE === 'true'
? describe.skip
: describe;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ const HeterogeneousUpdateMethodArb = UpdateMethodArb(

const arrayConstraints =
process.env.AZLE_IS_FEATURE_BRANCH_PR === 'true' ||
process.env.AZLE_IS_FEATURE_BRANCH_DRAFT_PR === 'true'
process.env.AZLE_IS_FEATURE_BRANCH_DRAFT_PR === 'true' ||
process.env.AZLE_IS_MAIN_BRANCH_PUSH_FROM_FEATURE_MERGE === 'true'
? shortArrayConstraints
: defaultArrayConstraints;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ const AllRecursiveQueryMethodArb = fc.oneof(

const arrayConstraints =
process.env.AZLE_IS_FEATURE_BRANCH_PR === 'true' ||
process.env.AZLE_IS_FEATURE_BRANCH_DRAFT_PR === 'true'
process.env.AZLE_IS_FEATURE_BRANCH_DRAFT_PR === 'true' ||
process.env.AZLE_IS_MAIN_BRANCH_PUSH_FROM_FEATURE_MERGE === 'true'
? shortArrayConstraints
: defaultArrayConstraints;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ const HeterogeneousUpdateMethodArb = UpdateMethodArb(

const arrayConstraints =
process.env.AZLE_IS_FEATURE_BRANCH_PR === 'true' ||
process.env.AZLE_IS_FEATURE_BRANCH_DRAFT_PR === 'true'
process.env.AZLE_IS_FEATURE_BRANCH_DRAFT_PR === 'true' ||
process.env.AZLE_IS_MAIN_BRANCH_PUSH_FROM_FEATURE_MERGE === 'true'
? shortArrayConstraints
: defaultArrayConstraints;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ const AllRecursiveQueryMethodArb = fc.oneof(

const arrayConstraints =
process.env.AZLE_IS_FEATURE_BRANCH_PR === 'true' ||
process.env.AZLE_IS_FEATURE_BRANCH_DRAFT_PR === 'true'
process.env.AZLE_IS_FEATURE_BRANCH_DRAFT_PR === 'true' ||
process.env.AZLE_IS_MAIN_BRANCH_PUSH_FROM_FEATURE_MERGE === 'true'
? shortArrayConstraints
: defaultArrayConstraints;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ const AllServicesQueryMethodArb = QueryMethodArb(

const arrayConstraints =
process.env.AZLE_IS_FEATURE_BRANCH_PR === 'true' ||
process.env.AZLE_IS_FEATURE_BRANCH_DRAFT_PR === 'true'
process.env.AZLE_IS_FEATURE_BRANCH_DRAFT_PR === 'true' ||
process.env.AZLE_IS_MAIN_BRANCH_PUSH_FROM_FEATURE_MERGE === 'true'
? shortArrayConstraints
: {
...defaultArrayConstraints,
Expand Down
3 changes: 2 additions & 1 deletion examples/stable/test/property/ic_api/chunk/test/tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ import { _SERVICE as Actor } from './dfx_generated/canister/canister.did';

const max =
process.env.AZLE_IS_FEATURE_BRANCH_PR === 'true' ||
process.env.AZLE_IS_FEATURE_BRANCH_DRAFT_PR === 'true'
process.env.AZLE_IS_FEATURE_BRANCH_DRAFT_PR === 'true' ||
process.env.AZLE_IS_MAIN_BRANCH_PUSH_FROM_FEATURE_MERGE === 'true'
? 80
: 200;

Expand Down

0 comments on commit d72f0ad

Please sign in to comment.