Cross repo check #3385
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
# This workflow is not intended to be triggered manually from the Web UI repository, | |
# but to be called from the Elements repository cross repo check instead. | |
name: Cross repo check | |
on: | |
workflow_dispatch: | |
inputs: | |
branch_name: | |
description: 'The name of the branch to build.' | |
default: 'maintenance-3.1.x' | |
required: true | |
sauce_labs: | |
description: 'Run unit tests on Sauce Labs?' | |
default: true | |
type: boolean | |
required: false | |
skip_ftests: | |
description: 'Skip functional tests?' | |
type: boolean | |
required: false | |
skip_a11y: | |
description: 'Skip accessibility tests?' | |
type: boolean | |
required: false | |
skip_unit_tests: | |
description: 'Skip unit tests?' | |
type: boolean | |
required: false | |
generate_metrics: | |
description: 'Generate metrics report?' | |
type: boolean | |
required: false | |
run_all: | |
description: 'Skip fail fast premise?' | |
type: boolean | |
required: false | |
bail: | |
description: 'Number of failed features to stop test runner (0 means not applicable).' | |
default: 0 | |
required: false | |
caller_id: | |
description: 'run identifier' | |
default: 'maintenance-3.1.x' | |
type: string | |
required: false | |
env: | |
REFERENCE_BRANCH: maintenance-3.1.x | |
NPM_REPOSITORY: https://packages.nuxeo.com/repository/npm-public/ | |
jobs: | |
id: | |
name: Remote Caller ID ${{ github.event.inputs.caller_id }} | |
runs-on: ubuntu-latest | |
steps: | |
- name: ${{ github.event.inputs.id }} | |
run: echo run identifier ${{ github.event.inputs.id }} | |
build: | |
name: Build | |
needs: id | |
runs-on: [ self-hosted, master ] | |
steps: | |
- name: Build parameters | |
run: echo '${{ toJSON(github.event.inputs) }}' | |
- uses: actions/setup-node@v3 | |
with: | |
registry-url: ${{ env.NPM_REPOSITORY }} | |
scope: '@nuxeo' | |
node-version: 18 | |
- uses: actions/setup-java@v2 | |
with: | |
distribution: 'zulu' | |
java-version: '17' | |
- name: Determine nuxeo-web-ui branch to use | |
uses: nuxeo/ui-team-gh-actions/get-branch@ca09d5c52a62e297502d3572c36d813be927982a | |
id: pick_nuxeo_web_ui_branch | |
with: | |
repository: nuxeo/nuxeo-web-ui | |
branch: ${{ github.event.inputs.branch_name }} | |
default-branch: ${{ env.REFERENCE_BRANCH }} | |
- name: Determine nuxeo-elements branch to use | |
id: pick_nuxeo_elements_branch | |
uses: nuxeo/ui-team-gh-actions/get-branch@ca09d5c52a62e297502d3572c36d813be927982a | |
with: | |
repository: nuxeo/nuxeo-elements | |
branch: ${{ github.event.inputs.branch_name }} | |
default-branch: ${{ env.REFERENCE_BRANCH }} | |
- name: Checkout nuxeo-web-ui repo | |
uses: actions/checkout@v2 | |
with: | |
repository: nuxeo/nuxeo-web-ui | |
ref: ${{ steps.pick_nuxeo_web_ui_branch.outputs.branch }} | |
- name: Install Web UI | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_PACKAGES_TOKEN }} | |
run: | | |
npm install | |
pushd packages/nuxeo-web-ui-ftest | |
npm install | |
popd | |
pushd plugin/a11y | |
npm install | |
popd | |
pushd packages/nuxeo-designer-catalog | |
npm install | |
popd | |
- name: Lint Web UI | |
run: npm run lint | |
- name: Checkout the nuxeo-elements repo | |
uses: actions/checkout@v2 | |
with: | |
repository: nuxeo/nuxeo-elements | |
path: nuxeo-elements | |
fetch-depth: 1 | |
ref: ${{ steps.pick_nuxeo_elements_branch.outputs.branch }} | |
- name: Pack Elements modules | |
run: | | |
pushd nuxeo-elements | |
pushd core | |
echo "ELEMENTS_CORE=$(npm pack 2>&1 | tail -1)" >> $GITHUB_ENV | |
popd | |
pushd ui | |
echo "ELEMENTS_UI=$(npm pack 2>&1 | tail -1)" >> $GITHUB_ENV | |
popd | |
pushd dataviz | |
echo "ELEMENTS_DATAVIZ=$(npm pack 2>&1 | tail -1)" >> $GITHUB_ENV | |
popd | |
pushd testing-helpers | |
echo "ELEMENTS_HELPERS=$(npm pack 2>&1 | tail -1)" >> $GITHUB_ENV | |
popd | |
popd | |
- name: Add .npmrc | |
run: | | |
pushd /tmp/_temp/ | |
rm .npmrc | |
touch .npmrc | |
popd | |
echo ' | |
packages.nuxeo.com/repository/npm-public/:_auth=${NODE_AUTH_TOKEN} | |
@nuxeo:registry=https://packages.nuxeo.com/repository/npm-public/ | |
always-auth=true | |
' >> /tmp/_temp/.npmrc | |
- name: Link elements to Web UI | |
run: | | |
npm install --no-package-lock --@nuxeo:registry="${{ env.NPM_REPOSITORY }}" nuxeo-elements/core/${ELEMENTS_CORE} | |
npm install --no-package-lock --@nuxeo:registry="${{ env.NPM_REPOSITORY }}" nuxeo-elements/ui/${ELEMENTS_UI} | |
npm install --no-package-lock --@nuxeo:registry="${{ env.NPM_REPOSITORY }}" nuxeo-elements/dataviz/${ELEMENTS_DATAVIZ} | |
npm install --no-package-lock --@nuxeo:registry="${{ env.NPM_REPOSITORY }}" nuxeo-elements/testing-helpers/${ELEMENTS_HELPERS} | |
- name: Web UI Unit tests | |
if: ${{ github.event.inputs.skip_unit_tests == 'false' && github.event.inputs.sauce_labs == 'false' }} | |
run: npm run test | |
- name: Web UI Unit tests (Sauce Labs) | |
if: ${{ github.event.inputs.skip_unit_tests == 'false' && github.event.inputs.sauce_labs == 'true' }} | |
env: | |
SAUCE_USERNAME: nuxeo-web-ui | |
SAUCE_ACCESS_KEY: ${{ secrets.SAUCE_ACCESS_KEY }} | |
run: npm run test | |
- name: 'Update settings.xml with server configuration' | |
run: | | |
echo '<settings> | |
<servers> | |
<server> | |
<id>maven-internal</id> | |
<username>${{ secrets.PACKAGES_AUTH_USER }}</username> | |
<password>${{ secrets.PACKAGES_AUTH_TOKEN }}</password> | |
</server> | |
</servers> | |
</settings>' > ~/.m2/settings.xml | |
- name: Nuxeo package build and Ftests | |
env: | |
RUN_ALL: ${{ github.event.inputs.run_all }} | |
BAIL: ${{ github.event.inputs.bail }} | |
run: | | |
profiles=() | |
if [ ${{ github.event.inputs.skip_ftests }} = "false" ] | |
then | |
profiles+=('ftest') | |
fi | |
if ${{ github.event.inputs.generate_metrics }} | |
then | |
profiles+=('metrics') | |
fi | |
active_profiles="" | |
if [ ${#profiles[@]} -gt 0 ] | |
then | |
active_profiles="-P$(printf -v active_profiles '%s,' "${profiles[@]}" && echo "${active_profiles%,}")" | |
fi | |
mvn install -ntp $active_profiles -DskipInstall | |
- name: A11y checks | |
if: ${{ github.event.inputs.skip_a11y == 'false' }} | |
run: | | |
mvn -B -nsu -f plugin/a11y -ntp install | |
- name: Archive cucumber reports | |
if: ${{ always() }} | |
uses: actions/upload-artifact@v3 | |
with: | |
name: cucumber-reports | |
path: | | |
ftest/target/cucumber-reports/ | |
- name: Archive screenshots | |
if: ${{ failure() }} | |
uses: actions/upload-artifact@v3 | |
with: | |
name: screenshots | |
path: ftest/target/screenshots/ | |
- name: Archive logs | |
if: ${{ always() }} | |
uses: actions/upload-artifact@v3 | |
with: | |
name: logs | |
path: | | |
**/log/*.log | |
**/nxserver/config/distribution.properties | |
- name: Archive packages | |
if: ${{ always() }} | |
uses: actions/upload-artifact@v3 | |
with: | |
name: packages | |
path: | | |
plugin/web-ui/marketplace/target/nuxeo-web-ui-marketplace-*.zip | |
plugin/itests/marketplace/target/nuxeo-web-ui-marketplace-itests-*.zip |