mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2026-09-09 18:02:54 +00:00
317 lines
9.9 KiB
YAML
317 lines
9.9 KiB
YAML
name: "Pull request"
|
|
|
|
on:
|
|
pull_request:
|
|
types: [opened, synchronize, reopened]
|
|
branches: [master, develop]
|
|
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{ github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
env:
|
|
BASE_URL: http://localhost
|
|
ADMIN_EMAIL: admin
|
|
ADMIN_PASSWORD: admin
|
|
HR_USER: admin
|
|
HR_USER_PASSWORD: admin
|
|
PLAYWRIGHT_E2E_HOST: http://localhost:4200
|
|
GH_BUILD_NUMBER: ${{ github.run_id }}
|
|
REPORT_PORTAL_URL: ${{ vars.REPORT_PORTAL_URL }}
|
|
REPORT_PORTAL_TOKEN: ${{ secrets.REPORT_PORTAL_TOKEN }}
|
|
MAXINSTANCES: 2
|
|
RETRY_COUNT: 2
|
|
|
|
jobs:
|
|
lint:
|
|
name: 'lint'
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v7
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- uses: ./.github/actions/setup
|
|
|
|
- run: npm ci
|
|
|
|
- name: upload npm logs
|
|
uses: actions/upload-artifact@v7
|
|
if: failure()
|
|
with:
|
|
name: npm-logs
|
|
path: /home/runner/.npm/_logs/
|
|
|
|
- name: lint affected
|
|
if: ${{ github.event_name == 'pull_request' }}
|
|
run: npm run affected:lint -- --base=origin/develop
|
|
- name: lint all
|
|
if: ${{ github.event_name != 'pull_request' }}
|
|
run: npm run ci:lint
|
|
- run: npm run stylelint
|
|
|
|
detect-e2e-only-changes:
|
|
name: 'Validate / Detect E2E Only Changes'
|
|
runs-on: ubuntu-latest
|
|
outputs:
|
|
only-e2e-changes: ${{ steps.check.outputs.only-e2e-changes }}
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v7
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: Check if only E2E files changed
|
|
id: check
|
|
run: |
|
|
if [ "${{ github.event_name }}" != "pull_request" ]; then
|
|
echo "only-e2e-changes=false" >> $GITHUB_OUTPUT
|
|
exit 0
|
|
fi
|
|
CHANGED_FILES=$(git diff --name-only origin/${{ github.base_ref }}...HEAD)
|
|
echo "Changed files:"
|
|
echo "$CHANGED_FILES"
|
|
NON_E2E_FILES=$(echo "$CHANGED_FILES" | grep -v -E "^(e2e/playwright/|projects/aca-playwright-shared/|\.github/workflows/pull-request\.yml|\.github/workflows/run-e2e-with-env\.yml)" || true)
|
|
if [ -z "$CHANGED_FILES" ] || [ -n "$NON_E2E_FILES" ]; then
|
|
echo "only-e2e-changes=false" >> $GITHUB_OUTPUT
|
|
else
|
|
echo "only-e2e-changes=true" >> $GITHUB_OUTPUT
|
|
fi
|
|
|
|
protect-en-source:
|
|
name: 'Validate / Protect English source (en.json)'
|
|
if: ${{ github.event_name == 'pull_request' && github.head_ref == 'automated-translations-update' }}
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v7
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: Fail if automated Crowdin PR modifies en.json
|
|
env:
|
|
BASE_SHA: ${{ github.event.pull_request.base.sha }}
|
|
run: |
|
|
git fetch --no-tags --depth=1 origin "$BASE_SHA"
|
|
CHANGED_EN=$(git diff --name-only "$BASE_SHA"...HEAD | grep -E '(^|/)i18n/en\.json$' || true)
|
|
if [ -n "$CHANGED_EN" ]; then
|
|
echo "::error::Automated Crowdin PR must not modify the English source (en.json). Offending file(s):"
|
|
echo "$CHANGED_EN"
|
|
echo "This usually means a Crowdin target language (e.g. en-AU) collides with the 'en' two_letters_code. Fix crowdin.yml languages_mapping instead of merging this change."
|
|
exit 1
|
|
fi
|
|
echo "OK: no en.json source file modified by the automated Crowdin PR."
|
|
|
|
build:
|
|
name: 'build'
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v7
|
|
with:
|
|
fetch-depth: 2
|
|
|
|
- uses: ./.github/actions/before-install
|
|
- run: npm ci
|
|
- name: upload npm logs
|
|
uses: actions/upload-artifact@v7
|
|
if: failure()
|
|
with:
|
|
name: npm-logs
|
|
path: /home/runner/.npm/_logs/
|
|
- run: npm run ci:build -- aca-playwright-shared
|
|
- run: npm run build -- $BUILD_OPTS
|
|
|
|
- name: dist cache
|
|
if: ${{ success() }}
|
|
uses: actions/cache/save@v6
|
|
with:
|
|
path: ./dist/content-ce
|
|
key: cache-dist-${{ github.run_id }}
|
|
|
|
unit-tests:
|
|
needs: [lint, build, detect-e2e-only-changes]
|
|
if: ${{ needs.detect-e2e-only-changes.outputs.only-e2e-changes != 'true' }}
|
|
name: 'Validate / Unit Tests'
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v7
|
|
with:
|
|
fetch-depth: 0
|
|
- uses: ./.github/actions/before-install
|
|
- run: npm ci
|
|
- name: upload npm logs
|
|
uses: actions/upload-artifact@v7
|
|
if: failure()
|
|
with:
|
|
name: npm-logs
|
|
path: /home/runner/.npm/_logs/
|
|
|
|
- name: Test
|
|
if: ${{ github.event_name == 'pull_request' }}
|
|
run: npm run affected:test -- --browsers=ChromeHeadless --watch=false $TEST_OPTS --base=origin/develop
|
|
|
|
- name: Test all
|
|
if: ${{ github.event_name != 'pull_request' }}
|
|
run: npm run ci:test -- $TEST_OPTS
|
|
|
|
e2es-playwright:
|
|
if: ${{ !contains(github.event.pull_request.labels.*.name, 'ci:skip-e2e') }}
|
|
needs: [lint, build]
|
|
name: E2E | ${{ matrix.browser || 'chromium' }} | ${{ matrix.e2e-suites.name }} | Playwright
|
|
runs-on: ubuntu-24.04
|
|
env:
|
|
NODE_OPTIONS: --dns-result-order=ipv4first
|
|
PLAYWRIGHT_BROWSER: ${{ matrix.browser }}
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
# For PR runs, only Chromium
|
|
browser: ["chromium"]
|
|
e2e-suites:
|
|
- name: "create-actions"
|
|
id: 1
|
|
- name: "folder-rules"
|
|
id: 2
|
|
- name: "viewer"
|
|
id: 3
|
|
- name: "authentication"
|
|
id: 4
|
|
- name: "navigation"
|
|
id: 5
|
|
- name: "special-permissions"
|
|
id: 6
|
|
- name: "pagination"
|
|
id: 7
|
|
- name: "list-views"
|
|
id: 8
|
|
- name: "share-action"
|
|
id: 9
|
|
- name: "copy-move-actions"
|
|
id: 10
|
|
- name: "library-actions"
|
|
id: 11
|
|
- name: "info-drawer"
|
|
id: 12
|
|
- name: "search"
|
|
id: 13
|
|
- name: "upload-download-actions"
|
|
id: 14
|
|
- name: "favorite-actions"
|
|
id: 15
|
|
- name: "delete-actions"
|
|
id: 16
|
|
- name: "edit-actions"
|
|
id: 17
|
|
- name: "smoke-test"
|
|
id: 18
|
|
- name: "folder-information-actions"
|
|
id: 19
|
|
- name: "viewer-actions"
|
|
id: 20
|
|
- name: "create-link-actions"
|
|
id: 21
|
|
- name: "a11y-personal-files"
|
|
id: 22
|
|
steps:
|
|
- name: Free hosted runner disk space
|
|
uses: Alfresco/alfresco-build-tools/.github/actions/free-hosted-runner-disk-space@d2981070adf1a68c3ddcbf0ebba193467261c9b3 # v18.26.0
|
|
|
|
- name: Checkout
|
|
uses: actions/checkout@v7
|
|
with:
|
|
fetch-depth: 2
|
|
|
|
- name: Deploy local ACS
|
|
id: deploy-local-acs
|
|
uses: ./.github/actions/deploy-local-acs
|
|
with:
|
|
docker_username: ${{ secrets.DOCKER_USERNAME }}
|
|
docker_password: ${{ secrets.DOCKER_PASSWORD }}
|
|
quay_username: ${{ secrets.QUAY_USERNAME }}
|
|
quay_password: ${{ secrets.QUAY_PASSWORD }}
|
|
acs_deployment_version: 'master'
|
|
log_name_identifier: "${{ matrix.browser || 'chromium' }}-${{ matrix.e2e-suites.name }}"
|
|
|
|
- name: Before install
|
|
uses: ./.github/actions/before-install
|
|
|
|
- name: Install dependencies
|
|
run: npm ci
|
|
|
|
- name: Restore dist cache
|
|
uses: actions/cache/restore@v6
|
|
id: cache
|
|
with:
|
|
path: ./dist/content-ce
|
|
key: cache-dist-${{ github.run_id }}
|
|
|
|
- name: Before e2e
|
|
uses: ./.github/actions/before-e2e
|
|
|
|
- name: Check Search Indexing
|
|
continue-on-error: true
|
|
run: npm run ci:check-search-indexing
|
|
env:
|
|
ADMIN_PASSWORD_SCRIPT: ${{ env.ADMIN_PASSWORD }}
|
|
|
|
- name: Before playwright
|
|
run: npm run ci:playwright:install
|
|
|
|
- name: Run e2e playwright
|
|
uses: ./.github/actions/run-e2e-playwright
|
|
with:
|
|
options: "${{ matrix.e2e-suites.name }}"
|
|
artifact-name: "${{ matrix.browser || 'chromium' }}-${{ matrix.e2e-suites.name }}"
|
|
test-runner: playwright
|
|
env:
|
|
PLAYWRIGHT_BROWSER: ${{ matrix.browser || 'chromium' }}
|
|
|
|
- name: Debug Ingress Controller Logs
|
|
if: always() && steps.deploy-local-acs.outcome == 'success'
|
|
run: |
|
|
kubectl logs -n ingress-nginx -l app.kubernetes.io/name=ingress-nginx --tail=-1
|
|
|
|
- name: Spit cluster status after integration tests
|
|
if: always()
|
|
run: |
|
|
kubectl get all --all-namespaces
|
|
kubectl describe pod
|
|
|
|
finalize:
|
|
if: ${{ always() }}
|
|
needs: [lint, build, detect-e2e-only-changes, unit-tests, e2es-playwright]
|
|
name: 'Finalize'
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Check previous jobs status
|
|
if: >-
|
|
${{
|
|
contains(needs.*.result, 'failure')
|
|
|| contains(needs.*.result, 'cancelled')
|
|
}}
|
|
run: exit 1
|
|
|
|
- name: Check e2e skipped
|
|
if: ${{ contains(github.event.pull_request.labels.*.name, 'ci:skip-e2e') }}
|
|
run: echo "E2E tests were skipped due to ci:skip-e2e label"
|
|
|
|
- name: Checkout
|
|
uses: actions/checkout@v7
|
|
with:
|
|
fetch-depth: 2
|
|
|
|
- name: Extract commit message
|
|
uses: Alfresco/alfresco-build-tools/.github/actions/get-commit-message@d2981070adf1a68c3ddcbf0ebba193467261c9b3 #v18.26.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;
|