Fix/pre release update #159
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Copyright (C) 2022 Dynamic Solutions | |
# | |
# Licensed under the Apache License, Version 2.0 (the "License"); | |
# you may not use this file except in compliance with the License. | |
# You may obtain a copy of the License at | |
# | |
# http://www.apache.org/licenses/LICENSE-2.0 | |
# | |
# Unless required by applicable law or agreed to in writing, software | |
# distributed under the License is distributed on an "AS IS" BASIS, | |
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
# See the License for the specific language governing permissions and | |
# limitations under the License. | |
name: Dev journey | |
on: | |
pull_request: | |
permissions: | |
id-token: write | |
contents: read | |
jobs: | |
dev-journey: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: '17' | |
distribution: 'adopt' | |
- name: Cache local Maven repository | |
uses: actions/cache@v3 | |
with: | |
path: ~/.m2/repository | |
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} | |
restore-keys: | | |
${{ runner.os }}-maven- | |
- name: Build and test with Maven | |
run: ./mvnw --batch-mode clean verify -P e2e | |
- name: Run environment | |
run: | | |
docker compose -f ./environment/local/docker-compose.yml up -d | |
sleep 10 | |
- name: Verify environment | |
run: | | |
curl 'http://localhost:8080/apps/websight-authentication/j_security_check' --data-raw '_charset_=UTF-8&resource=%2F&j_username=wsadmin&j_password=wsadmin' -ipv4 --cookie-jar websight.auth --retry-delay 1 --retry 10 | |
checkPage() { | |
echo "Check page $1" | |
if curl $1 -ipv4 --cookie websight.auth | grep 'Resource dumped by HtmlRenderer'; then | |
echo "Dumped resource found on $1" | |
exit 1 | |
fi | |
} | |
checkPage 'http://localhost:8080/content/luna/pages/Homepage.html' | |
checkPage 'http://localhost:8080/content/luna/pages/Products.html' | |
checkPage 'http://localhost:8080/content/luna/pages/Catalog.html' | |
checkPage 'http://localhost:8080/content/luna/pages/About-Us.html' | |
- name: Prepare project changes | |
run: | | |
echo "Update LunaTitleComponent.java" | |
sed -i '/^package pl.ds.luna.components.models;/a\ | |
\ | |
import javax.inject.Inject;' ./application/backend/src/main/java/pl/ds/luna/components/models/LunaTitleComponent.java | |
sed -i '/^import org.apache.sling.api.resource.Resource;/a\ | |
import org.apache.sling.models.annotations.Default;\ | |
' ./application/backend/src/main/java/pl/ds/luna/components/models/LunaTitleComponent.java | |
sed -i '/^public class LunaTitleComponent extends TitleComponent {/a\ | |
\ | |
@Inject\ | |
@Default(values = {"hl-title__heading--size-5"})\ | |
private String overlineSize;\ | |
\ | |
public String getOverlineSize(){\ | |
return overlineSize;\ | |
}\ | |
' ./application/backend/src/main/java/pl/ds/luna/components/models/LunaTitleComponent.java | |
echo "Update title.json" | |
sed -i '/"headingSize": "hl-title__heading--size-1"/a\ | |
"overlineSize": "hl-title__heading--size-3",\ | |
' ./application/backend/src/test/resources/title.json | |
echo "Update LunaTitleComponentTest.java" | |
sed -i '/assertThat(model.getHeadingSize()).isEqualTo("hl-title__heading--size-4");/a\ | |
assertThat(model.getOverlineSize()).isEqualTo("hl-title__heading--size-5");\ | |
' ./application/backend/src/test/java/pl/ds/luna/components/models/LunaTitleComponentTest.java | |
sed -i '/assertThat(model.getHeadingSize()).isEqualTo("hl-title__heading--size-1");/a\ | |
assertThat(model.getOverlineSize()).isEqualTo("hl-title__heading--size-3");\ | |
' ./application/backend/src/test/java/pl/ds/luna/components/models/LunaTitleComponentTest.java | |
echo "Update lunatitle.html" | |
sed -i 's/hl-title__heading--size-6/${model.overlineSize}/g' ./application/backend/src/main/resources/apps/luna/components/lunatitle/lunatitle.html | |
echo "Add dialog" | |
mkdir -p ./application/backend/src/main/resources/apps/luna/components/lunatitle/dialog | |
echo '{ | |
"tabs": { | |
"generalTab": { | |
"container": { | |
"overlineSize": { | |
"sling:resourceType": "wcm/dialogs/components/include", | |
"sling:orderBefore": "overline", | |
"path": "/libs/howlite/components/common/headingsize", | |
"include": { | |
"sling:resourceSuperType": "/libs/howlite/components/common/headingsize", | |
"label": "Overline size", | |
"name": "overlineSize", | |
"description": "Changes font size", | |
"s": { | |
"selected": true | |
}, | |
"m": { | |
"selected": false | |
} | |
} | |
} | |
} | |
} | |
} | |
}' > ./application/backend/src/main/resources/apps/luna/components/lunatitle/dialog/.content.json | |
- name: Install changes | |
run: | | |
./mvnw -f ./application/backend/pom.xml clean install -P autoInstallBundle | |
- name: Validate if functional tests detect changes | |
run: | | |
./mvnw -f ./tests/content/pom.xml clean install -P autoInstallPackage | |
if npm run-script test --prefix tests/end-to-end | grep "1 of [0-9]* failed"; then | |
echo "Project changes detected" | |
else | |
echo "Project changes not detected" | |
exit 1 | |
fi | |
- name: Update functional tests | |
run: | | |
sed -i "/have.css/s/20px/25.008px/g" ./tests/end-to-end/tests/lunatitle.cy.ts | |
sed -i "/showSubtitle:/a\ | |
overlineSize: 'hl-title__heading--size-5',\ | |
" ./tests/end-to-end/tests/lunatitle.cy.ts | |
./mvnw -f ./tests/content/pom.xml clean install -P autoInstallPackage | |
- name: Validate functional tests | |
run: | | |
npm run-script test --prefix ./tests/end-to-end | |
- name: Stop environment | |
if: always() | |
run: docker compose -f ./environment/local/docker-compose.yml down |