diff --git a/.circleci/config.yml b/.circleci/config.yml deleted file mode 100644 index 20abfa9..0000000 --- a/.circleci/config.yml +++ /dev/null @@ -1,182 +0,0 @@ -version: 2.1 -commands: - setup: - description: "Setup environment" - steps: - - run: | - composer self-update --stable - install_civicrm: - description: "Install CiviCRM" - parameters: - build_name: - type: string - default: master - type: - type: string - default: drupal-clean - version: - type: string - default: master - url: - type: string - default: http://localhost:8080 - steps: - - run: | - civiver=<< parameters.version >> - if [[ "$civiver" == "stable" ]]; then - civiver=$(curl -s 'https://latest.civicrm.org/stable.php') - fi - su - buildkit -c "/buildkit/bin/civibuild create << parameters.build_name >> --civi-ver $civiver --type << parameters.type >> --url << parameters.url >>" - install_dependencies: - description: "Install Dependencies" - parameters: - build_name: - type: string - default: master - steps: - - run: | - EXT_DIR=/buildkit/build/<< parameters.build_name >>/web/sites/default/files/civicrm/ext - cd $EXT_DIR - git clone https://github.com/Project60/org.project60.sepa.git - git clone https://github.com/Project60/org.project60.banking.git - git clone https://lab.civicrm.org/extensions/mjwshared.git - git clone https://github.com/greenpeace-cee/adyen.git -b main - chown buildkit:buildkit org.project60.sepa org.project60.banking mjwshared adyen -R - su - buildkit -c "cd /buildkit/build/<< parameters.build_name >>/web && cv en org.project60.sepa org.project60.banking mjwshared adyen" - install_extension: - description: "Install Extension" - parameters: - build_name: - type: string - default: master - steps: - - run: | - EXT_DIR=/buildkit/build/<< parameters.build_name >>/web/sites/default/files/civicrm/ext/$CIRCLE_PROJECT_REPONAME - cp /root/project $EXT_DIR -r - chown buildkit:buildkit $EXT_DIR -R - cd $EXT_DIR - su - buildkit -c "cd /buildkit/build/<< parameters.build_name >>/web && cv en $CIRCLE_PROJECT_REPONAME" - run_civilint: - description: "Run civilint" - parameters: - build_name: - type: string - default: master - steps: - - run: su - buildkit -c "cd /buildkit/build/<< parameters.build_name >>/web/sites/default/files/civicrm/ext/$CIRCLE_PROJECT_REPONAME && find . -type f -not -path './vendor/*' | civilint" - run_phpunit: - description: "Run PHPUnit" - parameters: - build_name: - type: string - default: master - steps: - - run: | - mkdir -p /phpunit - chown buildkit:buildkit /phpunit - su - buildkit -c "cd /buildkit/build/<< parameters.build_name >>/web/sites/default/files/civicrm/ext/$CIRCLE_PROJECT_REPONAME && /buildkit/bin/phpunit9 --log-junit /phpunit/<< parameters.build_name >>/junit.xml" - run_all: - description: "Run all steps" - parameters: - build_name: - type: string - default: master - type: - type: string - default: drupal-clean - version: - type: string - default: master - url: - type: string - default: http://localhost:8080 - steps: - - install_civicrm: - build_name: << parameters.build_name >> - type: << parameters.type >> - version: << parameters.version >> - url: << parameters.url >> - - install_dependencies: - build_name: << parameters.build_name >> - - install_extension: - build_name: << parameters.build_name >> - - run_civilint: - build_name: << parameters.build_name >> - - run_phpunit: - build_name: << parameters.build_name >> - - store_test_results: - path: /phpunit - - store_artifacts: - path: /phpunit - -executors: - civicrm: - docker: - - image: michaelmcandrew/civicrm-buildkit - name: civicrm - environment: - TERM: xterm-color - APACHE_RUN_USER: buildkit - - image: mysql:5.7 - name: mysql - environment: - MYSQL_ROOT_PASSWORD: buildkit - - image: maildev/maildev - name: maildev - -jobs: - build_mysql_5_7: - executor: civicrm - steps: - - setup - - checkout - - run_all - - run_all: - build_name: civi-stable - version: "stable" - url: http://localhost:8081 - - run_all: - build_name: civi-5.69 - version: "5.69" - url: http://localhost:8082 - - run_all: - build_name: civi-5.57 - version: "5.57" - url: http://localhost:8083 - build_mariadb_10_6: - executor: civicrm - docker: - - image: michaelmcandrew/civicrm-buildkit - name: civicrm - environment: - TERM: xterm-color - APACHE_RUN_USER: buildkit - - image: mariadb:10.6 - name: mysql - environment: - MYSQL_ROOT_PASSWORD: buildkit - - image: maildev/maildev - name: maildev - steps: - - setup - - checkout - - run_all - - run_all: - build_name: civi-stable - version: "stable" - url: http://localhost:8081 - - run_all: - build_name: civi-5.69 - version: "5.69" - url: http://localhost:8082 - - run_all: - build_name: civi-5.57 - version: "5.57" - url: http://localhost:8083 - -workflows: - version: 2 - build: - jobs: - - build_mysql_5_7 - - build_mariadb_10_6 diff --git a/.github/workflows/unit-tests.yml b/.github/workflows/unit-tests.yml new file mode 100644 index 0000000..b2714e4 --- /dev/null +++ b/.github/workflows/unit-tests.yml @@ -0,0 +1,82 @@ +name: "Run unit tests" + +on: ["push"] + +env: + CIVI_CI_CIVICRM: ${{ vars.CIVI_CI_CIVICRM || '["master"]' }} + CIVI_CI_MYSQL: ${{ vars.CIVI_CI_MYSQL || '["8.0"]' }} + CIVI_CI_OS: ${{ vars.CIVI_CI_OS || '["ubuntu-22.04"]' }} + CIVI_CI_PHP: ${{ vars.CIVI_CI_PHP || '["8.1"]' }} + CIVI_CI_BUILD_TYPE: ${{ vars.CIVI_CI_BUILD_TYPE || '["drupal-clean"]' }} + CIVI_CI_EXCLUDES: ${{ vars.CIVI_CI_EXCLUDES || '' }} + +jobs: + setup-matrix: + runs-on: ubuntu-latest + outputs: + matrix: ${{ steps.setup-matrix.outputs.matrix }} + steps: + - id: setup-matrix + uses: druzsan/setup-matrix@v2 + with: + matrix: | + civicrm: ${{ env.CIVI_CI_CIVICRM }} + mysql: ${{ env.CIVI_CI_MYSQL }} + os: ${{ env.CIVI_CI_OS }} + php: ${{ env.CIVI_CI_PHP }} + build-type: ${{ env.CIVI_CI_BUILD_TYPE }} + exclude: ${{ env.CIVI_CI_EXCLUDES }} + + run-tests: + needs: setup-matrix + strategy: + fail-fast: false + matrix: ${{ fromJson(needs.setup-matrix.outputs.matrix) }} + runs-on: "${{ matrix.os }}" + + services: + mysql: + image: "mysql:${{ matrix.mysql }}" + env: + MYSQL_ALLOW_EMPTY_PASSWORD: "yes" + ports: + - "3306:3306" + options: >- + --health-cmd="mysqladmin ping" + --health-interval="10s" + --health-timeout="5s" + --health-retries="3" + + steps: + - id: clone-repo + name: "Clone the repository" + uses: "actions/checkout@v3" + with: + ref: "${{ github.ref_name }}" + path: "de.systopia.contract" + - id: build-ci + uses: greenpeace-cee/civi-ci@main + with: + extension: de.systopia.contract + civicrm: ${{ matrix.civicrm }} + php: ${{ matrix.php }} + build-type: ${{ matrix.build-type }} + - id: install-extension + name: "Install Extension" + env: + EXT_DIR: ${{ steps.build-ci.outputs.ext-dir }} + run: | + PATH="/home/runner/buildkit/bin:$PATH" + cd "$EXT_DIR" + cp -R "$GITHUB_WORKSPACE/de.systopia.contract" "$EXT_DIR/de.systopia.contract" + git clone https://github.com/Project60/org.project60.banking.git "$EXT_DIR/org.project60.banking" + git clone https://github.com/Project60/org.project60.sepa.git "$EXT_DIR/org.project60.sepa" + cv en de.systopia.contract + - id: run-tests + name: "Run Tests" + env: + EXT_DIR: ${{ steps.build-ci.outputs.ext-dir }} + run: | + PATH="/home/runner/buildkit/bin:$PATH" + cd "$EXT_DIR/de.systopia.contract" + CIVICRM_UF="UnitTests" phpunit9