Skip to content

[maven-release-plugin] prepare for next development iteration #191

[maven-release-plugin] prepare for next development iteration

[maven-release-plugin] prepare for next development iteration #191

# 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: 'CI: verify build'
on:
workflow_dispatch:
pull_request:
push:
branches:
- main
permissions:
id-token: write
contents: read
env:
APP_LC_FRONTEND_MODULE: applications/luna-low-code/frontend
APP_CC_FRONTEND_MODULE: applications/luna-custom-code/frontend
jobs:
verify-cms-docker-image:
name: Verify CMS Docker image
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Authenticate to Google Cloud
uses: google-github-actions/auth@v2
with:
workload_identity_provider: ${{ secrets.GCP_WEBSIGHT_RELEASES_WORKLOAD_IDENTITY_PROVIDER }}
service_account: ${{ secrets.GCP_WEBSIGHT_SNAPSHOTS_SNAPSHOT_READ_SA }}
- name: Build Docker image
uses: docker/build-push-action@v6
with:
load: true
tags: ds/websight-cms-starter:latest
- name: Run CMS with custom admin credentials
run: |
mkdir -p .test-secrets && echo -n "customPassword" > .test-secrets/admin.password
docker run -d -p 8080:8080 --name websight-cms --rm \
--mount source=segment-store-repository,target=/websight/launcher/repository \
-v "$(pwd)/.test-secrets/admin.password:/websight/launcher/resources/secrets/admin.password:ro" \
--env "WS_ADMIN_USERNAME=customAdmin" \
ds/websight-cms-starter:latest
echo "Waiting for the environment to be ready..."
timeout 300 bash -c 'until curl -s -f -o /dev/null -w "%{http_code}" http://localhost:8080/system/health; do echo " - waiting for the server..."; sleep 1; done'
- name: Verify custom credentials
run: ./.github/scripts/ci-verify-docker-image-with-custom-credentials.sh
verify-e2e-tests:
name: Verify E2E tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Authenticate to Google Cloud
uses: google-github-actions/auth@v2
with:
workload_identity_provider: ${{ secrets.GCP_WEBSIGHT_RELEASES_WORKLOAD_IDENTITY_PROVIDER }}
service_account: ${{ secrets.GCP_WEBSIGHT_SNAPSHOTS_SNAPSHOT_READ_SA }}
- uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'adopt'
cache: 'maven'
- uses: actions/cache@v3
with:
path: |
${{ env.APP_LC_FRONTEND_MODULE }}/node
${{ env.APP_LC_FRONTEND_MODULE }}/node_modules
${{ env.APP_CC_FRONTEND_MODULE }}/node
${{ env.APP_CC_FRONTEND_MODULE }}/node_modules
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
- name: Verify Starter CMS Feature model with integration and E2E tests
run: ./mvnw --batch-mode clean verify -P e2e-functional
- name: Clear snapshots before caching
if: always()
run: find ~/.m2/repository/pl/ds -name "*-SNAPSHOT" -type d -print -prune -exec rm -r "{}" \;
prepare-data-for-visual-tests-from-main-branch:
name: Prepare data for visual tests from main branch
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ github.event.pull_request.base.ref }} # main branch
- name: Authenticate to Google Cloud
uses: google-github-actions/auth@v2
with:
workload_identity_provider: ${{ secrets.GCP_WEBSIGHT_RELEASES_WORKLOAD_IDENTITY_PROVIDER }}
service_account: ${{ secrets.GCP_WEBSIGHT_SNAPSHOTS_SNAPSHOT_READ_SA }}
- uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'adopt'
cache: 'maven'
- uses: actions/cache@v3
with:
path: |
${{ env.APP_LC_FRONTEND_MODULE }}/node
${{ env.APP_LC_FRONTEND_MODULE }}/node_modules
${{ env.APP_CC_FRONTEND_MODULE }}/node
${{ env.APP_CC_FRONTEND_MODULE }}/node_modules
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
- name: Visual tests - create reference snapshots
run: ./mvnw --batch-mode clean verify -DskipITs -P e2e-visual-seed
- name: Upload reference snapshots
uses: actions/upload-artifact@v3
with:
name: backstopjs-references
path: ./tests/end-to-end/backstop_data/bitmaps_reference
if-no-files-found: error
- name: Clear snapshots before caching
if: always()
run: find ~/.m2/repository/pl/ds -name "*-SNAPSHOT" -type d -print -prune -exec rm -r "{}" \;
verify-visual-regression:
name: Verify with visual regression tests
runs-on: ubuntu-latest
needs: [ prepare-data-for-visual-tests-from-main-branch ]
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Authenticate to Google Cloud
uses: google-github-actions/auth@v2
with:
workload_identity_provider: ${{ secrets.GCP_WEBSIGHT_RELEASES_WORKLOAD_IDENTITY_PROVIDER }}
service_account: ${{ secrets.GCP_WEBSIGHT_SNAPSHOTS_SNAPSHOT_READ_SA }}
- uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'adopt'
cache: 'maven'
- uses: actions/cache@v3
with:
path: |
${{ env.APP_LC_FRONTEND_MODULE }}/node
${{ env.APP_LC_FRONTEND_MODULE }}/node_modules
${{ env.APP_CC_FRONTEND_MODULE }}/node
${{ env.APP_CC_FRONTEND_MODULE }}/node_modules
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
- name: Download reference screenshots
uses: actions/download-artifact@v3
with:
name: backstopjs-references
path: ./tests/end-to-end/backstop_data/bitmaps_reference
- name: Visual tests - compare with reference screenshots
id: visualTestsCompare
run: ./mvnw --batch-mode clean verify -DskipITs -P e2e-visual-check
continue-on-error: true
- name: Create visual tests report
if: steps.visualTestsCompare.outcome == 'failure'
shell: bash
run: |
./.github/scripts/ci-verify-build-read-report-failures.sh
sudo apt-get install -y pngquant && ./.github/scripts/ci-verify-build-provide-visual-regression-report.sh
- name: Upload visual test report
if: steps.visualTestsCompare.outcome == 'failure'
uses: actions/upload-artifact@v3
with:
name: visual-tests-report
path: artifacts/visual/
if-no-files-found: error
retention-days: 1
- name: Clear snapshots before caching
if: always()
run: find ~/.m2/repository/pl/ds -name "*-SNAPSHOT" -type d -print -prune -exec rm -r "{}" \;