-
Notifications
You must be signed in to change notification settings - Fork 0
183 lines (150 loc) · 5.19 KB
/
build.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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
name: pipeline
env:
MAVEN_ARGS: -B -C -V -ntp -Dhttp.keepAlive=false -e
on:
push:
branches:
- '*'
tags:
- "*"
pull_request:
types: [ opened, synchronize, reopened ]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: write
pages: write
id-token: write
# Allow one concurrent deployment
concurrency:
group: ${{ github.ref }}
cancel-in-progress: true
jobs:
build:
if: "!contains(github.event.head_commit.message, 'skip ci')"
runs-on: ubuntu-latest
strategy:
max-parallel: 4
matrix:
java-version: [ 17 ]
python-version: [ '3.10' ]
node-version: [ 14 ]
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up jdk ${{ matrix.java-version }}
uses: actions/setup-java@v3
with:
distribution: 'adopt'
java-version: ${{ matrix.java-version }}
- uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- name: set up python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Get release notes
id: config
run: |
source <(curl -sL https://github.com/aem-design/aemdesign-docker/releases/latest/download/github_get_version.sh)
- name: Output release notes
run: |
echo "${{ steps.config.outputs.GIT_RELEASE_NOTES }}"
echo CURRENT_VERSION="${{ steps.config.outputs.CURRENT_VERSION }}"
- name: Cache maven packages
uses: actions/cache@v3.0.8
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Build Everything
run: |
mvn ${MAVEN_ARGS} clean install -DskipTests -Djacoco.skip=true
- name: Start the stack
run: |
cd environment/local
docker-compose up -d
- name: Wait for CMS to start
run: |
echo "Waiting for bundles to be installed"
export LOGIN="wsadmin:wsadmin"
export ADDRESS="http://0.0.0.0:8080"
export INSTALL_CHECK="/system/console/bundles.json"
echo "curl -u $LOGIN --header Referer:${ADDRESS} --silent --connect-timeout 5 --max-time 5 ${ADDRESS}${INSTALL_CHECK} | grep -q \"state\":\"Installed\" && echo true || echo false"
echo "Wait: "
echo -n "." ""
while [[ "true" == "$(curl -L -u "$LOGIN" --header "Referer:${ADDRESS}" --silent -N --connect-timeout 5 --max-time 5 "${ADDRESS}${INSTALL_CHECK}" | grep -q "\"state\":\"Installed\"" && echo true || echo false)" ]]; do
echo -n "." ""
$SLEEP 1
done
echo "" ""
echo "Bundles are installed"
# - name: Install test content
# run: |
# cd tests/content
# mvn clean install -P autoInstallPackage -Dsling.install.package.host=0.0.0.0 -Dsling.install.package.username=wsadmin -Dsling.install.package.password=wsadmin
# - name: Run Automation tests
# run: |
# cd tests/end-to-end
# npm install
# npm run test:ci
# npm run report:createHtml
# - name: Cypress run
# uses: cypress-io/github-action@v5
# with:
# config: pageLoadTimeout=250000,baseUrl=http://0.0.0.0:8080
# wait-on: "http://0.0.0.0:8080"
# project: tests/end-to-end
# install: false
# build: |
# npm install
# command: |
# npm run test:ci
# npm run report:createHtml
- name: Run Automation tests
run: |
cd environment/local
docker-compose --profile test up cmstest
- name: Stop the stack
run: |
cd environment/local
docker-compose down
- name: Automation test if failure
run: |
df
docker ps -a
cd environment/local
docker-compose down
if: failure()
- name: Setup Pages
uses: actions/configure-pages@v3
- name: Build with Jekyll
uses: actions/jekyll-build-pages@v1
with:
source: ./tests/end-to-end/cypress/reports/html/
destination: ./_site
- name: Upload artifact
uses: actions/upload-pages-artifact@v1
with:
path: tests/end-to-end/cypress/reports/html
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v1
- name: Zip Artifacts Folder
if: startsWith(github.ref, 'refs/tags/')
run: |
cd distribution/target/artifacts
zip -qq -r artifacts.zip .
- name: Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
token: ${{ secrets.GITHUB_TOKEN }}
fail_on_unmatched_files: false
generate_release_notes: true
files: |
artifacts.zip