Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NXP-32573 : unit tests & refactoring #19

Closed
wants to merge 8 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
79 changes: 79 additions & 0 deletions .github/workflows/a11y.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
name: A11y

on:
pull_request:
branches:
- dev
workflow_call:
inputs:
branch:
description: 'The current branch'
default: dev
type: string
required: false
secrets:
NPM_PACKAGES_TOKEN:
description: 'NPM_PACKAGES_TOKEN'
required: true
PACKAGES_AUTH_USER:
description: 'PACKAGES_AUTH_USER'
required: true
PACKAGES_AUTH_TOKEN:
description: 'PACKAGES_AUTH_TOKEN'
required: true

env:
REFERENCE_BRANCH: dev
NPM_REPOSITORY: https://packages.nuxeo.com/repository/npm-public/
BRANCH_NAME: ${{ github.head_ref || inputs.branch || 'dev' }}

jobs:
a11y:
runs-on: self-hosted
steps:
- uses: actions/checkout@v2
with:
ref: ${{ env.BRANCH_NAME }}

- run: git config user.name "nuxeo-webui-jx-bot" && git config user.email "[email protected]"

- uses: actions/setup-node@v3
with:
registry-url: ${{ env.NPM_REPOSITORY }}
node-version: 18
scope: '@nuxeo'

- name: Install Admin Console ui
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_PACKAGES_TOKEN }}
run: |
npm install
pushd packages/nuxeo-admin-console-ui-ftest
npm install
popd
pushd packages/nuxeo-designer-catalog
npm install
popd

- uses: actions/setup-java@v2
with:
distribution: 'zulu'
java-version: '17'

- 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: Web UI build
run: mvn -B -ntp install

- name: A11y checks
run: mvn -B -ntp -f plugin/a11y install
71 changes: 71 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
name: Build

on:
push:
branches:
- dev

# Manually trigger the workflow
workflow_dispatch:

jobs:
lint:
uses: nuxeo/nuxeo-admin-console-ui/.github/workflows/lint.yaml@dev
secrets:
NPM_PACKAGES_TOKEN: ${{ secrets.NPM_PACKAGES_TOKEN }}

utest:
uses: nuxeo/nuxeo-admin-console-ui/.github/workflows/utest.yaml@dev
secrets:
NPM_PACKAGES_TOKEN: ${{ secrets.NPM_PACKAGES_TOKEN }}
SAUCE_ACCESS_KEY: ${{ secrets.SAUCE_ACCESS_KEY }}
with:
branch: dev

a11y:
uses: nuxeo/nuxeo-admin-console-ui/.github/workflows/a11y.yaml@dev
secrets:
NPM_PACKAGES_TOKEN: ${{ secrets.NPM_PACKAGES_TOKEN }}
PACKAGES_AUTH_USER: ${{ secrets.PACKAGES_AUTH_USER }}
PACKAGES_AUTH_TOKEN: ${{ secrets.PACKAGES_AUTH_TOKEN }}
with:
branch: dev

ftest:
uses: nuxeo/nuxeo-admin-console-ui/.github/workflows/ftest.yaml@dev
secrets:
NPM_PACKAGES_TOKEN: ${{ secrets.NPM_PACKAGES_TOKEN }}
PACKAGES_AUTH_USER: ${{ secrets.PACKAGES_AUTH_USER }}
PACKAGES_AUTH_TOKEN: ${{ secrets.PACKAGES_AUTH_TOKEN }}
with:
branch: dev

build:
needs: [lint, utest, a11y, ftest]
runs-on: self-hosted
steps:
- uses: actions/checkout@v2

- run: git config user.name "nuxeo-webui-jx-bot" && git config user.email "[email protected]"

- uses: actions/setup-node@v3
with:
registry-url: 'https://packages.nuxeo.com/repository/npm-public/'
scope: '@nuxeo'

- uses: actions/setup-java@v2
with:
distribution: 'zulu'
java-version: '17'

- name: Prepare environment
run: |
echo "BRANCH_NAME=${GITHUB_HEAD_REF##*/}" >> $GITHUB_ENV
echo "PACKAGE_VERSION=$(npx -c 'echo "$npm_package_version"')" >> $GITHUB_ENV

- name: Get prerelease version
run: |
git fetch origin --tags
RC_VERSION=$(git tag --sort=taggerdate --list "v${PACKAGE_VERSION/-SNAPSHOT}*" | tail -1 | tr -d '\n')
echo "VERSION=$(npx semver -i prerelease --preid rc ${RC_VERSION:-$PACKAGE_VERSION} | tr -d '\n')" >> $GITHUB_ENV

120 changes: 120 additions & 0 deletions .github/workflows/ftest.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
name: Functional tests

on:
pull_request:
branches:
- dev
workflow_call:
inputs:
branch:
description: 'The current branch'
default: dev
type: string
required: false
secrets:
NPM_PACKAGES_TOKEN:
description: 'NPM_PACKAGES_TOKEN'
required: true
PACKAGES_AUTH_USER:
description: 'PACKAGES_AUTH_USER'
required: true
PACKAGES_AUTH_TOKEN:
description: 'PACKAGES_AUTH_TOKEN'
required: true

env:
REFERENCE_BRANCH: dev
NPM_REPOSITORY: https://packages.nuxeo.com/repository/npm-public/
BRANCH_NAME: ${{ github.head_ref || inputs.branch || 'dev' }}

jobs:
ftests:
runs-on: self-hosted
steps:
- uses: actions/checkout@v2
with:
ref: ${{ env.BRANCH_NAME }}

- 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: Install Admin Console UI
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_PACKAGES_TOKEN }}
run: |
npm install
pushd packages/nuxeo-admin-console-ui-ftest
npm install
popd
pushd packages/nuxeo-designer-catalog
npm install
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: '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: Functional tests
env:
RUN_ALL: false
BAIL: 0
run: mvn -ntp install -Pftest -DskipInstall

- name: Archive cucumber reports
if: ${{ always() }}
uses: actions/upload-artifact@v2
with:
name: cucumber-reports
path: ftest/target/cucumber-reports/

- name: Archive screenshots
if: ${{ failure() }}
uses: actions/upload-artifact@v2
with:
name: screenshots
path: ftest/target/screenshots/

- name: Archive logs
if: ${{ always() }}
uses: actions/upload-artifact@v2
with:
name: logs
path: |
**/log/*.log
**/nxserver/config/distribution.properties

- name: Archive packages
if: ${{ always() }}
uses: actions/upload-artifact@v2
with:
name: packages
path: |
plugin/admin-console-ui/marketplace/target/nuxeo-admin-console-ui-marketplace-*.zip
plugin/itests/marketplace/target/nuxeo-web-ui-marketplace-itests-*.zip
42 changes: 42 additions & 0 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Lint

on:
pull_request:
branches:
- dev
workflow_call:
inputs:
branch:
description: 'The current branch'
default: dev
type: string
required: false
secrets:
NPM_PACKAGES_TOKEN:
description: 'NPM_PACKAGES_TOKEN'
required: true

env:
BRANCH_NAME: ${{ github.head_ref || inputs.branch || 'dev' }}

jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
ref: ${{ env.BRANCH_NAME }}

- uses: actions/setup-node@v3
with:
registry-url: 'https://packages.nuxeo.com/repository/npm-public/'
node-version: 18
scope: '@nuxeo'

- name: Install
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
run: npm install

- name: Lint
run: npm run lint
Loading
Loading