forked from apache/incubator-kie-tools
-
Notifications
You must be signed in to change notification settings - Fork 0
106 lines (93 loc) · 3.47 KB
/
monorepo_pr_ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
name: "CI :: Monorepo"
on:
pull_request:
branches: "**"
paths:
- "packages/**"
concurrency:
group: monorepo-pr-ci-${{ github.event.pull_request.number }}
cancel-in-progress: true
jobs:
monorepo-pr-ci:
if: github.event.pull_request.draft == false
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- name: "Support longpaths"
if: matrix.os == 'windows-latest'
run: git config --system core.longpaths true
- name: "Checkout"
uses: actions/checkout@v2
with:
fetch-depth: 0
ref: ${{ github.base_ref }}
- name: "Cache Maven packages"
uses: actions/cache@v2
with:
path: ~/.m2
key: ${{ runner.os }}-ci-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-ci-m2
- name: "Setup kogito-tooling-bot"
uses: ./.github/actions/setup-kogito-tooling-bot
- name: "Merge Changes"
shell: bash
run: |
user=$(node -e "console.log('${{ github.event.pull_request.head.label }}'.match(/(.+)\:(.+)$/)[1])")
git remote add $user https://github.com/$user/kogito-tooling.git
git fetch $user
git merge --squash $user/${{ github.head_ref }}
- name: "Setup environment"
uses: ./.github/actions/setup-env
with:
os: ${{ matrix.os }}
- name: "Build dependencies"
shell: bash
env:
KOGITO_TOOLING_BUILD_examples: "true"
run: |
export REF=${{ github.event.pull_request.base.sha }} &&
export SCOPE=$(diff <(echo "$(lerna ls --since $REF --include-dependencies --all | cut -d' ' -f1)") <(echo "$(lerna ls --since $REF --all | cut -d' ' -f1)") --changed-group-format='%<%>' --unchanged-group-format='' | xargs -I{} echo -n ' --scope="{}"') &&
echo $REF $SCOPE &&
yarn run-script-if --silent --env SCOPE --eq "" \
--then "echo No dependencies to build." \
--else "lerna run --stream --concurrency 1 build:dev $SCOPE"
- name: "Build changed and dependents"
env:
WEBPACK__minimize: "false"
KOGITO_TOOLING_BUILD_lint: "true"
KOGITO_TOOLING_BUILD_test: "true"
KOGITO_TOOLING_BUILD_testIT: ${{ matrix.os == 'ubuntu-latest' }}
KOGITO_TOOLING_BUILD_docker: "true"
KOGITO_TOOLING_BUILD_examples: "true"
DISPLAY: ":99.0"
START_SERVER_AND_TEST_INSECURE: "true"
run: |
lerna run build:prod --stream --concurrency 1 --since ${{ github.event.pull_request.base.sha }}
- name: "Check generated resources (you should commit those!)"
shell: bash
run: |
git diff
[ "0" == "$(git diff | wc -l | tr -d ' ')" ]
- name: "Upload build artifacts"
uses: actions/upload-artifact@v2
if: always() && !cancelled()
with:
name: artifacts-${{ matrix.os }}
if-no-files-found: warn
path: |
packages/*/dist
packages/hub/out/*.zip
packages/desktop/out/*.zip
!packages/hub/dist
!packages/desktop/dist
- name: "Upload IT Tests artifacts"
uses: actions/upload-artifact@v2
if: always() && !cancelled()
with:
name: it-tests-artifacts-${{ matrix.os }}
if-no-files-found: warn
path: |
packages/*/dist-it-tests