diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1d1058f101..c674612062 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -99,6 +99,136 @@ jobs: # mvn -B test -pl core,data-model -am -DfailIfNoTests=false # mvn -B test -pl "repository,mmt" -am "-Dtest=AllUnitTestsSuite,AllMmtUnitTestSuite" -DfailIfNoTests=false + Remote-api-AppContextTestSuites: + name: Repository - ${{ matrix.testSuite }} + runs-on: ubuntu-latest + needs: + - prepare + if: > + ! contains(github.event.head_commit.message, '[skip repo]') && + ! contains(github.event.head_commit.message, '[skip tests]') && + ! contains(github.event.head_commit.message, '[force]') + strategy: + fail-fast: false + matrix: + include: + - testSuite: AppContext01TestSuite + profile: default + - testSuite: AppContext02TestSuite + profile: with-transform-core-aio + - testSuite: AppContext03TestSuite + profile: with-transform-core-aio + - testSuite: AppContext04TestSuite + profile: with-transform-core-aio + - testSuite: AppContextExtraTestSuite + profile: default + steps: + - uses: actions/checkout@v3 + - name: Cache local Maven repository + uses: actions/cache@v2 + with: + path: ~/.m2/repository + key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} + restore-keys: | + ${{ runner.os }}-maven- + - name: "Login to Quay.io" + uses: docker/login-action@v1 + with: + registry: quay.io + username: ${{ secrets.QUAY_USERNAME }} + password: ${{ secrets.QUAY_PASSWORD }} + - name: "Set up Java" + uses: actions/setup-java@v3 + with: + java-version: ${{ env.JAVA_VERSION }} + distribution: "temurin" + - name: "Set transformers tag" + run: echo "TRANSFORMERS_TAG=$(mvn help:evaluate -Dexpression=dependency.alfresco-transform-core.version -q -DforceStdout)" >> $GITHUB_ENV + - name: "Set up the environment" + run: docker-compose -f ./scripts/ci/docker-compose/docker-compose.yaml --profile ${{ matrix.profile }} up -d + - name: "Run tests" + run: mvn -B test -pl remote-api -am -Dtest=${{ matrix.testSuite }} -DfailIfNoTests=false -Ddb.driver=org.postgresql.Driver -Ddb.name=alfresco -Ddb.url=jdbc:postgresql://localhost:5433/alfresco -Ddb.username=alfresco -Ddb.password=alfresco + + Repository-MariaDB-tests: + name: Repository - MariaDB ${{ matrix.version }} tests + runs-on: ubuntu-latest + needs: + - prepare + if: > + ((github.ref_name == 'master' || contains(github.ref_name, '[release]')) && + ! contains(github.event.head_commit.message, '[skip db]')) || + contains(github.event.head_commit.message, '[db]') && + ! contains(github.event.head_commit.message, '[skip tests]') && + ! contains(github.event.head_commit.message, '[force]') + strategy: + fail-fast: false + matrix: + version: ['10.2.18', '10.4', '10.5'] + steps: + - uses: actions/checkout@v3 + - name: Cache local Maven repository + uses: actions/cache@v2 + with: + path: ~/.m2/repository + key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} + restore-keys: | + ${{ runner.os }}-maven- + - name: "Login to Quay.io" + uses: docker/login-action@v1 + with: + registry: quay.io + username: ${{ secrets.QUAY_USERNAME }} + password: ${{ secrets.QUAY_PASSWORD }} + - name: "Set up Java" + uses: actions/setup-java@v3 + with: + java-version: ${{ env.JAVA_VERSION }} + distribution: "temurin" + - name: "Set up the environment" + run: docker-compose -f ./scripts/ci/docker-compose/docker-compose-db.yaml --profile mariadb up -d + env: + MARIADB_VERSION: ${{ matrix.version }} + - name: "Run tests" + run: mvn -B test -pl repository -am -Dtest=AllDBTestsTestSuite -DfailIfNoTests=false -Ddb.name=alfresco -Ddb.url=jdbc:mariadb://localhost:3307/alfresco?useUnicode=yes\&characterEncoding=UTF-8 -Ddb.username=alfresco -Ddb.password=alfresco -Ddb.driver=org.mariadb.jdbc.Driver + + Repository-MySQL-tests: + name: Repository - MySQL 8 tests + runs-on: ubuntu-latest + needs: + - prepare + if: > + ((github.ref_name == 'master' || contains(github.ref_name, '[release]')) && + ! contains(github.event.head_commit.message, '[skip db]')) || + contains(github.event.head_commit.message, '[db]') && + ! contains(github.event.head_commit.message, '[skip tests]') && + ! contains(github.event.head_commit.message, '[force]') + steps: + - uses: actions/checkout@v3 + - name: Cache local Maven repository + uses: actions/cache@v2 + with: + path: ~/.m2/repository + key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} + restore-keys: | + ${{ runner.os }}-maven- + - name: "Login to Quay.io" + uses: docker/login-action@v1 + with: + registry: quay.io + username: ${{ secrets.QUAY_USERNAME }} + password: ${{ secrets.QUAY_PASSWORD }} + - name: "Set up Java" + uses: actions/setup-java@v3 + with: + java-version: ${{ env.JAVA_VERSION }} + distribution: "temurin" + - name: "Set up the environment" + run: docker-compose -f ./scripts/ci/docker-compose/docker-compose-db.yaml --profile mysql up -d + env: + MYSQL_VERSION: 8 + - name: "Run tests" + run: mvn -B test -pl repository -am -Dtest=AllDBTestsTestSuite -DfailIfNoTests=false -Ddb.driver=com.mysql.jdbc.Driver -Ddb.name=alfresco -Ddb.url=jdbc:mysql://localhost:3307/alfresco -Ddb.username=alfresco -Ddb.password=alfresco + Repository-AppContextTestSuites: name: Repository - ${{ matrix.testSuite }} runs-on: ubuntu-latest @@ -122,7 +252,7 @@ jobs: profile: with-transform-core-aio - testSuite: AppContext05TestSuite profile: default - parameters: '\"-Didentity-service.auth-server-url=http://${HOST_IP}:8999/auth\"' + parameters: '"-Didentity-service.auth-server-url=http://${HOST_IP}:8999/auth"' - testSuite: AppContext06TestSuite profile: with-transform-core-aio - testSuite: AppContextExtraTestSuite @@ -158,7 +288,7 @@ jobs: then mkdir -p "${HOME}/tmp" cp repository/src/test/resources/realms/alfresco-realm.json "${HOME}/tmp" - export HOST_IP=$(hostname -I | cut -f1 -d' ') + echo "HOST_IP=$(hostname -I | cut -f1 -d' ')" >> $GITHUB_ENV docker run -d -e KEYCLOAK_USER=admin -e KEYCLOAK_PASSWORD=admin -e DB_VENDOR=h2 -p 8999:8080 -e KEYCLOAK_IMPORT=/tmp/alfresco-realm.json -v $HOME/tmp/alfresco-realm.json:/tmp/alfresco-realm.json alfresco/alfresco-identity-service:1.2 fi - name: "Set transformers tag" @@ -168,19 +298,47 @@ jobs: - name: "Run tests" run: mvn -B test -pl repository -am -Dtest=${{ matrix.testSuite }} -DfailIfNoTests=false -Ddb.driver=org.postgresql.Driver -Ddb.name=alfresco -Ddb.url=jdbc:postgresql://localhost:5433/alfresco -Ddb.username=alfresco -Ddb.password=alfresco ${{ matrix.parameters }} - Repository-MariaDB-tests: - name: Repository - MariaDB ${{ matrix.version }} tests + TAS-Tests: + name: {{ matrix.test-name }} runs-on: ubuntu-latest needs: - prepare if: > - ! contains(github.event.head_commit.message, '[skip repo]') && + ((github.ref_name == 'master' || contains(github.ref_name, '[release]') || github.event_name == 'pull_request' ) && + ! contains(github.event.head_commit.message, '[skip tas]')) || + contains(github.event.head_commit.message, '[tas]') && ! contains(github.event.head_commit.message, '[skip tests]') && ! contains(github.event.head_commit.message, '[force]') strategy: fail-fast: false matrix: - version: ['10.2.18', '10.4', '10.5', '10.6'] + include: + - test-name: "REST API TAS tests part1" + test-dir: rtas-restapi + test-profile: run-restapi-part1 + - test-name: "REST API TAS tests part2" + test-dir: tas-restapi + test-profile: run-restapi-part2 + - test-name: "REST API TAS tests part3" + test-dir: tas-restapi + test-profile: run-restapi-part3 + - test-name: "CMIS TAS tests - BROWSER binding" + test-dir: tas-cmis + test-profile: run-cmis-browser + - test-name: "CMIS TAS tests - ATOM binding" + test-dir: tas-cmis + test-profile: run-cmis-atom + - test-name: "CMIS TAS tests - WEBSERVICES binding" + test-dir: tas-cmis + test-profile: run-cmis-webservices + - test-name: "Email TAS tests" + test-dir: tas-email + - test-name: "WebDAV TAS tests" + test-dir: tas-webdav + - test-name: "Integration TAS tests" + test-dir: tas-integration + env: + REQUIRES_LOCAL_IMAGES: true steps: - uses: actions/checkout@v3 - name: Cache local Maven repository @@ -201,14 +359,65 @@ jobs: with: java-version: ${{ env.JAVA_VERSION }} distribution: "temurin" - - name: "Set transformers tag" - run: echo "TRANSFORMERS_TAG=$(mvn help:evaluate -Dexpression=dependency.alfresco-transform-core.version -q -DforceStdout)" >> $GITHUB_ENV + - name: "Build" + timeout-minutes: ${{ fromJSON(env.GITHUB_ACTIONS_DEPLOY_TIMEOUT) }} + run: | + bash ./scripts/ci/init.sh + bash ./scripts/ci/build.sh - name: "Set up the environment" - run: docker-compose -f ./scripts/ci/docker-compose/docker-compose-db.yaml --profile mariadb up -d - env: - MARIADB_VERSION: ${{ matrix.version }} + run: | + ${{ env.TAS_SCRIPTS }}/start-compose.sh ${{ env.TAS_ENVIRONMENT }}/docker-compose-minimal+transforms.yml + ${{ env.TAS_SCRIPTS }}/wait-for-alfresco-start.sh "http://localhost:8082/alfresco" + - name: "Run integration test" + run: | + if [ ${{ matrix.test-name }} == 'Integration TAS tests' ]; + then + mvn install -pl :alfresco-community-repo-integration-test -am -DskipTests -Pall-tas-tests + fi - name: "Run tests" - run: mvn -B test -pl repository -am -Dtest=AllDBTestsTestSuite -DfailIfNoTests=false -Ddb.name=alfresco -Ddb.url=jdbc:mariadb://localhost:3307/alfresco?useUnicode=yes\&characterEncoding=UTF-8 -Ddb.username=alfresco -Ddb.password=alfresco -Ddb.driver=org.mariadb.jdbc.Driver + timeout-minutes: ${{ fromJSON(env.GITHUB_ACTIONS_DEPLOY_TIMEOUT) }} + run: mvn -B verify -f packaging/tests/${{ matrix.test-dir }}/pom.xml -Pall-tas-tests,${{ matrix.test-profile }} -Denvironment=default -DrunBugs=false +ci: + yml: +# Repository-PostgreSQL-tests: +# name: Repository - PostgreSQL ${{ matrix.version }} tests +# runs-on: ubuntu-latest +# needs: +# - prepare +# if: > +# ! contains(github.event.head_commit.message, '[skip repo]') && +# ! contains(github.event.head_commit.message, '[skip tests]') && +# ! contains(github.event.head_commit.message, '[force]') +# strategy: +# fail-fast: false +# matrix: +# version: ['13.7', '14.4'] +# steps: +# - uses: actions/checkout@v3 +# - name: Cache local Maven repository +# uses: actions/cache@v2 +# with: +# path: ~/.m2/repository +# key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} +# restore-keys: | +# ${{ runner.os }}-maven- +# - name: "Login to Quay.io" +# uses: docker/login-action@v1 +# with: +# registry: quay.io +# username: ${{ secrets.QUAY_USERNAME }} +# password: ${{ secrets.QUAY_PASSWORD }} +# - name: "Set up Java" +# uses: actions/setup-java@v3 +# with: +# java-version: ${{ env.JAVA_VERSION }} +# distribution: "temurin" +# - name: "Set up the environment" +# run: docker-compose -f ./scripts/ci/docker-compose/docker-compose-db.yaml --profile mariadb up -d +# env: +# MARIADB_VERSION: ${{ matrix.version }} +# - name: "Run tests" +# run: mvn -B test -pl repository -am -Dtest=AllDBTestsTestSuite -DfailIfNoTests=false -Ddb.name=alfresco -Ddb.url=jdbc:mariadb://localhost:3307/alfresco?useUnicode=yes\&characterEncoding=UTF-8 -Ddb.username=alfresco -Ddb.password=alfresco -Ddb.driver=org.mariadb.jdbc.Driver # Remote-api-AppContext01TestSuite: # name: "Remote-api - AppContext01TestSuite" # runs-on: ubuntu-latest