Skip to content

Commit

Permalink
Test
Browse files Browse the repository at this point in the history
  • Loading branch information
tiagobento committed Apr 28, 2024
1 parent 0694167 commit 0f484d7
Show file tree
Hide file tree
Showing 10 changed files with 510 additions and 224 deletions.
76 changes: 22 additions & 54 deletions .github/workflows/ci_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-13, windows-latest]
partition: [0, 1]
runs-on: ${{ matrix.os }}
steps:
- name: "Support longpaths"
Expand All @@ -40,47 +41,31 @@ jobs:
id: ci_patterns
uses: ./.github/actions/setup-ci-patterns

- name: "Setup environment"
uses: ./.github/actions/setup-env

- name: "Setup build mode {none,full,partial}"
id: setup_build_mode
shell: bash
run: |
export CHANGED_SOURCE_PATHS=($(eval "git diff --name-only ${{ steps.checkout_pr.outputs.base_sha }} ${{ steps.checkout_pr.outputs.head_sha }} -- ${{ steps.ci_patterns.outputs.non_source_files_patterns_for_git_diff }}"))
echo "Changed source paths:"
echo ${#CHANGED_SOURCE_PATHS[@]}
printf '%s\n' "${CHANGED_SOURCE_PATHS[@]}"
export CHANGED_SOURCE_PATHS_IN_ROOT=($(printf '%s\n' "${CHANGED_SOURCE_PATHS[@]}" | grep -v -e "^packages" -e "^examples"))
echo "Changed source paths in root:"
echo ${#CHANGED_SOURCE_PATHS_IN_ROOT[@]}
printf '%s\n' "${CHANGED_SOURCE_PATHS_IN_ROOT[@]}"
if [ ${#CHANGED_SOURCE_PATHS[@]} -eq 0 ]; then
echo 'No source files changed; `CI :: Build` (none) will run.'
echo "mode=none" >> $GITHUB_OUTPUT
elif [ ! ${{ github.event.pull_request }} ]; then
echo 'Push to the `main` branch happened; `CI :: Build` (full) will run.'
echo "mode=full" >> $GITHUB_OUTPUT
elif [ ${#CHANGED_SOURCE_PATHS_IN_ROOT[@]} -eq 0 ]; then
echo 'No source files changed in root; `CI :: Build` (partial) will run.'
echo "mode=partial" >> $GITHUB_OUTPUT
else
echo 'Source files changed in root; `CI :: Build` (full) will run.'
echo "mode=full" >> $GITHUB_OUTPUT
fi
echo "Done"
- name: "Setup environment"
pnpm bootstrap:root
bun scripts/build-partitioning/src/build_partitioning.ts /tmp/partitions.json ${{ !github.event.pull_request }}
echo "mode=$(jq --raw-output '.[${{ matrix.partition }}].mode' /tmp/partitions.json)" >> $GITHUB_OUTPUT
echo "bootstrapPnpmFilterString=$(jq --raw-output '.[${{ matrix.partition }}].bootstrapPnpmFilterString' /tmp/partitions.json)" >> $GITHUB_OUTPUT
echo "fullBuildPnpmFilterString=$(jq --raw-output '.[${{ matrix.partition }}].fullBuildPnpmFilterString' /tmp/partitions.json)" >> $GITHUB_OUTPUT
echo "upstreamPnpmFilterString=$(jq --raw-output '.[${{ matrix.partition }}].upstreamPnpmFilterString' /tmp/partitions.json)" >> $GITHUB_OUTPUT
echo "selfAndDownstreamPnpmFilterString=$(jq --raw-output '.[${{ matrix.partition }}].selfAndDownstreamPnpmFilterString' /tmp/partitions.json)" >> $GITHUB_OUTPUT
echo "Done."
- name: "Bootstrap"
if: steps.setup_build_mode.outputs.mode != 'none'
uses: ./.github/actions/setup-env

- name: "FULL → Bootstrap"
if: steps.setup_build_mode.outputs.mode == 'full'
env:
PLAYWRIGHT_BASE__installDeps: "true"
uses: ./.github/actions/bootstrap
with:
pnpm_filter_string: ${{ steps.setup_build_mode.outputs.bootstrapPnpmFilterString }}

- name: "FULL → Build (without SWF Stack)"
- name: "FULL → Build"
if: steps.setup_build_mode.outputs.mode == 'full'
env:
WEBPACK__minimize: "false"
Expand All @@ -96,35 +81,18 @@ jobs:
START_SERVER_AND_TEST_INSECURE: "true"
NODE_OPTIONS: "--max_old_space_size=4096"
run: >-
pnpm
-F='!@kie-tools/serverless-logic-web-tools-swf-builder-image...'
-F='!@kie-tools/serverless-logic-web-tools-base-builder-image...'
-F='!@kie-tools/kn-plugin-workflow...'
-F='!@kie-tools/serverless-logic-web-tools...'
-r --workspace-concurrency=1 build:prod
- name: "PARTIAL → Bootstrap"
if: steps.setup_build_mode.outputs.mode == 'partial'
env:
PLAYWRIGHT_BASE__installDeps: "true"
uses: ./.github/actions/bootstrap
with:
pnpm_filter_string: -F "...[${{ steps.checkout_pr.outputs.base_sha }}]..." -F='!@kie-tools/serverless-logic-web-tools-swf-builder-image...' -F='!@kie-tools/serverless-logic-web-tools-base-builder-image...' -F='!@kie-tools/kn-plugin-workflow...' -F='!@kie-tools/serverless-logic-web-tools...'
eval "pnpm ${{ steps.setup_build_mode.outputs.fullBuildPnpmFilterString }} --workspace-concurrency=1 build:prod"
- name: "PARTIAL → Build dependencies"
- name: "PARTIAL → Build upstream"
if: steps.setup_build_mode.outputs.mode == 'partial'
shell: bash
env:
KIE_TOOLS_BUILD__buildContainerImages: ${{ runner.os != 'Windows' }}
KIE_TOOLS_BUILD__buildExamples: "true"
run: |
export ALL_DEPENDENCIES_FILTER=$(pnpm -F="...[${{ steps.checkout_pr.outputs.base_sha }}]" exec bash -c 'echo -n " -F=$(jq --raw-output .name package.json)^..."')
export CHANGED_PKGS_EXCLUSION_FILTER=$(pnpm -F="...[${{ steps.checkout_pr.outputs.base_sha }}]" exec bash -c 'echo -n " -F='"'"'!$(jq --raw-output .name package.json)'"'"'"')
echo $ALL_DEPENDENCIES_FILTER
echo $CHANGED_PKGS_EXCLUSION_FILTER
eval "pnpm $ALL_DEPENDENCIES_FILTER $CHANGED_PKGS_EXCLUSION_FILTER -F='!@kie-tools/serverless-logic-web-tools-swf-builder-image...' -F='!@kie-tools/serverless-logic-web-tools-base-builder-image...' -F='!@kie-tools/kn-plugin-workflow...' -F='!@kie-tools/serverless-logic-web-tools...' build:dev"
eval "pnpm ${{ steps.setup_build_mode.outputs.upstreamPnpmFilterString }} build:dev"
- name: "PARTIAL → Build changed and dependents"
- name: "PARTIAL → Build changed and downstream"
if: steps.setup_build_mode.outputs.mode == 'partial'
env:
WEBPACK__minimize: "false"
Expand All @@ -137,7 +105,7 @@ jobs:
START_SERVER_AND_TEST_INSECURE: "true"
NODE_OPTIONS: "--max_old_space_size=4096"
run: |
pnpm -F "...[${{ steps.checkout_pr.outputs.base_sha }}]" -F='!@kie-tools/serverless-logic-web-tools-swf-builder-image...' -F='!@kie-tools/serverless-logic-web-tools-base-builder-image...' -F='!@kie-tools/kn-plugin-workflow...' -F='!@kie-tools/serverless-logic-web-tools...' --workspace-concurrency=1 build:prod
eval "pnpm ${{ steps.setup_build_mode.outputs.selfAndDownstreamPnpmFilterString }} --workspace-concurrency=1 build:prod"
- name: "Check tests result (`main` only)"
if: always() && !cancelled() && steps.setup_build_mode.outputs.mode != 'none'
Expand Down
168 changes: 0 additions & 168 deletions .github/workflows/ci_build_swf_stack.yml

This file was deleted.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"devDependencies": {
"@kie-tools-scripts/bootstrap": "workspace:*",
"@kie-tools-scripts/build-env": "workspace:*",
"@kie-tools-scripts/build-partitioning": "workspace:*",
"@kie-tools-scripts/check-junit-report-results": "workspace:*",
"@kie-tools-scripts/run-script-if": "workspace:*",
"@kie-tools-scripts/sparse-checkout": "workspace:*",
Expand All @@ -32,8 +33,7 @@
"react-dropzone": "^11.4.2"
},
"engines": {
"node": ">=18",
"pnpm": "8.7.0"
"node": ">=18"
},
"packageManager": "[email protected]",
"pnpm": {
Expand Down
Loading

0 comments on commit 0f484d7

Please sign in to comment.