From 01f7e3c28706038f3a99cb72641f86c001c265b5 Mon Sep 17 00:00:00 2001 From: MichalKinas <113341662+MichalKinas@users.noreply.github.com> Date: Thu, 2 Mar 2023 09:35:13 +0100 Subject: [PATCH] [ACA-4652] Run unit tests as one GH job, add e2es as GH job (#2997) * [ACA-4652] Run unit tests as one GH job, add e2es as GH job * [ACA-4652] Fix yaml syntax * [ACA-4652] Fix if syntax * [ACA-4652] Correct syntax * [ACA-4652] Correct syntax * [ACA-4652] Each job must contain uses or run * [ACA-4652] Migrate uploading/downloading build artifacts, migrate before install * [ACA-4652] Fix bad substitution * [ACA-4652] Fix string merging in bash * [ACA-4652] Bash fix * [ACA-4652] Install aws before downloading/uploading artifacts * [ACA-4652] Add setup with aws config action * [ACA-4652] Add aws-region * [ACA-4652] Use aws default region * [ACA-4652] Log github event * [ACA-4652] Log workflow run * [ACA-4652] Fix commit logging * [ACA-4652] Use action to get current commit msg * [ACA-4652] Add correct version of build tools * [ACA-4652] Get commit msg from env * [ACA-4652] Get commit msg in the same job * [ACA-4652] Final commit msg test * [ACA-4652] Fix logging * [ACA-4652] Cleanup commit msg, correct s3 bucket * [link-adf:AAE-12767] Test adf linking * [link-adf:AAE-12767] Test adf linking finalize * [link-adf:AAE-12767] Tweak finalize job * [link-adf:AAE-12767] Get commit msg in before install * [link-adf:AAE-12767] Add missing adfprod configs * [ACA-4652] Migrate before and after e2e scripts to GHA * [ACA-4652] Add before e2e logging * [ACA-4652] Use new GH secrets * [ACA-4652] Remove logs, add envsub * [ACA-4652] Install envsub globally * [ACA-4652] Log replaced config * [ACA-4652] Add missing env variable * [ACA-4652] Add e2e run as GH action * [ACA-4652] Remove logging, fix download path * [ACA-4652] Disable protractor smartrunner artifact * [ACA-4652] Install webdriver-manager * [ACA-4652] Disable failing download on Travis, npm ci in before e2e * [ACA-4652] Missing shell * [ACA-4652] Restore artifact download * [ACA-4652] Download smartrunner artifact only when present * [ACA-4652] Check run attempt * [ACA-4652] Correct attempt check * [ACA-4652] Stop running e2es in Travis for now * [ACA-4652] Run Travis e2es again, add test suite id * [ACA-4652] Add test suite id to after e2e action * [ACA-4652] Remove additional install * [ACA-4652] CR fixes, remove some Travis config that is already migrated * [ACA-4652] Cleanup setup leftover * [ACA-4652] Propagate aws credentials * [ACA-4652] Fix aws default region * [ACA-4652] Misspelled variable fix * [ACA-4652] Propagate aws region * [ACA-4652] Rename PR workflow * [ACA-4652] Download artifact only if bucket exists * [ACA-4652] Run test even is aws bucket doesn't exist * [ACA-4652] Fix aws download error * [ACA-4652] Check if file exists before downloading * [ACA-4652] Remove uploading/downloading e2e artifact after successful run * [ACA-4652] Add missing check to finalize stage --- .github/actions/adf-linking/action.yml | 25 ++ .github/actions/after-e2e/action.yml | 30 +++ .github/actions/before-e2e/action.yml | 68 ++++++ .github/actions/before-install/action.yml | 48 ++++ .../actions/download-job-artifact/action.yml | 44 ++++ .github/actions/run-e2e/action.yml | 31 +++ .../actions/upload-job-artifact/action.yml | 40 +++ .github/workflows/aca-upstream.yml | 2 +- .github/workflows/pull-request.yml | 230 ++++++++++++++++++ .github/workflows/test.yml | 132 ---------- .travis.yml | 137 ----------- .travis/env.yml | 5 - angular.json | 10 + projects/aca-content/tsconfig.spec.adf.json | 16 ++ projects/aca-preview/tsconfig.spec.adf.json | 16 ++ 15 files changed, 559 insertions(+), 275 deletions(-) create mode 100644 .github/actions/adf-linking/action.yml create mode 100644 .github/actions/after-e2e/action.yml create mode 100644 .github/actions/before-e2e/action.yml create mode 100644 .github/actions/before-install/action.yml create mode 100644 .github/actions/download-job-artifact/action.yml create mode 100644 .github/actions/run-e2e/action.yml create mode 100644 .github/actions/upload-job-artifact/action.yml create mode 100644 .github/workflows/pull-request.yml delete mode 100644 .github/workflows/test.yml delete mode 100644 .travis/env.yml create mode 100644 projects/aca-content/tsconfig.spec.adf.json create mode 100644 projects/aca-preview/tsconfig.spec.adf.json diff --git a/.github/actions/adf-linking/action.yml b/.github/actions/adf-linking/action.yml new file mode 100644 index 0000000000..aa32d4c3e3 --- /dev/null +++ b/.github/actions/adf-linking/action.yml @@ -0,0 +1,25 @@ +name: "ADF linking" +description: "ADF linking" + +runs: + using: "composite" + steps: + - name: clone and install + shell: bash + run: | + if [[ $COMMIT_MESSAGE == *"[link-adf:"* ]]; then + echo "BUILD_OPTS=--configuration=adfprod,e2e" >> $GITHUB_ENV + echo "TEST_OPTS=--configuration=adfprod" >> $GITHUB_ENV + echo "E2E_PROTRACTOR_OPTS=--with-local-adf" >> $GITHUB_ENV + echo "E2E_TSCONFIG=tsconfig.e2e.adf.json" >> $GITHUB_ENV + BRANCH=`echo $COMMIT_MESSAGE | grep -o "\[link-adf\:[^]]*\]" | sed -e 's#\[link-adf:##g' | sed -e 's#\]##g'` + echo "Checking out ADF's branch: ${BRANCH}" && \ + git clone https://github.com/Alfresco/alfresco-ng2-components.git --depth=1 --branch ${BRANCH} ../alfresco-ng2-components + # ADF theming needs it the styling + CWD=`pwd` + cd ../alfresco-ng2-components + npm install @angular/material + cd $CWD + else + echo -e "\e[32mUsing ADF from installed node_modules.\e[0m" + fi ; diff --git a/.github/actions/after-e2e/action.yml b/.github/actions/after-e2e/action.yml new file mode 100644 index 0000000000..0475d73974 --- /dev/null +++ b/.github/actions/after-e2e/action.yml @@ -0,0 +1,30 @@ +name: "After e2e" +description: "After e2e" + +env: + storage_file: "./storage-state/AdminUserState.json" + +inputs: + id: + description: 'test suite id' + required: true + type: number + aws-access-key-id: + description: 'aws access key id' + required: true + type: string + aws-secret-access-key: + description: 'aws secret access key' + required: true + type: string + aws-region: + description: 'aws region' + required: true + type: string + +runs: + using: "composite" + steps: + - name: Remove storage file + shell: bash + run: rm -f ${{ env.storage_file }} diff --git a/.github/actions/before-e2e/action.yml b/.github/actions/before-e2e/action.yml new file mode 100644 index 0000000000..947b522db7 --- /dev/null +++ b/.github/actions/before-e2e/action.yml @@ -0,0 +1,68 @@ +name: "Before e2e" +description: "Before e2e" + +inputs: + from: + description: 'path to download the artifact' + required: true + type: string + to: + description: 'path to save artifact to' + required: true + type: string + id: + description: 'test suite id' + required: true + type: number + aws-access-key-id: + description: 'aws access key id' + required: true + type: string + aws-secret-access-key: + description: 'aws secret access key' + required: true + type: string + aws-region: + description: 'aws region' + required: true + type: string + +runs: + using: "composite" + steps: + - name: Check content UP + shell: bash + run: ./node_modules/@alfresco/adf-cli/bin/adf-cli check-cs-env --host $APP_CONFIG_ECM_HOST -u $ADMIN_EMAIL -p $ADMIN_PASSWORD || exit 1 + - name: Download artifacts + uses: ./.github/actions/download-job-artifact + with: + artifact: ${{ inputs.from }} + output: ${{ inputs.to }} + aws-access-key-id: ${{ inputs.aws-access-key-id }} + aws-secret-access-key: ${{ inputs.aws-secret-access-key }} + aws-region: ${{ inputs.aws-region }} + - name: Replace variables in app.config.json + shell: bash + run: | + npm install -g envsub + APP_CONFIG_FILE_PATH="${{ inputs.to }}/app.config.json" + EXTRA_ENV_SETTINGS="" + envsub $EXTRA_ENV_SETTINGS --all $APP_CONFIG_FILE_PATH $APP_CONFIG_FILE_PATH || exit 1 + echo -n " \_ Validating replaced config file ... "; + $(npm bin)/ajv validate -s ./node_modules/@alfresco/adf-core/app.config.schema.json -d $APP_CONFIG_FILE_PATH --errors=text --verbose || exit 4 + if grep -E -q '\$\{[A-Z0-9_]*\}' $APP_CONFIG_FILE_PATH; then + echo -e "\e[31m \_ ERROR: Variables are still present in the app.config.json file. Some of them might not have default value set.\e[0m"; + exit 5; + fi + - name: Update webdriver-manager + shell: bash + run: | + npm install -g webdriver-manager + if [ "$CI" = "true" ]; then + export chrome=$(google-chrome --product-version) + echo "Updating wevdriver-manager with chromedriver: $chrome." + webdriver-manager update --gecko=false --versions.chrome=$chrome + else + echo "Updating wedriver-manager with latest chromedriver, be sure to use evergreen Chrome." + webdriver-manager update --gecko=false + fi diff --git a/.github/actions/before-install/action.yml b/.github/actions/before-install/action.yml new file mode 100644 index 0000000000..27953b8c08 --- /dev/null +++ b/.github/actions/before-install/action.yml @@ -0,0 +1,48 @@ +name: "Before install and variables setup" +description: "Before install and variables setup" + +inputs: + artifact: + description: 'path to the artifact to archieve (tar.bz2) and upload (like ./dist)' + required: true + type: string + output: + description: 'the S3 object to copy it to, like: s3://bucket-name/folder/whatever.tar.bz2' + required: true + type: string + +runs: + using: "composite" + steps: + - uses: Alfresco/alfresco-build-tools/.github/actions/get-commit-message@v1.35.0 + - name: setup variables + shell: bash + run: | + echo "BUILD_OPTS=--configuration=production,e2e" >> $GITHUB_ENV + echo "TEST_OPTS=" >> $GITHUB_ENV + echo "E2E_PROTRACTOR_OPTS=" >> $GITHUB_ENV + echo "E2E_TSCONFIG=tsconfig.e2e.json" >> $GITHUB_ENV + echo "GIT_HASH=$(git rev-parse HEAD)" >> $GITHUB_ENV + echo "SMART_RUNNER_DIRECTORY=.protractor-smartrunner" >> $GITHUB_ENV + echo "BASE_HASH=.protractor-smartrunner" >> $GITHUB_ENV + echo "HEAD_HASH=HEAD" >> $GITHUB_ENV + - name: setup S3 caching + shell: bash + run: | + S3_DBP_PATH="s3://alfresco-travis-builds/aca" + if [ "${{ github.event_name }}" == "push" ]; then + BRANCH_NAME=${GITHUB_REF##*/} + S3_DBP_ROOT_FOLDER="$S3_DBP_PATH/$BRANCH_NAME" + elif [ "${{ github.event_name }}" == "pull_request" ]; then + BRANCH_NAME=${GITHUB_BASE_REF} + S3_DBP_ROOT_FOLDER="$S3_DBP_PATH/$BRANCH_NAME" + echo "BASE_HASH=origin/$BRANCH_NAME" >> $GITHUB_ENV + elif [ "${TRAVIS_EVENT_TYPE}" == "schedule" ]; then + S3_DBP_ROOT_FOLDER="$S3_DBP_PATH/cron" + else + S3_DBP_ROOT_FOLDER="$S3_DBP_PATH/api" + fi + echo "S3_DBP_FOLDER="$S3_DBP_ROOT_FOLDER/${{ github.run_id }}"" >> $GITHUB_ENV + - name: ADF linking + if: ${{ github.event_name == 'pull_request'}} + uses: ./.github/actions/adf-linking diff --git a/.github/actions/download-job-artifact/action.yml b/.github/actions/download-job-artifact/action.yml new file mode 100644 index 0000000000..c5c299dd5c --- /dev/null +++ b/.github/actions/download-job-artifact/action.yml @@ -0,0 +1,44 @@ +name: "Download build artifacts" +description: "Download build artifacts" + +inputs: + artifact: + description: 'path to the s3 artifact (tar.bz2) to download and extract' + required: true + type: string + output: + description: 'directory to extract the archive to' + required: true + type: string + aws-access-key-id: + description: 'aws access key id' + required: true + type: string + aws-secret-access-key: + description: 'aws secret access key' + required: true + type: string + aws-region: + description: 'aws region' + required: true + type: string + +runs: + using: "composite" + steps: + - name: Configure AWS Credentials + uses: aws-actions/configure-aws-credentials@v1 + with: + aws-access-key-id: ${{ inputs.aws-access-key-id }} + aws-secret-access-key: ${{ inputs.aws-secret-access-key }} + aws-region: ${{ inputs.aws-region }} + - name: download build artifacts from s3 + shell: bash + run: | + test ! -d ${{ inputs.output }} && mkdir -p ${{ inputs.output }} + aws s3 cp ${{ inputs.artifact }} ./s3-artifact.tmp + echo 'artifact download done' + tar -xvf ./s3-artifact.tmp -C ${{ inputs.output }} >&/dev/null + echo 'tar the artifact done' + rm ./s3-artifact.tmp + echo 'remove tmp file' diff --git a/.github/actions/run-e2e/action.yml b/.github/actions/run-e2e/action.yml new file mode 100644 index 0000000000..9992daef14 --- /dev/null +++ b/.github/actions/run-e2e/action.yml @@ -0,0 +1,31 @@ +name: "Run e2e" +description: "Run e2e" + +inputs: + options: + description: 'Options' + required: true + type: string + test-runner: + description: 'Test runner' + required: false + type: string + default: 'protractor' + +runs: + using: "composite" + steps: + - name: Setup and run with options + shell: bash + run: | + ./node_modules/.bin/tsc -p "./e2e/$E2E_TSCONFIG" || exit 1; + ./node_modules/.bin/http-server -c-1 $CONTENT_CE_DIST_PATH -p 4200 > /dev/null &\ + + if [ ${{ inputs.test-runner }} == "playwright" ]; then + echo "Running playwright tests with options ${{ inputs.options }}" + npx playwright test --config ${{ inputs.options }} + else + echo "Running protractor tests with options ${{ inputs.options }}" + echo "./node_modules/.bin/protractor \"./protractor.conf.js\" ${{ inputs.options }} || exit 1" + ./node_modules/.bin/protractor "./protractor.conf.js" ${{ inputs.options }} $E2E_PROTRACTOR_OPTS || exit 1 + fi diff --git a/.github/actions/upload-job-artifact/action.yml b/.github/actions/upload-job-artifact/action.yml new file mode 100644 index 0000000000..008ee83f61 --- /dev/null +++ b/.github/actions/upload-job-artifact/action.yml @@ -0,0 +1,40 @@ +name: "Upload build artifacts" +description: "Upload build artifacts" + +inputs: + artifact: + description: 'path to the artifact to archieve (tar.bz2) and upload (like ./dist)' + required: true + type: string + output: + description: 'the S3 object to copy it to, like: s3://bucket-name/folder/whatever.tar.bz2' + required: true + type: string + aws-access-key-id: + description: 'aws access key id' + required: true + type: string + aws-secret-access-key: + description: 'aws secret access key' + required: true + type: string + aws-region: + description: 'aws region' + required: true + type: string + +runs: + using: "composite" + steps: + - name: Configure AWS Credentials + uses: aws-actions/configure-aws-credentials@v1 + with: + aws-access-key-id: ${{ inputs.aws-access-key-id }} + aws-secret-access-key: ${{ inputs.aws-secret-access-key }} + aws-region: ${{ inputs.aws-region }} + - name: upload build artifacts to s3 + shell: bash + run: | + tar cvfj ./s3-artifact.tmp -C ${{ inputs.artifact }} `ls ${{ inputs.artifact }}` + aws s3 cp ./s3-artifact.tmp ${{ inputs.output }} + rm ./s3-artifact.tmp diff --git a/.github/workflows/aca-upstream.yml b/.github/workflows/aca-upstream.yml index 95a6202911..3b65c28492 100644 --- a/.github/workflows/aca-upstream.yml +++ b/.github/workflows/aca-upstream.yml @@ -30,7 +30,7 @@ jobs: - name: install NPM uses: actions/setup-node@v3 with: - node-version: 14 + node-version-file: '.nvmrc' cache: 'npm' - name: Trigger upstream shell: bash diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml new file mode 100644 index 0000000000..4eabec31ed --- /dev/null +++ b/.github/workflows/pull-request.yml @@ -0,0 +1,230 @@ +name: "Pull request" + +on: + push: + branches: [master, develop] + pull_request: + branches: [master, develop] + +env: + APP_CONFIG_ECM_HOST: ${{ secrets.PIPELINE_ENV_URL }} + ADMIN_EMAIL: ${{ secrets.PIPELINE_ADMIN_USERNAME }} + ADMIN_PASSWORD: ${{ secrets.PIPELINE_ADMIN_PASSWORD }} + AWS_REGION: "eu-west-2" + CONTENT_CE_DIST_PATH: "./dist/content-ce" + APP_CONFIG_PROVIDER: ECM + APP_CONFIG_AUTH_TYPE: BASIC + APP_CONFIG_OAUTH2_HOST: http://localhost:4200/auth/realms/alfresco + PLAYWRIGHT_E2E_HOST: "http://localhost:4200" + APP_CONFIG_OAUTH2_CLIENTID: alfresco + APP_CONFIG_PLUGIN_AOS: true + APP_CONFIG_PLUGIN_CONTENT_SERVICE: true + APP_CONFIG_PLUGIN_FOLDER_RULES: true + APP_CONFIG_ENABLE_MOBILE_APP_SWITCH: true + APP_CONFIG_SESSION_TIME_FOR_OPEN_APP_DIALOG_DISPLAY_IN_HOURS: "12" + APP_CONFIG_OAUTH2_IMPLICIT_FLOW: true + APP_CONFIG_OAUTH2_SILENT_LOGIN: true + APP_CONFIG_OAUTH2_REDIRECT_LOGOUT: / + APP_CONFIG_OAUTH2_REDIRECT_LOGIN: / + APP_CONFIG_OAUTH2_REDIRECT_SILENT_IFRAME_URI: "{protocol}//{hostname}{:port}/assets/silent-refresh.html" + +jobs: + lint: + name: 'lint' + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + with: + fetch-depth: 2 + + - name: node + uses: actions/setup-node@v3 + with: + node-version-file: '.nvmrc' + cache: 'npm' + - run: npm ci + - run: npm run lint + + build: + name: 'build' + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + with: + fetch-depth: 2 + + - name: node + uses: actions/setup-node@v3 + with: + node-version-file: '.nvmrc' + cache: 'npm' + - uses: ./.github/actions/before-install + - run: npm ci + - run: npm run build $BUILD_OPTS + - name: upload job artifact + if: ${{ success() }} + uses: ./.github/actions/upload-job-artifact + with: + artifact: $CONTENT_CE_DIST_PATH + output: $S3_DBP_FOLDER/alfresco-content-app.tar.bz2 + aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} + aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + aws-region: ${{ env.AWS_REGION }} + + unit-tests: + needs: [lint, build] + name: "Unit tests: ${{ matrix.unit-tests.name }}" + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + unit-tests: + - name: "aca-content" + - name: "adf-office-services-ext" + - name: "aca-shared" + - name: "aca-folder-rules" + - name: "aca-preview" + steps: + - name: Checkout + uses: actions/checkout@v3 + with: + fetch-depth: 2 + + - name: node + uses: actions/setup-node@v3 + with: + node-version-file: '.nvmrc' + cache: 'npm' + - uses: ./.github/actions/before-install + - run: npm ci + - run: npm test ${{ matrix.unit-tests.name }} -- --browsers=ChromeHeadless --watch=false $TEST_OPTS + + e2es: + needs: [lint, build, unit-tests] + name: 'E2e test suites: ${{ matrix.e2e-suites.name }}' + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + e2e-suites: + - name: "authentication,listViews,navigation,application" + id: 1 + - name: "search" + id: 2 + - name: "viewer,infoDrawer,extensions" + id: 3 + - name: "shareActions" + id: 4 + - name: "pagination" + id: 5 + - name: "actionsAvailableFilesFolders" + id: 6 + - name: "actionsAvailableLibraries,actionsAvailableNewMenu" + id: 7 + - name: "actionsAvailableSpecialPermissions" + id: 8 + - name: "copyMoveActions" + id: 9 + - name: "createActions" + id: 10 + - name: "deleteActions" + id: 11 + - name: "editActions,favoriteActions" + id: 12 + - name: "libraryActions" + id: 13 + - name: "uploadDownloadActions" + id: 14 + steps: + - name: Checkout + uses: actions/checkout@v3 + with: + fetch-depth: 2 + + - name: node + uses: actions/setup-node@v3 + with: + node-version-file: '.nvmrc' + cache: 'npm' + - uses: ./.github/actions/before-install + - run: npm ci + - uses: ./.github/actions/before-e2e + with: + from: "$S3_DBP_FOLDER/alfresco-content-app.tar.bz2" + to: $CONTENT_CE_DIST_PATH + id: ${{ matrix.e2e-suites.id }} + aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} + aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + aws-region: ${{ env.AWS_REGION }} + - uses: ./.github/actions/run-e2e + with: + options: "--suite=${{ matrix.e2e-suites.name }}" + - uses: ./.github/actions/after-e2e + with: + id: ${{ matrix.e2e-suites.id }} + aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} + aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + aws-region: ${{ env.AWS_REGION }} + + e2es-playwright: + needs: [lint, build, unit-tests] + name: 'E2e test suites: Folder Rules - Playwright' + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + with: + fetch-depth: 2 + + - name: node + uses: actions/setup-node@v3 + with: + node-version-file: '.nvmrc' + cache: 'npm' + - uses: ./.github/actions/before-install + - run: npm ci + - uses: ./.github/actions/before-e2e + with: + from: "$S3_DBP_FOLDER/alfresco-content-app.tar.bz2" + to: $CONTENT_CE_DIST_PATH + id: 15 + aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} + aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + aws-region: ${{ env.AWS_REGION }} + - name: before playwright + shell: bash + run: npx playwright install chromium + - uses: ./.github/actions/run-e2e + with: + options: "e2e/playwright/tests/folder-rules/playwright.config.ts" + test-runner: playwright + - uses: ./.github/actions/after-e2e + with: + id: 15 + aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} + aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + aws-region: ${{ env.AWS_REGION }} + + finalize: + needs: [lint, build, unit-tests, e2es, e2es-playwright] + name: 'Finalize' + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + with: + fetch-depth: 2 + - uses: Alfresco/alfresco-build-tools/.github/actions/get-commit-message@v1.35.0 + + - name: Check ADF link + shell: bash + run: | + if [[ $COMMIT_MESSAGE == *"[link-adf:"* ]]; then + BRANCH=`echo $COMMIT_MESSAGE | grep -o "\[link-adf\:[^]]*\]" | sed -e 's#\[link-adf:##g' | sed -e 's#\]##g'` + echo -e "\e[31mPRs are not mergeable with conditional build. This build was run with custom ADF branch: $BRANCH \e[0m" + exit 1 + fi; + + diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml deleted file mode 100644 index 934b749d67..0000000000 --- a/.github/workflows/test.yml +++ /dev/null @@ -1,132 +0,0 @@ -name: Test - -on: - push: - branches: [master, develop] - pull_request: - branches: [master, develop] - -jobs: - lint: - name: 'lint' - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v3 - with: - fetch-depth: 2 - - - name: node - uses: actions/setup-node@v3 - with: - node-version: 14 - cache: 'npm' - - run: npm ci - - run: npm run lint - - build: - name: 'build' - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v3 - with: - fetch-depth: 2 - - - name: node - uses: actions/setup-node@v3 - with: - node-version: 14 - cache: 'npm' - - run: npm ci - - run: npm run build --configuration=production,e2e - - test-aca-content: - needs: [lint, build] - name: 'test: aca-content' - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v3 - with: - fetch-depth: 2 - - - name: node - uses: actions/setup-node@v3 - with: - node-version: 14 - cache: 'npm' - - run: npm ci - - run: npm test aca-content -- --browsers=ChromeHeadless --watch=false $TEST_OPTS - - test-aos: - needs: [lint, build] - name: 'test: adf-office-services-ext' - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v3 - with: - fetch-depth: 2 - - - name: node - uses: actions/setup-node@v3 - with: - node-version: 14 - cache: 'npm' - - run: npm ci - - run: npm test adf-office-services-ext -- --browsers=ChromeHeadless --watch=false $TEST_OPTS - - test-aca-shared: - needs: [lint, build] - name: 'test: aca-shared' - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v3 - with: - fetch-depth: 2 - - - name: node - uses: actions/setup-node@v3 - with: - node-version: 14 - cache: 'npm' - - run: npm ci - - run: npm test aca-shared -- --browsers=ChromeHeadless --watch=false $TEST_OPTS - - test-aca-folder-rules: - needs: [lint, build] - name: 'test: aca-folder-rules' - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v3 - with: - fetch-depth: 2 - - - name: node - uses: actions/setup-node@v3 - with: - node-version: 14 - cache: 'npm' - - run: npm ci - - run: npm test aca-folder-rules -- --browsers=ChromeHeadless --watch=false $TEST_OPTS - - test-aca-preview: - needs: [lint, build] - name: 'test: aca-preview' - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v3 - with: - fetch-depth: 2 - - - name: node - uses: actions/setup-node@v3 - with: - node-version: 14 - cache: 'npm' - - run: npm ci - - run: npm test aca-preview -- --browsers=ChromeHeadless --watch=false $TEST_OPTS diff --git a/.travis.yml b/.travis.yml index 8fe409fd3a..adc9313443 100644 --- a/.travis.yml +++ b/.travis.yml @@ -27,14 +27,10 @@ before_install: . ./scripts/ci/job_hooks/before_install.sh install: echo "no install" stages: - - name: Quality and Unit tests - if: type = cron || type = pull_request - name: Publish Docker Registry if: type = push - name: Release Tag and Publish to Dockerhub if: branch = master AND type = push - - name: e2e - if: type = cron || type = pull_request - name: Release Libraries if: type = push - name: Trigger DW @@ -63,139 +59,6 @@ env: jobs: include: - - stage: Quality and Unit tests - name: 'Build (without animation)' - script: npm ci && npm run build -- $BUILD_OPTS - after_success: ./scripts/ci/utils/artifact-to-s3.sh -a $CONTENT_CE_DIST_PATH -o "$S3_DBP_FOLDER/alfresco-content-app.tar.bz2" || travis_terminate 1 - cache: false - - - stage: e2e - name: 'Test Suites: Folder Rules - Playwright' - before_script: - - ./scripts/ci/job_hooks/before_e2e.sh "$S3_DBP_FOLDER/alfresco-content-app.tar.bz2" "$CONTENT_CE_DIST_PATH" "-a" || travis_terminate 1 - - ./scripts/ci/job_hooks/before-playwright.sh - script: ./scripts/ci/jobs/affected-project-with.sh -target e2e -options "e2e/playwright/tests/folder-rules/playwright.config.ts" -test-runner playwright - after_script: - - ./scripts/ci/job_hooks/after_e2e.sh - - - stage: e2e - name: 'Test Suites: authentication,listViews,navigation,application' - before_script: - - ./scripts/ci/job_hooks/before_e2e.sh "$S3_DBP_FOLDER/alfresco-content-app.tar.bz2" "$CONTENT_CE_DIST_PATH" "-a" || travis_terminate 1 - script: ./scripts/ci/jobs/affected-project-with.sh -target e2e -options "--suite=authentication,listViews,navigation,application" - after_script: - - ./scripts/ci/job_hooks/after_e2e.sh - - - stage: e2e - name: 'Test Suites: search' - before_script: - - ./scripts/ci/job_hooks/before_e2e.sh "$S3_DBP_FOLDER/alfresco-content-app.tar.bz2" "$CONTENT_CE_DIST_PATH" "-a" || travis_terminate 1 - script: ./scripts/ci/jobs/affected-project-with.sh -target e2e -options "--suite=search" - after_script: - - ./scripts/ci/job_hooks/after_e2e.sh - - - stage: e2e - name: 'Test Suites: viewer,infoDrawer,extensions' - before_script: - - ./scripts/ci/job_hooks/before_e2e.sh "$S3_DBP_FOLDER/alfresco-content-app.tar.bz2" "$CONTENT_CE_DIST_PATH" "-a" || travis_terminate 1 - script: ./scripts/ci/jobs/affected-project-with.sh -target e2e -options "--suite=viewer,infoDrawer,extensions" - after_script: - - ./scripts/ci/job_hooks/after_e2e.sh - - - stage: e2e - name: 'Test Suites: shareActions' - before_script: - - ./scripts/ci/job_hooks/before_e2e.sh "$S3_DBP_FOLDER/alfresco-content-app.tar.bz2" "$CONTENT_CE_DIST_PATH" "-a" || travis_terminate 1 - script: ./scripts/ci/jobs/affected-project-with.sh -target e2e -options "--suite=shareActions" - after_script: - - ./scripts/ci/job_hooks/after_e2e.sh - - - stage: e2e - name: 'Test Suites: pagination' - before_script: - - ./scripts/ci/job_hooks/before_e2e.sh "$S3_DBP_FOLDER/alfresco-content-app.tar.bz2" "$CONTENT_CE_DIST_PATH" "-a" || travis_terminate 1 - script: ./scripts/ci/jobs/affected-project-with.sh -target e2e -options "--suite=pagination" - after_script: - - ./scripts/ci/job_hooks/after_e2e.sh - - - stage: e2e - name: 'Test Suites: actionsAvailableFilesFolders' - before_script: - - ./scripts/ci/job_hooks/before_e2e.sh "$S3_DBP_FOLDER/alfresco-content-app.tar.bz2" "$CONTENT_CE_DIST_PATH" "-a" || travis_terminate 1 - script: ./scripts/ci/jobs/affected-project-with.sh -target e2e -options "--suite=actionsAvailableFilesFolders" - after_script: - - ./scripts/ci/job_hooks/after_e2e.sh - - - stage: e2e - name: 'Test Suites: actionsAvailableLibraries,actionsAvailableNewMenu' - before_script: - - ./scripts/ci/job_hooks/before_e2e.sh "$S3_DBP_FOLDER/alfresco-content-app.tar.bz2" "$CONTENT_CE_DIST_PATH" "-a" || travis_terminate 1 - script: ./scripts/ci/jobs/affected-project-with.sh -target e2e -options "--suite=actionsAvailableLibraries,actionsAvailableNewMenu" - after_script: - - ./scripts/ci/job_hooks/after_e2e.sh - - - stage: e2e - name: 'Test Suites: actionsAvailableSpecialPermissions' - before_script: - - ./scripts/ci/job_hooks/before_e2e.sh "$S3_DBP_FOLDER/alfresco-content-app.tar.bz2" "$CONTENT_CE_DIST_PATH" "-a" || travis_terminate 1 - script: ./scripts/ci/jobs/affected-project-with.sh -target e2e -options "--suite=actionsAvailableSpecialPermissions" - after_script: - - ./scripts/ci/job_hooks/after_e2e.sh - - - stage: e2e - name: 'Test Suites: copyMoveActions' - before_script: - - ./scripts/ci/job_hooks/before_e2e.sh "$S3_DBP_FOLDER/alfresco-content-app.tar.bz2" "$CONTENT_CE_DIST_PATH" "-a" || travis_terminate 1 - script: ./scripts/ci/jobs/affected-project-with.sh -target e2e -options "--suite=copyMoveActions" - after_script: - - ./scripts/ci/job_hooks/after_e2e.sh - - - stage: e2e - name: 'Test Suites: createActions' - before_script: - - ./scripts/ci/job_hooks/before_e2e.sh "$S3_DBP_FOLDER/alfresco-content-app.tar.bz2" "$CONTENT_CE_DIST_PATH" "-a" || travis_terminate 1 - script: ./scripts/ci/jobs/affected-project-with.sh -target e2e -options "--suite=createActions" - after_script: - - ./scripts/ci/job_hooks/after_e2e.sh - - - stage: e2e - name: 'Test Suites: deleteActions' - before_script: - - ./scripts/ci/job_hooks/before_e2e.sh "$S3_DBP_FOLDER/alfresco-content-app.tar.bz2" "$CONTENT_CE_DIST_PATH" "-a" || travis_terminate 1 - script: ./scripts/ci/jobs/affected-project-with.sh -target e2e -options "--suite=deleteActions" - after_script: - - ./scripts/ci/job_hooks/after_e2e.sh - - - stage: e2e - name: 'Test Suites: editActions,favoriteActions' - before_script: - - ./scripts/ci/job_hooks/before_e2e.sh "$S3_DBP_FOLDER/alfresco-content-app.tar.bz2" "$CONTENT_CE_DIST_PATH" "-a" || travis_terminate 1 - script: ./scripts/ci/jobs/affected-project-with.sh -target e2e -options "--suite=editActions,favoriteActions" - after_script: - - ./scripts/ci/job_hooks/after_e2e.sh - - - stage: e2e - name: 'Test Suites: libraryActions' - before_script: - - ./scripts/ci/job_hooks/before_e2e.sh "$S3_DBP_FOLDER/alfresco-content-app.tar.bz2" "$CONTENT_CE_DIST_PATH" "-a" || travis_terminate 1 - script: ./scripts/ci/jobs/affected-project-with.sh -target e2e -options "--suite=libraryActions" - after_script: - - ./scripts/ci/job_hooks/after_e2e.sh - - - stage: e2e - name: 'Test Suites: uploadDownloadActions' - before_script: - - ./scripts/ci/job_hooks/before_e2e.sh "$S3_DBP_FOLDER/alfresco-content-app.tar.bz2" "$CONTENT_CE_DIST_PATH" "-a" || travis_terminate 1 - script: ./scripts/ci/jobs/affected-project-with.sh -target e2e -options "--suite=uploadDownloadActions" - after_script: - - ./scripts/ci/job_hooks/after_e2e.sh - - - stage: Finalize - name: Check build with link-adf - if: type = pull_request AND commit_message =~ \[link-adf:* - script: - - ./scripts/ci/jobs/check-link-adf.sh - - stage: Publish Docker Registry name: Publish Docker Registry script: ./scripts/travis/deploy/publish.sh "content-ce" "$DOCKER_REPOSITORY_DOMAIN" "$QUAY_USERNAME" "$QUAY_PASSWORD" diff --git a/.travis/env.yml b/.travis/env.yml deleted file mode 100644 index 2c3a5c2046..0000000000 --- a/.travis/env.yml +++ /dev/null @@ -1,5 +0,0 @@ -env: - global: - # APP CONFIGURATION - - APP_CONFIG_NOTIFICATION_LAST=6000 - - APP_CONFIG_SHOW_NOTIFICATION_HISTORY=true diff --git a/angular.json b/angular.json index c4eb494d72..ca39a28a15 100644 --- a/angular.json +++ b/angular.json @@ -587,6 +587,11 @@ "styles": [ "projects/aca-content/src/lib/ui/application.scss" ] + }, + "configurations": { + "adfprod": { + "tsConfig": "projects/aca-content/tsconfig.spec.adf.json" + } } }, "lint": { @@ -673,6 +678,11 @@ "main": "projects/aca-preview/src/test.ts", "tsConfig": "projects/aca-preview/tsconfig.spec.json", "karmaConfig": "projects/aca-preview/karma.conf.js" + }, + "configurations": { + "adfprod": { + "tsConfig": "projects/aca-preview/tsconfig.spec.adf.json" + } } }, "lint": { diff --git a/projects/aca-content/tsconfig.spec.adf.json b/projects/aca-content/tsconfig.spec.adf.json new file mode 100644 index 0000000000..04a6994be7 --- /dev/null +++ b/projects/aca-content/tsconfig.spec.adf.json @@ -0,0 +1,16 @@ +{ + "extends": "../../tsconfig.adf.json", + "compilerOptions": { + "outDir": "../../out-tsc/spec", + "types": [ + "jasmine" + ] + }, + "files": [ + "src/test.ts" + ], + "include": [ + "**/*.spec.ts", + "**/*.d.ts" + ] +} diff --git a/projects/aca-preview/tsconfig.spec.adf.json b/projects/aca-preview/tsconfig.spec.adf.json new file mode 100644 index 0000000000..04a6994be7 --- /dev/null +++ b/projects/aca-preview/tsconfig.spec.adf.json @@ -0,0 +1,16 @@ +{ + "extends": "../../tsconfig.adf.json", + "compilerOptions": { + "outDir": "../../out-tsc/spec", + "types": [ + "jasmine" + ] + }, + "files": [ + "src/test.ts" + ], + "include": [ + "**/*.spec.ts", + "**/*.d.ts" + ] +}